我在 C# 中使用 Graph SDK 来阅读邮件消息,我能够做到这一点.我想要我的邮件消息的 Mime 内容.我们如何使用 SDK 在我的请求中传递 $value.
I am using Graph SDK in C# to read mail messages and I am able to do that. I want Mime Content of my mail message. How do we pass $value in my request using SDK.
示例代码:
mails = await graphserviceclient
.Me
.Messages
.Request()
.Top(2)
.GetAsync();
请告诉我如何在使用 graphserviceclient 的 C# 代码中传递 $value.
Please let me know how we can pass $value in C# code which uses graphserviceclient.
我们正在等待一些元数据更新,以便在 SDK 中简化此操作.目前,获取 MIME 内容的解决方法如下所示:
We are waiting for some metadata updates to make this easier in the SDK. For the moment, the workaround for getting the MIME content looks something like this:
GraphServiceClient graphClient = new
GraphServiceClient("https://graph.microsoft.com/beta/",authProvider);
var messageId = "...";
var request = graphClient.Me.Messages[messageId].Request()
.GetHttpRequestMessage();
request.RequestUri = new Uri(request.RequestUri.OriginalString +"/$value");
var response = await graphClient.HttpProvider.SendAsync(request);
var message = await response.Content.ReadAsStringAsync();
在不久的将来你应该可以做到:
In the near future you should be able to do:
var aStream = await graphClient.Me.Messages[messageId].Content.Request().GetAsync();