ErrorAccessDenied on https://graph.microsoft.com/v1.0/groups/{:id}/threads

Marc Hasenfratz 0 Reputation points
2023-03-26T08:30:21.81+00:00

Hey,

I receive the following error message when I try to create a conversation thread. I am using https://graph.microsoft.com/v1.0/groups/{:id}/threads

{
  "error": {
    "code": "ErrorAccessDenied",
    "message": "Access is denied. Check credentials and try again."
  }
}

While on Postman everything works fine I am just struggeling with Power Automate. I am using an HTTP request like below.


{
	"uri": "https://graph.microsoft.com/v1.0/groups/{:id}/threads",
	"method": "POST",
	"headers": {
		"Content-type": "application/json"
	},
	"authentication": {
		"authority": "https://login.microsoft.com",
		"tenant": "{:id}",
		"audience": "https://graph.microsoft.com",
		"clientId": "{:id}",
		"secret": "*sanitized*",
		"type": "ActiveDirectoryOAuth"
	},
	"body": {
		"topic": "Comments on task",
		"posts": [
			{
				"body": {
					"contentType": "html",
					"content": "Comment thread for"
				},
				"newParticipants": [
					{
						"emailAddress": {
							"name": "MyName",
							"address": "MyName@{:domain}.com"
						}
					}
				]
			}
		]
	}
}

At Postman I am using this auth urls
Auth URL: https://login.microsoftonline.com/common/oauth2/authorize?resource=https://graph.microsoft.com/
Access Token URL: https://login.microsoftonline.com/common/oauth2/token

Even with the same credentials I receive that error. I am using clientId & clientSecret, I applied the proper permission to this Appreg. Any assistance would be great.
User's image

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,591 questions
{count} votes

1 answer

Sort by: Most helpful
  1. CharanyaB-MSFT 1,421 Reputation points Microsoft Vendor
    2023-03-27T09:56:43.3866667+00:00

    Hello @Marc Hasenfratz,

    Thanks for reaching out!

    Can you please decode your access token using jwt.ms and check if it is an application or delegated access. You can validate it using the scp(delegated) or roles(application) properties in the access token. Creating conversation thread using Graph API is not supported with application permission type.

    User's image

    So, I suggest you to generate a new delegated access token in power automate and try this API. Please follow the steps in the below document to get access token: https://learn.microsoft.com/en-us/graph/auth-v2-user#authorization-request

    Hope this helps.

    If the reply is helpful, please click "Accept Answer" and kindly upvote it. If you have additional questions about this answer, please click "Comment".