I'm struggling to figure how to get the username of a SharePoint 2010 user using the Client Object Model and VB.Net.
Any ideas? Thanks.
Microsoft.sharepoint.dll firstly with reference to your project, you must add the. After adding you to reference the user who is logged using the following code information is available at that moment.
string loginUserName = SPContext.Current.Web.CurrentUser.LoginName
If you have a user name, and from there, if you only want to access user data, use the following code
SPUser anyUser = SPContext.Current.Web.EnsureUser("DOMAIN\\UserName");
Note: Microsoft.sharepoint.dll what Sharepoint installed on the server dll C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI can be found at.