我用在“https://github.com/jasonjoh/php-tutorial”中描述的基本的例子/教程,并试图添加“$搜索”参数中的getMessages()函数搜索参数不与Outlook工作RESTAPI
$getMessagesParameters = array (
// Message Search Conditions
"\$search" => 'subject:"pizza"',
// Only return Subject, ReceivedDateTime, and From fields
"\$select" => "Subject,Body",
// Return at most 10 results
"\$top" => "10"
);
$getMessagesUrl = self::$outlookApiUrl."/Me/Messages?".http_build_query($getMessagesParameters);
$response = $this->makeApiCall($access_token, $user_email, "GET", $getMessagesUrl);
的请求返回错误400
不知道可能是正确的语法
我已经提到了以下链接
https://msdn.microsoft.com/en-us/library/cc513841%28v=office.12%29.aspx
如果有人有更好的想法通过邮件进行搜索,请建议...
哪些是您使用API的版本?是否有可能显示最终请求url(您可以通过fiddler或您的浏览器调试器 - 网络部分获取)? –
@BenoitPatra我们不能使用浏览器调试器来捕获url ...请求是从服务器发出的......无论如何你可以得到这个想法......代码使用'http_build_query()'和'$ outlookApiUrl = “https://outlook.office.com/api/v2.0”'。结果网址看起来类似于'https://outlook.office.com/api/v2.0/Me/Messages?$search=subject:"pizza"&$select=Subject,Body&$orderby=ReceivedDateTime DESC&$顶部= 10'和特殊字符可能是网址编码...重点是当我删除'$搜索'参数,没有错误返回 –