ResponseModel responseModel = new ResponseModel(); var contacts = new List(); OutlookServicesClient客户端=新的OutlookServicesClient(新的Uri(“https://outlook.office.com/api/v2.0/”), async()=> { return oValidationResponse.access_token; }); 尝试 { var userDetail = await client.Me.Contacts.ExecuteAsync();
我如何将它用于OrderBy
CreatedDateTime
,即
var userDetail = await client.Me.Contacts.OrderBy(x=>x.CreatedDateTime).ExecuteAsync();
此语法提供错误IContact not contain CreatedDateTime
,因此现在我没有其他方法可以使用。
答案 0 :(得分:0)
根据您检索联系人的代码。以下是一个检索邮件并使用 ReceivedDateTime 订购邮件的示例。
OutlookServicesClient client = new OutlookServicesClient(new Uri("https://outlook.office.com/api/v2.0/"), () =>
{
return Task.Delay(10).ContinueWith(t => accessToken);
});
var Messages = client.Me.Messages.OrderBy(msg => msg.ReceivedDateTime).Take(20).ExecuteAsync().Result;
int i = 0;
foreach (var msg in Messages.CurrentPage)
{
Console.WriteLine($"({++i,-3}:){msg.Subject,-50}:\t{msg.ReceivedDateTime,-30}");
}
有关邮件休息的更多详细信息,请参阅here。