Skip to content

Commit

Permalink
Bugfix: Could not execute batch from Site Pages, only on Home Page
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Omayrat committed Oct 11, 2021
1 parent e8cca66 commit aab47ae
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/services/PeopleSearchService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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));
}
Expand Down

0 comments on commit aab47ae

Please sign in to comment.