SharePoint 2013 Search Results Paging

When we do a search query using KQL, by default SharePoint limits the results to 50 rows. We can explicitly set the RowLimit upto 500.

If our result set contains more items, we have to page through the results. This can be done by keeping the current row index value(which is the last row of the current result set), looping through the pages and updating the current row index after fetching the current page.
Continue reading “SharePoint 2013 Search Results Paging”

Create a list item in another site collection

It is much easier to create or update a list item in another site collection using JSOM. We can easily do it as follows:

I recommend using this method instead of the REST API to create a list item in another site collection.

var listName;
var item;
var itemType;

var otherClientContext = new SP.ClientContext("other site url");
var oList = otherClientContext.get_web().get_lists().getByTitle(listName);

var itemCreateInfo = new SP.ListItemCreationInformation();
var oListItem = oList.addItem(itemCreateInfo);
oListItem.set_item(‘Title’, "SharePoint");

own1ClientContext.executeQueryAsync(onQuerySucceeded, onQueryFailed);

function onQuerySucceeded() {

function onQueryFailed(sender, args) {
alert(‘Request failed. ‘ + args.get_message() + ‘\n’ + args.get_stackTrace());

Continue reading “Create a list item in another site collection”

Download files from SharePoint document library using C#

How to download files from SharePoint document library programmatically using C#

Sometimes, we would want to download multiple files based on a pre-defined query such as a monthly report or a bulk download.

If it is a few files or if it is a complete folder, we can use the explorer view to copy paste the files. However, if we want to customize the query or automate the process, then we need to write custom code to download the files programmatically. This is also true, if we want to access the metadata of the files along with downloading the actual files.
Continue reading “Download files from SharePoint document library using C#”