People Picker field on custom form..........?

how can i get the people picker field in aspx page in sharepoint??

Thanks in advance,...

August 29th, 2015 1:05am

If you are using .aspx page and want to use this page in sharepoint site then your can also use people editor control except textbox and button. (If you are fetching user from AD)

Add below line in your aspx page

<%@ Register Tagprefix="wssawc" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

Add a user to the picker (c#):

ArrayList list = new ArrayList();
list.Add(
    new PickerEntity()
    {
        Key = @"DOMAIN\User"
    }
);
userPicker.UpdateEntities(list);

Retrieve selected user(s)(c#):

PickerEntity pe = (PickerEntity)userPicker.Entities[0];
string username = pe.Key;
//or if the entities are resolved
PickerEntity pe = (PickerEntity)userPicker.ResolvedEntities[0];
string username = pe.Key;

Free Windows Admin Tool Kit Click here and download it now
August 29th, 2015 2:02am

If you are using .aspx page and want to use this page in sharepoint site then your can also use people editor control except textbox and button. (If you are fetching user from AD)

Add below line in your aspx page

<%@ Register Tagprefix="wssawc" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

Add a user to the picker (c#):

ArrayList list = new ArrayList();
list.Add(
    new PickerEntity()
    {
        Key = @"DOMAIN\User"
    }
);
userPicker.UpdateEntities(list);

Retrieve selected user(s)(c#):

PickerEntity pe = (PickerEntity)userPicker.Entities[0];
string username = pe.Key;
//or if the entities are resolved
PickerEntity pe = (PickerEntity)userPicker.ResolvedEntities[0];
string username = pe.Key;

August 29th, 2015 2:02am

this will work fine in aspx page but what if i want to use this field in sharepoint hosted app??
Free Windows Admin Tool Kit Click here and download it now
August 29th, 2015 2:08am

If you are using .aspx page and want to use this page in sharepoint site then your can also use people editor control except textbox and button. (If you are fetching user from AD)

Add below line in your aspx page

<%@ Register Tagprefix="wssawc" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

Add a user to the picker (c#):

ArrayList list = new ArrayList();
list.Add(
    new PickerEntity()
    {
        Key = @"DOMAIN\User"
    }
);
userPicker.UpdateEntities(list);

Retrieve selected user(s)(c#):

PickerEntity pe = (PickerEntity)userPicker.Entities[0];
string username = pe.Key;
//or if the entities are resolved
PickerEntity pe = (PickerEntity)userPicker.ResolvedEntities[0];
string username = pe.Key;

  • Marked as answer by Ravi_Katariya Saturday, August 29, 2015 6:05 AM
August 29th, 2015 6:01am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics