text - EWS 正文纯文本

标签 text exchange-server exchangewebservices

我使用 EWS 获取交换电子邮件,但如何从电子邮件正文中获取纯文本而不使用 html?
现在我用这个:

EmailMessage item = (EmailMessage)outbox.Items[i];
item.Load();
item.Body.Text

最佳答案

在项目的 PropertySet 中,您需要将 RequestedBodyType 设置为 BodyType.Text。这是一个例子:

PropertySet itempropertyset = new PropertySet(BasePropertySet.FirstClassProperties);
itempropertyset.RequestedBodyType = BodyType.Text;
ItemView itemview = new ItemView(1000);
itemview.PropertySet = itempropertyset;

FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, "subject:TODO", itemview);
Item item = findResults.FirstOrDefault();
item.Load(itempropertyset);
Console.WriteLine(item.Body);

关于text - EWS 正文纯文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11243911/

相关文章:

c# - EWS Service.FindItems() 在使用 SearchFilter.IsEqualTo 时引发异常

c# - EWS 托管 API 拉取通知以查看新电子邮件不起作用

带有背景图像的 CSS 插入文本阴影

c++ - 在不使用 C/C++ 使用第二个文件的情况下插入文件而不覆盖

jakarta-mail - javax.mail.MessagingException : A3 BAD User is authenticated but not connected

office365 - 使用 Office 365 API 的身份验证问题

Python 优化 : Parsing a text file to store default values and create key-pair dictionary in python

ios - 为什么我的 UITextField 委托(delegate)方法没有被调用?

android - Android 操作系统代码库中的 ActiveSync/MS 交换源在哪里

spring - 使用 Spring Integration Mail 连接到 Microsoft Exchange Server