Sunday, April 19, 2015

How to get current user login name

 public string GetCurrentUserLoginName()
 {
            ClientContext ctx= new ClientContext ("SiteUrl");
            Web currentWeb = ctx.Web;
            User currentuser = currentWeb.CurrentUser;

            currentContext.Load(currentWeb);
            currentContext.Load(currentuser);

            currentContext.ExecuteQuery();

            return currentuser.LoginName;
}

No comments:

Post a Comment

Server Error in '/' Application when activating "Nintex Forms" web app feature.

Apparently "INSTALL-NFService" need to be run in SharePoint PowerShell to fix this problem.   When I installed Nintex Forms agai...