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.
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.Sign up to join this community
you can try to see if this works out for you?
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/