【问题标题】:EWS body plain text Using F#EWS 正文纯文本使用 F#
【发布时间】:2017-12-20 04:30:57
【问题描述】:

this 帖子相关,我正在阅读来自 Exchange 的一些消息,我希望正文为纯(非 html)文本。我在 F# 中这样做。代码如下:

> let exchangeService = new
> ExchangeService(ExchangeVersion.Exchange2007_SP1)
> exchangeService.Credentials <- new
> WebCredentials(userName,password,domain)
> exchangeService.AutodiscoverUrl(email)
> 
> let getEmailText exchangeService itemId =
>     let propertySet = new PropertySet()
>     propertySet.RequestedBodyType <- BodyType.Text
>     propertySet.BasePropertySet <- BasePropertySet.FirstClassProperties
>     let message = EmailMessage.Bind(exchangeService, itemId, propertySet)
>     message.TextBody

编译器在这行抱怨:

propertySet.RequestedBodyType <- BodyType.Text

这个表达式应该是 Nullable 类型,但这里是 BodyType 类型

如何使 BodyType.Text 可以为空? Nullable 不起作用

【问题讨论】:

  • 试试propertySet.RequestedBodyType &lt;- Nullable BodyType.Text
  • 就是这样 - 谢谢!

标签: f# exchangewebservices


【解决方案1】:

改变这一行:

propertySet.RequestedBodyType <- BodyType.Text

为此(只需添加Nullable 类型):

propertySet.RequestedBodyType <- Nullable BodyType.Text

【讨论】:

    猜你喜欢
    • 2012-06-29
    • 2018-01-04
    • 2016-07-04
    • 2012-07-19
    • 2015-05-16
    • 2019-01-22
    • 1970-01-01
    • 1970-01-01
    • 2015-09-28
    相关资源
    最近更新 更多