0
votes

I have some code set up which is successfully reading calendar events from full Office 365 user accounts

When I try and use the same code to read calendar events from a shared mailbox (after authenticating with that shared mailbox's email address and password), I get the following error...

x-ms-diagnostics: 2000005;reason="The user account in the token is disabled.";error_category="invalid_user"

Is is at all possible to read the calendar events from a "shared mailbox" account using the Office 365 API? Or can I only read calendar events from full user accounts?

2
It might help to post your code. I'm currently using EWS (Microsoft.Exchange.WebServices.dll) through Powershell to access mails in a shared mailbox. I haven't tried accessing calendar items. Can you see if your code works for mail items?Nick.McDermaid

2 Answers

0
votes

Yes it is possible although not the same as managing another users account. The tutorial for managing both the Shared Inbox and the Calendar can be found below:

Open and use a shared mailbox/calendar

It includes a brief video explanation and then step by step guide.

If this is for a small business then you can follow this guide instead:

shared mailboxes in Office 365 for Small Business

0
votes

You could try to use App-Only Permissions (Client Credentials Grant Flow) ,the applications are quite powerful in terms of the data they can access within an Office 365 organization. Then you could use O365 API to access the shared mailbox resources. For example :try to use a GET https://outlook.office.com/api/{version}/me/calendars to get the actual calendar folders, then use the ID from the one you want to query to get specific calendar information.

Another choice is to use EWS Managed API to access shared mailbox information, You could specify the Mailbox you want to access. If your shared Mailbox was called [email protected] then code below is for your reference:

    FolderId SharedMailbox = new FolderId(WellKnownFolderName.Inbox,"[email protected]")
    ItemView itemView = new ItemView(1000);
    service.FindItems(SharedMailbox,itemView);