prithavi raj  nagar
prithavi raj nagar

Reputation: 41

You must load or assign this property before you can read its value in case of getMimeContent() method

I tried below case but getting same error. microsoft.exchange.webservices.data.core.exception.service.local.ServiceObjectPropertyException: You must load or assign this property before you can read its value.

ExchangeService service = new ExchangeService();

case 1 :
Item itm2 = Item.bind(service, new ItemId(itemId), PropertySet.FirstClassProperties); EmailMessage emailMessage2 = EmailMessage.bind(service, itm1.getId()); itm2.getMimeContent();

case 2 :

Item itm2 = Item.bind(service, new ItemId(itemId), PropertySet.getFirstClassProperties());
EmailMessage emailMessage2 = EmailMessage.bind(service, itm1.getId()); itm2.getMimeContent();

But getting the same error again and again. I want Mine content so , can change in.eml format .

Upvotes: 1

Views: 2817

Answers (1)

MadDev
MadDev

Reputation: 1150

You need to load the property before you can access it.

Create a PropertySet and add MIMEContent as a property:

PropertySet propSet = new PropertySet(BasePropertySet.FirstClassProperties);
propSet.Add(ItemSchema.MimeContent);

Then add the PropertySet as an overload property for your Bind code:

EmailMessage emailMessage = EmailMessage.bind(service, itemId, propSet);
String content = emailMessage.getMimeContent().toString();

Upvotes: 3

Related Questions