Home

Microsoft graph add member

%3CLINGO-SUB%20id%3D%22lingo-sub-788636%22%20slang%3D%22en-US%22%3EMicrosoft%20graph%20add%20member%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-788636%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20trying%20to%20add%20a%20member%20to%20an%20existing%20team%20through%20graph%20API.%20I'm%20doing%20the%20following%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1.%20Obtained%20the%20bearer%20access%20token%20by%20using%20client_credentials%20flow%3C%2FP%3E%3CP%3E2.%20Obtained%20the%20id%20of%20the%20user%20and%20group%20object%3C%2FP%3E%3CP%3E3.%20Invoked%20the%20graph%20api%20(%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fgroups%2F%257bgroupd_id%257d%2Fmembers%2F%24ref%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fgroups%2F%7Bgroupd_id%7D%2Fmembers%2F%24ref%3C%2FA%3E)%20using%20the%20bearer%20token%20and%20the%20following%20odata%20object%20in%20the%20body%3C%2FP%3E%3CP%3E%7B%3C%2FP%3E%3CP%3E%22%40odata.id%22%3A%20%22%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2FdirectoryObjects%2F%257buser_id%257d%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2FdirectoryObjects%2F%7Buser_id%7D%3C%2FA%3E%22%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3CP%3EI%20get%20the%20following%20error%20when%20doing%20so.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F125640iC6584FDDA48694FC%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_0.png%22%20title%3D%22clipboard_image_0.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20checked%20the%20permission%20for%20the%20applications%20and%20everything%20seems%20to%20be%20right%20(see%20below).%20What%20could%20be%20the%20problem%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F125642i479F2EAF544C1904%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_2.png%22%20title%3D%22clipboard_image_2.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-788636%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ETeams%20graph%20api%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-789549%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20graph%20add%20member%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-789549%22%20slang%3D%22en-US%22%3EIn%20the%20body%2C%20try%20this%20instead%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%22%40odata.id%22%3A%20%22%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fusers%2F%7Buser_id%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fusers%2F%7Buser_id%3C%2FA%3E%7D%22%3C%2FLINGO-BODY%3E
Highlighted
Contributor

I'm trying to add a member to an existing team through graph API. I'm doing the following:

 

1. Obtained the bearer access token by using client_credentials flow

2. Obtained the id of the user and group object

3. Invoked the graph api (https://graph.microsoft.com/v1.0/groups/{groupd_id}/members/$ref) using the bearer token and the following odata object in the body

{

"@odata.id": "https://graph.microsoft.com/v1.0/directoryObjects/{user_id}"

}

I get the following error when doing so.

 

clipboard_image_0.png

 

I checked the permission for the applications and everything seems to be right (see below). What could be the problem?

 

clipboard_image_2.png

1 Reply
Highlighted
In the body, try this instead:

"@odata.id": "https://graph.microsoft.com/v1.0/users/{user_id}"
Related Conversations