-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
ToTriagestatus:waiting-for-triageAn issue that is yet to be reviewed or assignedAn issue that is yet to be reviewed or assignedtype:bugA broken experienceA broken experience
Description
Describe the bug
I'm trying to add a user to a group as follows
export const addUserToGroup = async (userId: string, groupId: string) => {
try {
await client()
.groups.byGroupId(groupId)
.members.ref.post({
odataId: `https://graph.microsoft.com/v1.0/directoryObjects/${userId}`,
});
return true;
} catch (error) {
console.error('Error adding user to group:', error);
return false;
}I get the following error
Error adding user to group: {
errorEscaped: {
code: 'Request_BadRequest',
message: "Unrecognized query argument specified: '@id'.",
innerError: {
date: 2025-11-09T12:25:07.000Z,
requestId: 'xxx',
clientRequestId: 'xxx'
}
},
message: "Unrecognized query argument specified: '@id'.",
responseStatusCode: 400,
responseHeaders: {
'client-request-id': [ 'xxx' ],
'content-encoding': [ 'gzip' ],
'content-type': [ 'application/json' ],
date: [ 'Sun', ' 09 Nov 2025 23:25:07 GMT' ],
'request-id': [ 'xxx' ],
'strict-transport-security': [ 'max-age=31536000' ],
'transfer-encoding': [ 'chunked' ],
vary: [ 'Accept-Encoding' ],
'x-ms-ags-diagnostic': [
'{"ServerInfo":{"DataCenter":"Australia East"',
'"Slice":"E"',
'"Ring":"5"',
'"ScaleUnit":"000"',
'"RoleInstance":"xxx"}}'
]
}
}
Expected behavior
The user is added to the group
How to reproduce
Use the code above.
NOTE: This for Azure AD B2C in case it matters
SDK Version
1.0.0-preview.74
Latest version known to work for scenario above?
Has never worked
Known Workarounds
This patch works around it
diff --git a/groups/item/members/ref/index.js b/groups/item/members/ref/index.js
index 9e8a14654fab3754b01311e07c9bd79d2569d5ca..0d396bdf8da2bf273686abbcb08fae6d581682dd 100644
--- a/groups/item/members/ref/index.js
+++ b/groups/item/members/ref/index.js
@@ -8,7 +8,7 @@ import { createODataErrorFromDiscriminatorValue } from '@microsoft/msgraph-sdk/m
/**
* Uri template for the request builder.
*/
-export const RefRequestBuilderUriTemplate = "{+baseurl}/groups/{group%2Did}/members/$ref?@id={%40id}{&%24count,%24filter,%24orderby,%24search,%24skip,%24top}";
+export const RefRequestBuilderUriTemplate = "{+baseurl}/groups/{group%2Did}/members/$ref?{&%24count,%24filter,%24orderby,%24search,%24skip,%24top}";
/**
* Mapper for query parameters from symbol name to serialization name represented as a constant.
*/Other information
I'm happy to generate a PR with the above if the fix is sensible.
I'm also new to the API so it's possible my code is not taking the right approach
Metadata
Metadata
Assignees
Labels
ToTriagestatus:waiting-for-triageAn issue that is yet to be reviewed or assignedAn issue that is yet to be reviewed or assignedtype:bugA broken experienceA broken experience