我有一個文檔庫,其中添加了一個文本列Read
。我正在使用腳本編輯器Web部件插入一些JavaScript。我需要得到這個專欄Read
對於特定商品的價值(我知道商品ID)。SharePoint 2013獲取列表項值字段值
我將不勝感激任何幫助。謝謝!
我有一個文檔庫,其中添加了一個文本列Read
。我正在使用腳本編輯器Web部件插入一些JavaScript。我需要得到這個專欄Read
對於特定商品的價值(我知道商品ID)。SharePoint 2013獲取列表項值字段值
我將不勝感激任何幫助。謝謝!
此代碼工作:
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());
});
您應該使用Sharepoint客戶端對象模型來獲取添加文本列的文檔庫。之後,您可以通過使用項目ID構建一個caml查詢來獲取列表項目,並且可以獲取列的值。
您可能需要使用SPServices或SharepointPlus來幫助您。隨着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")
})