Pnpjs: Function type for graph.me.getMemberGroups() does not match the actual value

Created on 12 Apr 2020  路  2Comments  路  Source: pnp/pnpjs

Category

  • [ ] Enhancement
  • [x] Bug
  • [ ] Question
  • [ ] Documentation gap/issue

Version

Please specify what version of the library you are using: [ 2.0.4 ]

Please specify what version(s) of SharePoint you are targeting: [ SPO ]

Expected / Desired Behavior / Question

I'm using the graph.me.getMemberGroups() call in my SPFx web part to get the list of groups the current user belongs to.

I expect the Promise to resolve with an object that contains the value property that is an array of group ids, i.e.:
getMemberGroups(securityEnabledOnly = false): Promise<{ value: string[] }>

Observed Behavior

The promise resolves directly with an array of strings and not an object with the value property. The type returned that I observe is Promise<string[]>

In the web dev console of my browser, I can see the post request to the Graph API https://graph.microsoft.com/v1.0/me/getMemberGroups.
The format of the response is:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(Edm.String)",
    "value": [
        "627f3c12-8d33-3333-a380-48b1e175a728",
        "121c6089-ee33-3333-afd0-4c5d09ffaa66"
    ]
}

Steps to Reproduce

  • Create a new SPFx web part project and add @pnp/graph.
  • Init with graph.setup.
  • Call the graph.me.getMemberGroups() and log results to the console.

I've created a test project that contains a single web part with this call in the render method:
https://github.com/dmitryrogozhny/test-graph-getMemberOf

code in progress bug

Most helpful comment

The fix has been merged and will be out in release 2.0.5. Thanks for your patients.

All 2 comments

Yep, looks like a bug on first glance. We'll take a look, thanks for reporting it.

@juliemturner - let's have a look at this one

The fix has been merged and will be out in release 2.0.5. Thanks for your patients.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jcosta33 picture jcosta33  路  3Comments

ITAndy23 picture ITAndy23  路  3Comments

SpliceVW picture SpliceVW  路  3Comments

simkessy picture simkessy  路  3Comments

un-dres picture un-dres  路  3Comments