I want to get the attachments of a post that is part of a group conversation.
The application has the following permissions: Type: Application, Group.Read.All, Group.ReadWrite.All
app = ConfidentialClientApplicationBuilder.Create(config.ClientId)
.WithClientSecret(config.ClientSecret)
.WithAuthority(new Uri(config.Authority))
.Build();
string[] scopes = new string[] {$"{config.ApiUrl}/.default"};
config.ApiUrl : "https://graph.microsoft.com/"
LogHelper.Info("Conversations...");
await apiCaller.CallWebApiAndProcessResultASync($"{config.ApiUrl}v1.0/groups/{groupId}", result.AccessToken,
Display);
LogHelper.Info("Posts...");
await apiCaller.CallWebApiAndProcessResultASync($"{config.ApiUrl}v1.0/groups/{groupId}/threads/{threadId}/posts/", result.AccessToken,
Display);
LogHelper.Info("Attachments...");
await apiCaller.CallWebApiAndProcessResultASync($"{config.ApiUrl}v1.0/groups/{groupId}/threads/{threadId}/posts/{postId}/attachments", result.AccessToken,
Display);
I get the group and the posts. But it has an error for the attachments:
Failed to call the web API: Forbidden
Content: {"error":{"code":"ErrorAccessDenied","message":"Access is denied. Check credentials and try again."}}
Unable to get attachments from a group conversation
According to the documentation, if I have the rights to the posts and the group then I should have the rights to the attachments.
https://learn.microsoft.com/en-us/graph/api/post-list-attachments?view=graph-rest-1.0&tabs=http
Why don't I have the rights?