Set a user to people picker control SharePoint

 private void SetOwnerUser()
 {
     if (CurrentUser != null)
     {
          // Clear existing users from control
          objPeoplePicker.Entities.Clear();

          // 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
          objPeoplePicker.Entities.Add(objPeoplePicker.ValidateEntity(UserEntity));

          // This should make People Picker control disable|readonly
          objPeoplePicker.ShowButtons = false;
          objPeoplePicker.AllowTypeIn = false;
     }
 }
Advertisements

Author: eshan1604

Hi Guys, I'm Udara Eshan Ariyarathne from Sri Lanka. Currently i'm working as a Software Engineer (Microsoft Technologies). I'm sharing some IT related articles such as Development ,Configuration and Designing things what i have learn from day to day works. Hope it useful all of us. "Enjoying IT" Thanks & Regards, Udara Eshan Ariyarthne

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s