Skip to content

Commit 15df10b

Browse files
authored
Search query must query also the upn as mail could be null
When checking for transitive membership, search query must also check the upn as user could have an empty or different email.
1 parent 3dc0928 commit 15df10b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/services/PeopleSearchService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export default class SPPeopleSearchService {
135135

136136
// Check if users need to be searched in a specific Microsoft 365 Group, Security Group (incl. nested groups) or Distribution List
137137
else if (groupId && typeof (groupId) === 'string') {
138-
const graphUserRequestUrl = `/groups/${groupId}/transitiveMembers?$count=true&$search="displayName:${query}" OR "mail:${query}"`;
138+
const graphUserRequestUrl = `/groups/${groupId}/transitiveMembers?$count=true&$search="userPrincipalName:${query}" OR "displayName:${query}" OR "mail:${query}" `;
139139
const graphClient = await this.context.msGraphClientFactory.getClient("3");
140140
const graphUserResponse = await graphClient.api(graphUserRequestUrl).header('ConsistencyLevel', 'eventual').get();
141141

0 commit comments

Comments
 (0)