Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

Assign current logged in USER name to the people picker

  Asked By: Darius Parks         Date: Apr 27, 2009      Category: Sharepoint      Views: 717
 

I need to assign the current user to the people picker control in my ASPX page
which I am planing to host in sharepoint (WSS) .

I was trying on these lines but without success.


System.Collections.ArrayList entityArrayList =
new System.Collections.ArrayList();
PickerEntity entity = new PickerEntity();
userPicker = new PeopleEditor();
userPicker.MultiSelect = false;
entity.Key =
SPContext.Current.Web.CurrentUser.LoginName;

entity= userPicker.ValidateEntity(entity);


entityArrayList.Add(entity.Key);
userPicker.UpdateEntities(entityArrayList);

It is throwing type casting exception.did tried with all the rules of the book
but nothing worked!

Tagged:                    

 

1 Answer Found

 
Answer #1       Answered By: Janell Camacho          Answered On: Apr 27, 2009       

If you can use Javascript you could go with javascript, I found this nifty blog
when i was up against the wall trying to do the same thing:
blogs.vbcity.com/.../9024.aspx

 
Didn't find what you were looking for? Find more on Assign current logged in USER name to the people picker Or get search suggestion and latest updates.


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].