Sharepoint 2013应用程序用户Guid



我在SP App 2013中获取Sharepoint Userid(GUID)时没有什么问题。到目前为止,我正在使用Sharepoint的userProfile类(SP.userProfile.js)获取Sharepoint用户的电子邮件地址和全名。

我需要获得用户的唯一id,我们称之为GUID。。我使用了下面的代码,但每次我得到随机所谓的Guid相同的用户。(ehich绝对不是用户的唯一id)。如何获取每次登录时唯一的sharepoint用户id。

请帮忙!

感谢

这是我的代码片段

    var targetUser;
    var userProps;
    var contxt_web = null;
    var clientContext = new SP.ClientContext.get_current();
    /** Get id of Current SP User*/
    contxt_web = clientContext.get_web();      
    clientContext.load(contxt_web);
    /***/
    peopleManager = new SP.UserProfiles.PeopleManager(clientContext);      
    userProps = peopleManager.getMyProperties(targetUser);
    clientContext.load(userProps);
    clientContext.executeQueryAsync(onRequestSuccess, onRequestFail);
}
function onRequestSuccess() {
    var messageText = "Name : " + userProps.get_displayName()
                               + " Sharepoint-ID : " + contxt_web.get_id()
                               + " Email : " + userProps.get_email();
}         

尝试使用userprops.get_userId,它可能有效。。

最新更新