2013-02-15 79 views
0

我在获取SP App 2013中的Sharepoint Userid(GUID)时遇到了小问题。 迄今为止,我使用Sharepoint用户的电子邮件地址和他的全名使用Sharepoint的userProfile类(SP.UserProfile.js )。Sharepoint 2013应用程序用户Guid

我需要获得唯一的用户ID,我们说GUID ..我使用下面的代码,但每次我得到随机所谓的同一个用户的GUID(这绝对不是唯一的用户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(); 
}   

回答

1

尝试使用userprops.get_userId,那可就作品..

相关问题