Closed bhoomesh-spe closed 1 month ago
@bhoomesh-spe - Because users are not added to the hidden siteUserInfoList until either a) they access the site or b) you call ensureUser for their user id. If you want to just "search" for a user, you should use the search endpoint instead which at this point is most easily done with SharePoint Search -- you'll want to make sure your search includes the sourceId for People which is the same for every tenant -- but also can be done with Microsoft Graph Search
const q: SearchQueryInit = SearchQueryBuilder(`${searchString}`)
.sourceId("B09A7990-05EA-4AF9-81EF-EDFAB16C4E31")
.rowLimit(500)
.rowsPerPage(500)
.selectProperties("SipAddress", "PreferredName", "AccountName", "Department", "JobTitle")
.trimDuplicates;
const people: SearchResults = await this._sp.search(q);
@juliemturner - Thanks for the quick response. Can we load all users for the site using the PowerShell script? i.e. The admin can run the script from SharePoint Online Management Shell and all users appear in the search.
@bhoomesh-spe - while we try and be helpful, this is not a general support forum. Yes, you can load all the users from a PowerShell script, but that has nothing to do with PnPjs so we're not able to provide that guidance. Will close this issue as answered. Thanks!
I'm just going to add, all the users already show in search just not in the site's hidden user list. Search is not the intent of the hidden user list it's a lookup list for any User based list/site columns.
This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked.
What version of PnPjs library you are using
3.x
Minor Version Number
3.15.0
Target environment
SharePoint Framework
Additional environment details
SharePoint Online, SPFx React
Question/Request
Hello Everyone,
I have added Everyone except external users to the Team Site Visitors group. Below is the screenshot for the same.![Screenshot 2024-05-30 001747](https://github.com/pnp/pnpjs/assets/99523338/b601f19a-0347-4c22-94ed-f69a41e3d62e)
Now I have tried to search for one user in the People Picker but the user does not appear in the search results. Below is the screenshot for the same.![Screenshot 2024-05-30 002025](https://github.com/pnp/pnpjs/assets/99523338/6a938591-a8b3-4c5d-8536-918c87868721)
The user I have searched in the auto-complete is the user of our organization. Below is the screenshot for the same.![Screenshot 2024-05-30 002147](https://github.com/pnp/pnpjs/assets/99523338/9c7cbafd-69fd-491c-b542-b581f9f481cd)
I have used the below code for getting site users from the SharePoint User Information list.
Why did the user not appear in the search? Does anyone have an idea?
Thanks