【发布时间】: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 <- Nullable BodyType.Text -
就是这样 - 谢谢!