I am trying to access a shared mailbox that I have read/write permissions for through my business outlook account, using Microsoft365R's get_business_outlook
function.
library(Microsoft365R)
tenant_id <- "example_tenant_id"
email <- "example@example.co.uk"
outl <- get_business_outlook(tenant_id, shared_mbox_email = email)
The first time I try this, I get the message:
Using authorization_code flow
Creating Microsoft Graph login for tenant 'example_tenant_id'
Using authorization_code flow
Waiting for authentication in browser...
Press Esc/Ctrl + C to abort
Authentication complete.
Error in process_response(res, match.arg(http_status_handler), simplify) :
Forbidden (HTTP 403). Failed to complete operation. Message:
Insufficient privileges to complete the operation.
On subsequent runs, I get:
Error in process_response(res, match.arg(http_status_handler), simplify) :
Forbidden (HTTP 403). Failed to complete operation. Message:
Insufficient privileges to complete the operation.
I have seen this answer to a similar issue, but the use of the app
argument doesn't help:
app_id <- "example_app_id"
outl <- get_business_outlook(tenant_id, shared_mbox_email = email, app = app_id)
Loading Microsoft Graph login for tenant 'example_tenant_id'
Error in process_response(res, match.arg(http_status_handler), simplify) :
Forbidden (HTTP 403). Failed to complete operation. Message:
Insufficient privileges to complete the operation.
I have tried creating a token, with and without a resource
argument:
library(AzureAuth)
# Without resource
tok <- get_azure_token("", tenant=tenant_id, app=app_id)
Using authorization_code flow
Loading cached token
outl <- get_business_outlook(tenant_id, shared_mbox_email = email, app = app_id, token = tok)
Error: Could not find Graph host URL
# With resource
resource <- "https://graph.microsoft.com/Mail.ReadWrite.Shared"
# Get azure token for app
tok <- get_azure_token(resource, tenant=tenant_id, app=app_id)
This opens a browser window, prompts me to login using SSO and brings up the text 'Not found'.
Like the poster of the linked question, I am new to Graph API and lots of the Azure terminology used, so I may be missing something obvious. Any help is appreciated.