2013-02-15 77 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,那可就作品..

相關問題