Currently we are adding users to requested shared mail box using PowerShell in c#. Due to basic AUTH going to disable, now we are planning implement using Graph api.
This how I thought to implement,
- Get the requested user details using Graph api
- Get the requested shared mail box details from Graph api
- Add the user to requested mail box.
Here I am able to get user and requested mail box but not sure how to add the user to shared mail box.
I am accessing all the details using service account and following App permission method.
Below are the code to get user and mail box,
var options = new TokenCredentialOptions
{
AuthorityHost = AzureAuthorityHosts.AzurePublicCloud
};
var clientSecretCredential = new ClientSecretCredential(
tenantId, clientId, clientSecret, options);
var graphClient = new GraphServiceClient(clientSecretCredential, scopes);
var requestedDetails = await graphClient.Users["emailaddress"].Request().GetAsync();
Is it possible to achieve this using Graph api? if yes then which endpoint I should call?