Having installed the AzureGraph package in R, I am trying to use it to run a query that will return Microsoft Teams usage data for my organisation. By investigating the Microsoft Graph documentation, I can see that a query exists that should allow me to obtain the data. IT within my organisation have also given me permission for Reports.Read.All to allow me to run the example query that is specified in the documentation.
Within R, having specified my tenant, my username and my password, I created a login by using the the following code:
gr <- create_graph_login(tenant = my_tenant, username = my_username, password = my_password)
I know the login works, as the following code returns my user details:
call_graph_endpoint(gr$token, operation = "me", api_version="v1.0")
I then tried the following (example query from documentation), however this time I was given an error.
call_graph_endpoint(gr$token,
operation = "reports/getTeamsUserActivityUserDetail(period='D7')",
api_version="v1.0")
The error was as follows:
Error in process_response(res, match.arg(http_status_handler), simplify) : Forbidden (HTTP 403). Failed to complete operation. Message: {"error":{"code":"S2SUnauthorized","message":"Invalid permission."}}.
From another post regarding the AzureGraph package, I have deduced that the error is being generated as I don't have the required Microsoft Graph API permissions, but if I log onto the Microsoft Graph Explorer, I can see that an admin account has consented for me to have permission to Reports.Read.All.
Does anyone know where I'm going wrong? I am very new to using the Microsoft Graph API and the AzureGraph package so any help at all would be greatly appreciated!