I am using a people picker to add users to my event list. I want to show the logged in user in people picker and also the people picker should be read only. How can I achieve this using C#.


This should work:

 private void SetOwnerUser()
     if (CurrentUser != null)
          // Clear existing users from control

          // PickerEntity object is used by People Picker Control
          PickerEntity UserEntity = new PickerEntity();

          // CurrentUser is SPUser object
          UserEntity.DisplayText = CurrentUser.Name;
          UserEntity.Key = CurrentUser.LoginName;

          // Add PickerEntity to People Picker control

          // This should make People Picker control disable|readonly
          objPeoplePicker.ShowButtons = false;
          objPeoplePicker.AllowTypeIn = false;
  • how to do the same if a user does have only right of reading and we want the code to run with elevated privilege. Please provide a solution. – Akhilesh Aug 10 '18 at 10:50
  • If you try the above code inside run with elevated privileges, does it work? – Arsalan Adam Khatri Aug 12 '18 at 5:42
  • In my case it wasn't working. – Akhilesh Aug 13 '18 at 4:06
  • @Akhilesh please post a separate question, post the code you are trying in the question and tag me in comments, will check – Arsalan Adam Khatri Aug 13 '18 at 5:34

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.