Create Mailbox items using Graph and limit access to specific mailboxes

shockoQA-1 61 Reputation points
2022-07-21T11:48:39.113+00:00

I'm building an app that I would like to leverage to create mails in a mailbox in Exchange Online using this Graph API. How do I create an access token for it so that it can only action against specific mailbox? Would I create an app registration and grant certain API access then use an Exchange application restriction policy?

Exchange Online
Exchange Online
A cloud-based service included in Microsoft 365, delivering scalable messaging and collaboration features with simplified management and automatic updates.
{count} votes

Answer accepted by question author
  1. Andy David - MVP 159.7K Reputation points MVP Volunteer Moderator
    2022-07-21T12:34:31.773+00:00

    Yes, use an Exchange Application access policy and scope to the mailboxes you want to have access to
    https://learn.microsoft.com/en-us/graph/auth-limit-mailbox-access

    However:
    This only works for specific scopes, so in your case, you prob cant use this if you want to create mail
    223059-image.png

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. shockoQA-1 61 Reputation points
    2022-07-23T10:04:16.207+00:00

    So if I grant the application Mail.ReadWrite then as per here it should fall within that scope. Without the access restriction policy would the app have full access to all mailboxes as indicated by https://learn.microsoft.com/en-us/graph/auth-limit-mailbox-access which I find concerning! Security should be opt out not in!

    That said, thank you for taking he time to reply. Very much appreciated.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.