Is there an option to show users like the SPFieldUser?

I have a custom c# webpart and want show usernames. Every username i want to link to a userprofile.

I also want the online status of a user.

  • Do you want to show their online status as in Presence? – Matthew McDermott Aug 18 '12 at 12:38

you can try to see if this works out for you?


or Get current logged user name for user "Account operates as System"

or use SharePoint Site User Directory

or you can try your own method:

create a database table and for each user that logs in then recored the ID, Username and time stamp and get the data from there using stored procedures.


Ok i get what you mean ;) , well inthat case you will need to call Active directory to get the list of users and populate a list, somthing like spGridview or a table. I would personaly recommend SPGridview. From there you can get all the users and user details. http://sharepointrookie.wordpress.com/2008/07/13/display-site-members-from-ad-groups/

For me I would create an SQL table that contains a uniqe ID, user name, email and timestamp. You can then connect the SPGridview via databinding and wrap in ajax update panel. You might need another colum in the table that has either online, offline.

So every time a user logs in it updates the table via stored procedure, find the user.... update time stamp and set status to online. When the webpart is loaded you would need to call the table and get the info from the user to display. So you can display the user name, the email, the time they logged in and weather they are online or not ;). You would also need to set the status to offline when the user leaves or is inactive. As this is all in an ajax update panel it should update without loading the whole page.

have a look at this its a waterd down version but on the right lines :) http://www.thesharepointmarket.com/2010/10/all-users-in-sharepoint-site-custom-webpart/

  • The problem is not getting the users, but the problem is how to present the users. – Active_t Aug 17 '12 at 13:24
  • Iv added some more detailed parts above in the origional post! hope it helps you solve your problem :) – Ali Jafer Aug 17 '12 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.