有没有办法在一个请求中加载多个对象,如下所示:
var context = new SP.ClientContext.get_current();
this.web = context.get_web();
this.site = context.get_site();
var list = this.web.get_lists().getByTitle(window.sessionStorage.getItem('selectedContentType'));
var query = '<View Scope=\'RecursiveAll\'><Query>' + $('.camlQuery').val() + '</Query></View>';
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml(query);
this.items = list.getItems(camlQuery);
context.load(this.site);
context.load(this.items, 'Include(ID,DocIcon,LinkFilename,FileRef,FileLeafRef,Title,ContentType,SupplierPGProduct)');
context.executeQueryAsync(Function.createDelegate(this, get_Data_onSuccess), Function.createDelegate(this, get_Data_onFailure));
}
在此示例中,我指的是一个异步请求中的this.site
和this.items
?
或者我必须先加载this.site
并在请求成功时加载this.items
?
答案 0 :(得分:0)
我在sharepoint.stackexchange中找到了答案。 这是答案的链接。