Monday 27 February 2012

How to Identify the User in Sharepoint Through C# Code


string strUser = txtName.Text.Trim();

SPPrincipalInfo principalInfo = SPUtility.ResolveWindowsPrincipal(mySite.WebApplication, strUser, SPPrincipalType.All, false);

if (principalInfo != null)
{
    SPUser user = myWeb.EnsureUser(strUser);
    ...
    ...
    ...
}

NameSpace:
using Microsoft.SharePoint.Utilities;

No comments:

Post a Comment