2016-03-08 40 views

回答

0

你可以使用.get_url()函數上的實際項目值來獲取超鏈接URL或.get_description()函數來獲取超鏈接的顯示文字

var linkField = "internalColumnName"; 
var listName = "List Title"; 
var clientContext = new SP.ClientContext(); 
var list = clientContext.get_web().get_lists().getByTitle(listName); 
var camlQuery = new SP.CamlQuery(); 
var items = list.getItems(camlQuery); 
clientContext.load(items); 
clientContext.executeQueryAsync(Function.createDelegate(this,function(){ 
    var itemEnumerator = items.getEnumerator(); 
    while(itemEnumerator.moveNext()){ 
     var item = itemEnumerator.get_current(); 
     var url = item.get_item(linkField).get_url(); // <-- Get URL 
     var text = item.get_item(linkField).get_description(); // <-- Get Text 
     alert(url + ", " + text); 
    }  
}),Function.createDelegate(this,function(sender, args){alert(args.get_message());})); 
相關問題