I’m trying to use CreateItem to create a CalendarItem for a Mailbox belonging to a user other than the one I’m connected as. The user I am connecting as does not have a Mailbox.
Below is my xml
<CreateItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
SendMeetingInvitations="SendToAllAndSaveCopy" >
<SavedItemFolderId>
<t:DistinguishedFolderId Id="calendar">
<Mailbox>
<EmailAddress>user1@testhost</EmailAddress>
</Mailbox>
</t:DistinguishedFolderId>
</SavedItemFolderId>
<Items>
<t:CalendarItem xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
<Subject>Test Calendar Entry</Subject>
<Body BodyType="Text">Test.</Body>
<ReminderIsSet>true</ReminderIsSet>
<ReminderMinutesBeforeStart>60</ReminderMinutesBeforeStart>
<Start>2012-01-20T09:00:00</Start>
<End>2012-01-20T17:00:00</End>
<IsAllDayEvent>false</IsAllDayEvent>
<Location>Test Location</Location>
</t:CalendarItem>
</Items>
</CreateItem>
After sending this to the server the reply I receive is:
[MessageText] => When making a request as an account that does not have a mailbox, you must specify the mailbox primary SMTP address for any distinguished folder Ids.
[ResponseCode] => ErrorMissingEmailAddress
Additionally, I can successfully run this xml from an account with a mailbox (omitting the mailbox element) and it does create the Calendar item.
I’ve checked the user I’m logging in as does have full access to user1’s mailbox.
I’ve tried specifying the UPN instead of the primary SMTP.
If I specify an invalid or non-primary email address, I get the expected errors, which indicates I am specifying the correct element.
Thanks in advance for any hints.
You have to impersonate as other user before do any operation on the calendar item