rileydutton / Exchange-Web-Services-for-PHP

A basic library for interacting with Exchange Web Services using PHP 5.
MIT License
91 stars 42 forks source link

How to add body to event? #32

Open igittigitt opened 5 years ago

igittigitt commented 5 years ago

I'd like to create an event containing a body information as plain text or HTML. So i tried to extend the ExchangeClient function create_event() with:

$body = 'Hello World! This is a cool event :-)';
$CreateItem->Items->CalendarItem->Body = new StdClass();
$CreateItem->Items->CalendarItem->Body = $body;
$CreateItem->Items->CalendarItem->Body->BodyType = 'Text';

Therefore the resulting XML in the SOAP-request should look like this: <t:Body BodyType="Text">Hello World! This is a cool event :-)</t:Body>

But no luck so far. I don't get what to assign to the body-object which contain the bodytext.

igittigitt commented 5 years ago

Uh, just found out by investigating the sendmessage function. I had to do it with "->" (underscore): $CreateItem->Items->CalendarItem->Body->_ = $body;

Now, it works like a charm! :-)

UserNeo commented 5 years ago

Thank you? Do you have a tip for reading the body at an existing appointment?