3

How can we check the user entered key in Client people editor is user or group? I have created a people editor in CSOM. I can save the value to the list successfully. But before saving i need to check whether the entered key is User or Group? Please help me to resolve this issue. Thanks in advance

1

There should be an object on the page named SPClientPeoplePicker.SPClientPeoplePickerDict. It holds information about all your people pickers on page. The ID of your pickers is the property name in the object. So to check type, you could use the following:

SPClientPeoplePicker.SPClientPeoplePickerDict["IDofYourPicker"].GetAllUserInfo()[0].EntityType

That will give you blank for SharePoint Group, User for Users and SecGroup for AD-sec group. And you could check the EntityData for information about the groups/ppl

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.