csharp-teams-sample-graph icon indicating copy to clipboard operation
csharp-teams-sample-graph copied to clipboard

Microsoft.Graph : One or more errors occurred. (Message: This request is forbidden. Inner error )

Open Rashree138 opened this issue 7 years ago • 1 comments

Hi Team,

I am getting "This request is forbidden." error when I am trying to Post/Get Graph API. Providing sample code which i am using:

var tenantId = "MY-TENANTID"; var clientId = "MY_CLIENT_ID"; var clientSecret = "MY_CLIENT_SECRET";

        //create an authProvider
        IConfidentialClientApplication confidentialClientApplication = ConfidentialClientApplicationBuilder
        .Create(clientId)
        .WithTenantId(tenantId)
        .WithClientSecret(clientSecret)
        .Build();

        ClientCredentialProvider authProvider = new ClientCredentialProvider(confidentialClientApplication);

        var graphClient = new GraphServiceClient(authProvider);

var t= graphClient.Teams["TEAM_ID"].Channels["CHANNEL_ID"] .Request() .GetAsync().Result;

Here I am pasting screen shot of : graphClient object

image

Also pasting exception detail:

image

Please let me know if Iam doing something wrong. My simple requirement is send to message to channel.

Rashree138 avatar Oct 03 '19 09:10 Rashree138

Closing this as we are closing this repository and will no longer maintain it. The Teams code snippets in this sample are replicated in the ASP.NET Core Graph Snippets sample. We apologize for any inconvenience.

jasonjoh avatar Jun 22 '20 18:06 jasonjoh