2014-01-13 42 views
1

我有一個文檔庫,其中添加了一個文本列Read。我正在使用腳本編輯器Web部件插入一些JavaScript。我需要得到這個專欄Read對於特定商品的價值(我知道商品ID)。SharePoint 2013獲取列表項值字段值

我將不勝感激任何幫助。謝謝!

回答

2

此代碼工作:

this.oListItem = oList.getItemById(itemid); 
ctx.load(this.oListItem); 
ctx.executeQueryAsync(Function.createDelegate(this, 
    function() {prevText = this.oListItem.get_item('Read'); }), 
    function (sender, args) { alert('Error occured' + args.get_message()); 
}); 
0

您應該使用Sharepoint客戶端對象模型來獲取添加文本列的文檔庫。之後,您可以通過使用項目ID構建一個caml查詢來獲取列表項目,並且可以獲取列的值。

0

您可能需要使用SPServicesSharepointPlus來幫助您。隨着SharepointPlus代碼將是:

$SP().list("Name of your list").get({fields:"Read",where:"ID = 123"}, function(data) { 
    if (data.length===1) alert("Read = "+data[0].getAttribute("Read")) 
    else alert("Unable to find ID 123") 
}) 
相關問題