none
Problem creating a message item. RRS feed

  • Question

  • I am trying to create a message item with PHP using EWS.  Below is just the part responsible for doing so.


     $CreateItem->MessageDisposition = "SendAndSaveCopy";
     $CreateItem->SavedItemFolderId->DistinguishedFolderId->Id = "sentitems";
     $CreateItem->Items->Message->Subject="hello san";
     $CreateItem->Items->Message->Body->BodyType="Text";
     $CreateItem->Items->Message->Body="Tadsad asdext";
     
     $CreateItem->Items->Message->Sender->Mailbox->EmailAddress="xyz@hotmail.com";
     $CreateItem->Items->Message->ToRecipients->Mailbox->EmailAddress="abc@gmail.com";
     
     
     $result = $client->CreateItem($CreateItem);
     

    The error i am getting is as follows that says it couldnt find BodyType attribute. But, as you see above, i have mentioned that property. Does anyone know what is wrong in the above code?

    Fatal error: Uncaught SoapFault exception: [a:ErrorSchemaValidation] The request failed schema validation: The required attribute 'BodyType' is missing. in C:\wamp\www\index.php:136 Stack trace: #0 [internal function]: SoapClient->__call('CreateItem', Array) #1 C:\wamp\www\index.php(136): ExchangeNTLMSoapClient->CreateItem(Object(stdClass)) #2 {main} thrown in C:\wamp\www\index.php on line 136

     

     

    Monday, April 25, 2011 10:01 PM