add

Wednesday, May 20, 2009

Various properties of PeopleEditor:

Various properties of PeopleEditor:

The PeopleEditor control has a number of properties that allow you to configure it. In the next section, we will discuss the properties that we think are most important.

The PlaceButtonsUnderEntityEditor property decides the location of the Names and Browse buttons of the people picker. If you set it to true, the buttons are placed at the bottom right corner of the account name text box, otherwise to the right of it.

The AllowEmpty property lets you define if the user is required to fill in a value in the people picker.

The SelectionSet property allows you to define the set of users and groups the people picker can choose from. This set can consist of users, Active Directory distribution lists, Active Directory security groups, and SharePoint groups.
The MultiSelect property lets you define if a user is allowed to specify multiple user accounts. The next code fragment shows how to add a people picker to a web part and how to configure it:

objEditor = new PeopleEditor();
objEditor.AutoPostBack = true;
objEditor.PlaceButtonsUnderEntityEditor = true;
objEditor.ID = "pplEditor";
objEditor.AllowEmpty = false;
objEditor.SelectionSet = "User,SecGroup,SPGroup";
objEditor.MultiSelect = false;
Controls.Add(objEditor);

You can retrieve the values selected in the people picker by looping through the ResolvedEntities collection of the PeopleEditor object.

1 comment:

Shakti Srivastava said...

Hi,

I am facing one problem...

I want to add the columns that are shown in the dialog of the People Picker. How can i control that. When i do PeoplePicker.ResolvedEntities[0].EntityData...where is this data coming from...?

Is it coming from Active Directory...?

If Yes, then how can i make sure that "Email" will always be the part of the EntityData collection...

thanks,