2016-05-17 5 views
0

は、#jQueryは、#Nintexは、私は現在のユーザーの詳細情報を取得するためのSharePoint 2013年Nintexフォームに次のコードを使用している

var userid = _spPageContextInfo.userId; 
var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/web/getuserbyid(" + userid + "); 

を形成するが、それは動作しません。 O365 Nintexフォーム(エラー:_spPageContextInfoは未定義です)。このアプローチに相当するものはありますか?それともユーザーの詳細を取得する最良の方法は何ですか?以下のように 私が試してみましたコード、

サンプル01:

SP.SOD.executeOrDelayUntilScriptLoaded(FormLoad(), 'SP.js'); 
function FormLoad() 
{ 
    var userId = _spPageContextInfo.userId; 
    console.log("Current User = " + userId); 
} 

サンプル02:

var pollSP; 
NWF.FormFiller.Events.RegisterAfterReady(function() { 
    pollSP = setInterval(checkSPLoad, 500); 
}); 

function checkSPLoad() { 
    if (clientContext) { 
     window.clearInterval(pollSP); 
     onSPLoad(); 
    } 
} 

function onSPLoad() { 
    var userId = _spPageContextInfo.userId; 
    console.log("Current User = " + userId); 
} 

注:

  1. SharePoint OnlineのサイトURL - "https://abc.sharepoint.com/dev"

  2. Nintexフォームがopened-ある10
  3. のURL "https://abc-1d0266265ca24d.sharepoint.com/dev/ ..."

これらのコードは、オンプレミスのSharePoint 2013 NINTEXフォームを働きます。 (フォームが開かれたとき、それはアプリのサイトにリダイレクトされません)

答えて

0

試しサンプル1は、最初の行にFromLoad後の括弧なし:

SP.SOD.executeOrDelayUntilScriptLoaded(FormLoad, 'SP.js'); 
+0

そして、それも(FormLoadに来ていません)関数 –

関連する問題