我使用https://github.com/jamesiarmes/php-ews库来访问我的交换帐户。
如果我使用正确的凭据来创建 ExchangeWebServices 对象,我会得到准确的响应。
$ews = new ExchangeWebServices("outlook.office365.com", "tes@abc.com", "test123");
$request = new EWSType_FindItemType();
$response = $ews->FindItem($request);
但是如果凭据错误,它会通过抛出异常来破坏站点
EWS_Exception: SOAP client returned status of 401 in ExchangeWebServices->processResponse()
有什么方法可以将响应作为“失败”或某个布尔值而不是错误消息?