简体   繁体   中英

How to access delegated calendars from other organization

I am developing an application targeting Office 365 which needs to access shared (delegated) calendars that are available for signed in user. I use EWS API according to documentation - explicitly specifying calendar owner's SMTP email address like this:

<m:ParentFolderIds>
    <t:DistinguishedFolderId Id="calendar">
      <t:Mailbox>
        <t:EmailAddress>primary@contoso.com</t:EmailAddress>
      </t:Mailbox>
    </t:DistinguishedFolderId>
  </m:ParentFolderIds>

This works perfectly for calendars shared by users from the same organization as signed in user, but doesn't work for calendars from other organizations . I always get the same message in response:

<m:MessageText>The SMTP address has no mailbox associated with it.</m:MessageText>
<m:ResponseCode>ErrorNonExistentMailbox</m:ResponseCode>

At the same time I can sees such calendars (and their appointments) in OWA UI - in "Other calendars" section.

Is this a limitation of EWS API/Office 365, or I am missing something?

This is a limitation of EWS. When you access a shared calendar with EWS, it actually goes to the server and opens the owner's mailbox. When the "sharer" is outside your organization, it can't do that. The error you're seeing is actually because EWS tries to resolve the owner's email address to a mailbox inside the organization and fails.

Sharing outside the organization is done via a publish method so that your Outlook or OWA client never has to access the owner's mailbox directly. EWS doesn't know how to access this information.

From the sharing message, it appears that you could access this as an ICS feed, but you'd need to somehow get the URL for that feed. It is in the initial message sent to the user when the owner shares the calendar.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM