Skip to content

Commit aa01155

Browse files
committed
Update Entra ID function
1 parent f8b8078 commit aa01155

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/api/functions/entraId.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -755,8 +755,8 @@ export async function createM365Group(
755755
const groupName = `${displayName} ${groupSuffix}`;
756756

757757
try {
758-
// First, check if a group with this mail nickname already exists
759-
const checkUrl = `https://graph.microsoft.com/v1.0/groups?$filter=displayName eq '${encodeURIComponent(groupName)}'`;
758+
// Check if a group with this mail nickname already exists
759+
const checkUrl = `https://graph.microsoft.com/v1.0/groups?$filter=mailNickname eq '${encodeURIComponent(safeMailNickname)}'`;
760760
const checkResponse = await fetch(checkUrl, {
761761
method: "GET",
762762
headers: {
@@ -787,7 +787,7 @@ export async function createM365Group(
787787
return existingGroup.id;
788788
}
789789
throw new EntraGroupError({
790-
message: `A group with name '${groupName}' already exists but is not a Microsoft 365 group.`,
790+
message: `A group with mailNickname '${safeMailNickname}' already exists but is not a Microsoft 365 group.`,
791791
group: groupName,
792792
});
793793
}

0 commit comments

Comments
 (0)