Adding an appointment to specific user's calendars using with php-ews
I am trying to add an appointment using php-ews to an Exchange 2007 us开发者_高级运维er's calendar. I have the code set up to add to the currently connected user's calendar and that works fine. This user also has permissions to write to other user's calendars. Does anyone know how I would go about directly adding calendar events to some one else's calendar? (I don't want to invite them)
After really digging into ews I finally figured this out and it's pretty easy. You just assign the user to the folder. So if you have:
$request->SavedItemFolderId->DistinguishedFolderId->Id = 'calendar';
Just add:
$request->SavedItemFolderId->DistinguishedFolderId->Mailbox->EmailAddress = 'email@domain.com'
And that's it.
For reference: above mentioned method works for all things you might want to do "on behalf" of a user, be it a task, event or a message. The idea is to have one account that has privileges to other accounts and do the required tasks "on behalf" of other users. This approach simplifies communication with EWS.
For the people who come here seeking more answers regarding communication with EWS via PHP take a look @ EWSWrapper that wraps itself around and expands php-ews to make things easier :)
精彩评论