question

MichaelWilliams-3261 avatar image
0 Votes"
MichaelWilliams-3261 asked RaytheonXie-MSFT answered

Uncaught ReferenceError: EnsureScript is not defined for PeoplePicker in SharePoint Custom Form

When I implement the People Picker control on a custom page, I get the "Uncaught ReferenceError: EnsureScript is not defined" Can someone help?


// Render and initialize the client-side People Picker.
function initializePeoplePicker(peoplePickerElementId) {

 // Create a schema to store picker properties, and set the properties.
 var schema = {};
 schema['PrincipalAccountType'] = 'User,DL,SecGroup,SPGroup';
 schema['SearchPrincipalSource'] = 15;
 schema['ResolvePrincipalSource'] = 15;
 schema['AllowMultipleValues'] = true;
 schema['MaximumEntitySuggestions'] = 50;
 schema['Width'] = '280px';

 // Render and initialize the picker. 
 // Pass the ID of the DOM element that contains the picker, an array of initial
 // PickerEntity objects to set the picker value, and a schema that defines
 // picker properties.
 this.SPClientPeoplePicker_InitStandaloneControlWrapper(peoplePickerElementId, null, schema);

}

sharepoint-dev
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @MichaelWilliams-3261 ,
I am currently doing some research on this issue, will let you know as soon as possible

0 Votes 0 ·

1 Answer

RaytheonXie-MSFT avatar image
0 Votes"
RaytheonXie-MSFT answered

Hi @MichaelWilliams-3261 ,
Here is the code snippet about adding Client People Picker in SharePoint Hosted app for your reference, I would suggest you to check:

In Default.aspx, Reference file under PlaceHolderMain:
145654-default.txt

In App.js, write Script below, not use this, it might cause xxx object is not defined:
145678-app.txt

Here is the document for reference
https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/use-the-client-side-people-picker-control-in-sharepoint-hosted-sharepoint-add-in


If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.





default.txt (1.2 KiB)
app.txt (2.5 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.