如何使用C#获取SharePoint 2010中当前用户的GUID?以下是我的代码:
public string readAndEncodeGUID()
{
Guid userGuid = Guid.Empty;
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPWeb readWeb = SPContext.Current.Web;
SPUser currUser = SPContext.Current.Web.CurrentUser;
userGuid = new Guid(currUser.RawSid);
});
//Variable = encode USER-GUID
return userGuid.ToString();
}
RawSid得不到正确的“数字”。
感谢