The following code sample will set the currently logged on user to a PeopleEditor:
using (SPWeb web = SPContext.Current.Web)
{
SPUser user = web.CurrentUser;
PickerEntity entity = new PickerEntity();
entity.Key = user.LoginName.ToString();
System.Collections.ArrayList entityArrayList = new System.Collections.ArrayList();
entityArrayList.Add(entity);
PeopleEditorControl.UpdateEntities(entityArrayList);
}
2 comments:
thank you very much. it was very useful!
You make a sever error in your code my friend.The using statement should not be there
this will dispose the current SharePoint context
just remove the using statments
Post a Comment