Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function type for graph.me.getMemberGroups() does not match the actual value #1155

Closed
1 of 4 tasks
dmitryrogozhny opened this issue Apr 12, 2020 · 3 comments · Fixed by #1192
Closed
1 of 4 tasks

Function type for graph.me.getMemberGroups() does not match the actual value #1155

dmitryrogozhny opened this issue Apr 12, 2020 · 3 comments · Fixed by #1192

Comments

@dmitryrogozhny
Copy link

Category

  • Enhancement
  • 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

@patrick-rodgers
Copy link
Member

patrick-rodgers commented Apr 13, 2020

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

@juliemturner
Copy link
Collaborator

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

@github-actions
Copy link

This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked.

@github-actions github-actions bot locked and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants