1

Related to this post, I am reading some messages from Exchange and I want the body in plain (non-html) text. I am doing it in F#. Here is the code:

> 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

The compiler is complaining on this line:

propertySet.RequestedBodyType <- BodyType.Text

This expression was expected to have type Nullable but here has type BodyType

How to I make the BodyType.Text Nullable? Nullable does not work

Jamie Dixon
  • 4,204
  • 4
  • 25
  • 47

1 Answers1

0

Change this line:

propertySet.RequestedBodyType <- BodyType.Text

To this (Just add Nullable type):

propertySet.RequestedBodyType <- Nullable BodyType.Text
MadDev
  • 1,130
  • 1
  • 13
  • 29