与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不起作用
答案 0 :(得分:0)
更改此行:
propertySet.RequestedBodyType <- BodyType.Text
对此(只需添加Nullable
类型):
propertySet.RequestedBodyType <- Nullable BodyType.Text