getTeamsUserActivityUserDetail Graph API call in SPFx

%3CLINGO-SUB%20id%3D%22lingo-sub-1375956%22%20slang%3D%22en-US%22%3EgetTeamsUserActivityUserDetail%20Graph%20API%20call%20in%20SPFx%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1375956%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20SharePoint%20Users%2C%3C%2FP%3E%3CP%3EI'm%20developing%20an%20SPFx%20webpart%20to%20pull%20the%20MS%20Teams%20user%20activity%20details.%3C%2FP%3E%3CP%3EI%20have%20given%20the%20solution%20the%20Reports.Read.All%20permission%20in%20the%20package%20and%20in%20the%20Azure%20portal%20(API%20permissions)%2C%20granted%20the%20API%20access%20in%20the%20SharePoint%20admin%20portal%20as%20well.%3C%2FP%3E%3CP%3EBut%20i%20still%20get%20the%20403%20forbidden%20error-%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23FF0000%22%3EGET%20%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fbeta%2Freports%2FgetTeamsUserActivityUserDetail(period%3D'D7')%3F%24format%3Dapplication%2Fjson%26amp%3B%24select%3DuserPrincipalName%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fbeta%2Freports%2FgetTeamsUserActivityUserDetail(period%3D'D7')%3F%24format%3Dapplication%2Fjson%26amp%3B%24select%3DuserPrincipalName%3C%2FA%3E%20403%20(Forbidden)%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23000000%22%3EHere%20is%20the%20code%20segment%20that%20i%20use%20(pasting%20only%20the%20relevant%20part).%20I'm%20using%20same%20approach%20for%20getting%20the%20current%20users%20Team%20names%20and%20members%20displayed.%20Those%20methods%20work%20fine.%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23000000%22%3EAny%20help%20appreciated.%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23000000%22%3EThanks.%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23000000%22%3EKevin%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Ethis%3C%2FSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3Eprops%3C%2FSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3Econtext%3C%2FSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3EmsGraphClientFactory%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FDIV%3E%3CDIV%3E%3CFONT%20color%3D%22%230000FF%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3EgetClient%3C%2FSPAN%3E%3CSPAN%3E()%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FDIV%3E%3CDIV%3E%3CFONT%20color%3D%22%230000FF%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3Ethen%3C%2FSPAN%3E%3CSPAN%3E((%3C%2FSPAN%3E%3CSPAN%3Eclient%3C%2FSPAN%3E%3CSPAN%3E%3A%3C%2FSPAN%3E%3CSPAN%3EMSGraphClient%3C%2FSPAN%3E%3CSPAN%3E%3A(%3C%2Fimg%3E%3C%2FSPAN%3E%3CSPAN%3Evoid%3C%2FSPAN%3E%3CSPAN%3E%3D%26gt%3B%3C%2FSPAN%3E%3CSPAN%3E%7B%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FDIV%3E%3CDIV%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Eclient%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FDIV%3E%3CDIV%3E%3CFONT%20color%3D%22%230000FF%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3Eapi%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3E%60%2Freports%2FgetTeamsUserActivityUserDetail(period%3D'D7')%3F%24format%3Dapplication%2Fjson%60%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FDIV%3E%3CDIV%3E%3CFONT%20color%3D%22%230000FF%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3Eversion%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3E'beta'%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FDIV%3E%3CDIV%3E%3CFONT%20color%3D%22%230000FF%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3Eselect%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3E%22userPrincipalName%22%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FDIV%3E%3CDIV%3E%3CFONT%20color%3D%22%230000FF%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3CSPAN%3E.%3C%2FSPAN%3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p%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3Ereturn%3CSPAN%3E%3CSPAN%3E%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FDIV%3E%3CDIV%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1375956%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAPIs%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Contributor

Hello SharePoint Users,

I'm developing an SPFx webpart to pull the MS Teams user activity details.

I have given the solution the Reports.Read.All permission in the package and in the Azure portal (API permissions), granted the API access in the SharePoint admin portal as well.

But i still get the 403 forbidden error-

GET https://graph.microsoft.com/beta/reports/getTeamsUserActivityUserDetail(period='D7')?$format=applica... 403 (Forbidden)

 

Here is the code segment that i use (pasting only the relevant part). I'm using same approach for getting the current users Team names and members displayed. Those methods work fine.

Any help appreciated.

Thanks.

Kevin

 

    this.props.context.msGraphClientFactory
    .getClient()
    .then((client:MSGraphClient:(void=>{
      client
      .api(`/reports/getTeamsUserActivityUserDetail(period='D7')?$format=application/json`)
      .version('beta')
      .select("userPrincipalName")
      .get((err,res)=>{
         if(err){
           console.log("Error logs "err);
           return;
         }

 

0 Replies