0

Dear All,

I am retrieving the list items with below from SharePoint online using JSOM for Out of Box,
But the performance for loading the data is very slow . And I am willing to use PortalSiteMapProvider to fetch  the data which will be giving better performance . 

Can any one please help me in knowing how can we make it.

<script src=”//code.jquery.com/jquery-1.10.2.js”></script>
<script>
//alert(‘start script’);
var listItems;// The list of retrieved items.
var camlQuery;// For paging, reuse the same query object.
var oList;// The list from which to retrieve items.
var clientContext;
ExecuteOrDelayUntilScriptLoaded(retrieveListItems, “sp.js”);
function retrieveListItems(){
//alert(‘enters function’);
clientContext = new SP.ClientContext.get_current();
oList = clientContext.get_web().get_lists().getByTitle(‘ScorecardSiqqidNew’);
camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml(“<View><Query><OrderBy><FieldRef Name=’Title’ Ascending=’TRUE’ /></OrderBy></Query></View>”);
camlQuery.RowLimit = 101;
this.listItems = oList.getItems(camlQuery);
clientContext.load(listItems);
clientContext.executeQueryAsync( Function.createDelegate(this, this.onQuerySucceeded),Function.createDelegate(this, this.onQueryFailed) );
}
function onQuerySucceeded(){
var listItemInfo = ”;
var listEnumerator = listItems.getEnumerator();
while (listEnumerator.moveNext()) {
var oListItem = listEnumerator.get_current();
listItemInfo +=’ <strong>Table top Sessions:</strong> ‘ + oListItem.get_item(‘Title’) +’ <br />’;
}
$(‘#divHelloWorld’).html(listItemInfo);
var position = listItems.get_listItemCollectionPosition();
if (position != null) {
query.set_listItemCollectionPosition(position);
listItems = targetList.getItems(query);
clientContext.load(listItems);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
}
function onQueryFailed(sender, args){
alert(‘Request failed. ‘ + args.get_message() +’n’ + args.get_stackTrace());
}
</script>
<p id=”divHelloWorld”>Hello World!</p>

 

(Visited 75 times, 1 visits today)
Chanakya Jayabalan Answered question April 13, 2018
Add a Comment