如何从Office365API预览的Mail REST中返回所有元数据?
msdn文档似乎表明您发送了一个带有"application/json;odata.metadata=full",值的Accept报头,但是这会导致返回的属性数量有限,并且不包括电子邮件的正文。
http://msdn.microsoft.com/en-us/library/office/dn605901(v=office.15).aspx
我也用同样的结果尝试了"odata=verbose“。以下是在任何一种情况下返回的json:
{
"@odata.context":"",
"@odata.id":"",
"@odata.editLink":"",
"Id":"",
"Subject":"",
"DateTimeReceived":"",
"From":{},
"Attachments@odata.navigationLink":""
}更新:
REST端点:https://outlook.office365.com/ews/odata/Me/Inbox/Messages
长毛的回答为我指明了正确的方向。我在$select查询参数中指定了一个字段列表,该参数覆盖Accept的完整元数据设置。删除$select查询后,将返回完整的元数据。
发布于 2014-04-24 15:44:43
您能共享用于访问这些消息的url吗?如果您使用的是:https://outlook.office365.com/ews/odata/Me/Inbox/Messages之类的内容,您应该在响应中看到Body属性。您还可以使用$select专门请求选择性属性。例如:https://outlook.office365.com/ews/odata/Me/Inbox/Messages?$select=Subject,Body&$top=1
$top可用于限制返回的项目数。
如果指定了$select,它将覆盖Accept="odata.metadata=full“设置,并只返回$select查询中指定的字段。
发布于 2015-10-20 16:58:52
很可能这已经不在你的雷达上了。但这对我有用。
公共异步空GetFolderMessagesList(string parentFolderId,OnFeedBackMessage onFeedBackMessage,OnErrorMessage onErrorMessage) { try {
jsonLastRun = "";
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get,
new Uri(("https://outlook.office365.com/api/v1.0/me/folders/{ChangeThisToFolder_id}/messages")));
// Add the Authorization header with the basic login credentials.
var auth = "Basic " +
Convert.ToBase64String(
Encoding.UTF8.GetBytes(UserAccount + ":" + PassWord));
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", auth);
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
jsonLastRun = await response.Content.ReadAsStringAsync();
}
catch (Exception exception)
{
onErrorMessage?.Invoke("GetFolderList -> " + exception.Message);
}}
https://stackoverflow.com/questions/23270405
复制相似问题