c# - Extracting attached email from a journal item with EWS API - embedded Item Id is null -
i have been experimenting day no avail.
i can retrieve journal item exchange mailbox, , access attachment itemattachment
:
emailmessage mailitem_journal = emailmessage.bind(_service, item.id, _propsjournalitem); itemattachment itemattachment = mailitem_journal.attachments[0] itemattachment; itemattachment.load(); item attacheditem = itemattachment.item;
the item
contained inside of type ipm.note i.e. email. need bind emailmessage
object can access email specific properties, e.g. torecipients
not available otherwise. id
of attacheditem
null, causes following fail
emailmessage mailitem = emailmessage.bind(_service, attacheditem.id, _propsemaildetail);
value cannot null
i tried binding itemattachment
expected did not work, throwing error
invalid id
i guessed maybe id null because email embedded within email , isn't "in" folder "have" id, tried using item.save
store in mailbox, in hope retrieve normal:
attacheditem.save(_folderitemprocessing.id);
however gives me error
this operation can't performed because service object has id. update service object, use update() method instead.
which makes no sense me since problem id null!
i don't understand how update method of use in scenario, instead tried moving item
attacheditem.move(_folderitemprocessing.id);
and gives me
this operation isn't supported on attachments.
how can access email properties of attached email? need read them, have no need manipulate of objects besides moving parent mail folder afterwards, doing successfully.
side note: code implemented using outlook redemption library , mail accessed mailitem_journal.attachments[1].embeddedmsg
, must possible somehow!?
when call itemattachment.load
, loads of properties item, there no need call bind
. should have of properties, need cast emailmessage
. like:
itemattachment.load(); emailmessage attachedmsg = itemattachment.item emailmessage;
Comments
Post a Comment