Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP-EWS 2010, how to set the IsRead flag
    text
    copied!<p>I have been able to successfully retrieve the unread emails from an Exchange 2010 inbox using php-ews API. However after I have fetched the emails, I want to set the IsRead property of the email to true, so that these messages do not appear the next time I fetch emails.</p> <p>Anyone done this before ?</p> <p>EDIT :</p> <p>This is how I am trying to set the IsRead flag :</p> <pre><code>$message_id = ''; //id of message $change_key = ''; //change key $response = $ews-&gt;GetItem($request); //print_r($response);exit; if( $response-&gt;ResponseMessages-&gt;GetItemResponseMessage-&gt;ResponseCode == 'NoError' &amp;&amp; $response-&gt;ResponseMessages-&gt;GetItemResponseMessage-&gt;ResponseClass == 'Success' ) { $a = array(); $message = $response-&gt;ResponseMessages-&gt;GetItemResponseMessage-&gt;Items-&gt;Message; $a['message_body'] = $message-&gt;Body-&gt;_; $a['sender'] = $message-&gt;From-&gt;Mailbox-&gt;EmailAddress; $a['subject'] = $message-&gt;ConversationTopic; $data[] = $a; //process the message data. $messageType = new EWSType_MessageType(); $messageType-&gt;IsRead = true; $path = new EWSType_PathToUnindexedFieldType(); $path-&gt;FieldURI = 'message:IsRead'; $setField = new EWSType_SetItemFieldType(); $setField-&gt;Message = $messageType; $setField-&gt;FieldURI = $path; $u = new EWSType_ItemChangeType(); $u-&gt;Updates = new EWSType_NonEmptyArrayOfItemChangeDescriptionsType(); $u-&gt;Updates-&gt;SetItemField = $setField; $u-&gt;ItemId = new EWSType_ItemIdType(); $u-&gt;ItemId-&gt;Id = $message_id; $u-&gt;ItemId-&gt;ChangeKey = $change_key; $updatedItems = new EWSType_NonEmptyArrayOfItemChangesType(); $updatedItems-&gt;ItemChange = $u; $updateMessenger = new EWSType_UpdateItemType(); $updateMessenger-&gt;ItemChanges = $updatedItems; $updateMessenger-&gt;MessageDisposition = 'SaveOnly'; $updateMessenger-&gt;ConflictResolution = 'AutoResolve'; try { $update_response = $ews-&gt;UpdateItem($updateMessenger); }catch (Exception $e){ echo $e-&gt;getMessage(); } } </code></pre> <p>When I run the file I get the following error :</p> <pre><code>An internal server error occurred. The operation failed. </code></pre> <p>After debugging for some time, I have concluded that the error happens at the curl_exec function in NTLMSoapClient.php file. </p> <p>I dont know where to go on from here. Please help.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload