From aab47aeba951d496c9ad5390c03111dd6a126cc7 Mon Sep 17 00:00:00 2001 From: Andreas Omayrat Date: Mon, 11 Oct 2021 15:19:13 +0200 Subject: [PATCH] Bugfix: Could not execute batch from Site Pages, only on Home Page --- src/services/PeopleSearchService.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/services/PeopleSearchService.ts b/src/services/PeopleSearchService.ts index 764aef3b6..9e4e250a5 100644 --- a/src/services/PeopleSearchService.ts +++ b/src/services/PeopleSearchService.ts @@ -5,8 +5,9 @@ import { MockUsers, PeoplePickerMockClient } from './PeoplePickerMockClient'; import { PrincipalType, IPeoplePickerUserItem } from "../PeoplePicker"; import { IUsers, IUserInfo } from "../controls/peoplepicker/IUsers"; import { cloneDeep, findIndex } from "@microsoft/sp-lodash-subset"; -import { sp, PrincipalSource, PrincipalType as SPPrincipalType } from '@pnp/sp'; +import { sp } from '@pnp/sp'; import "@pnp/sp/sputilities"; +import { Web } from "@pnp/sp/webs"; import "@pnp/sp/webs"; import "@pnp/sp/site-users/web"; @@ -202,7 +203,7 @@ export default class SPPeopleSearchService { // Get user loginName from user email const _users = []; - const batch = sp.web.createBatch(); + const batch = Web(this.context.pageContext.web.absoluteUrl).createBatch(); for (const value of graphUserResponse.value) { sp.web.inBatch(batch).ensureUser(value.userPrincipalName).then(u => _users.push(u.data)); }