Customizing SharePoint Forms using JSLink

Lets explore customizing SharePoint Forms using JSLink.
Lets say we want to customize the New Form of a custom list.
Continue reading “Customizing SharePoint Forms using JSLink”

SharePoint Search – how to return all results

By default, when we use the Search API, SharePoint limits the number of items retrieved. If your query returns a number of items within this limit, then it is not a problem. However, if your query results in a larger set, then by default those items will not be present in the result set.
Continue reading “SharePoint Search – how to return all results”

WebMethods in SharePoint using JQuery

Lets say we have a SharePoint Site Page or Application Page which has a server side method and we would like to call this method from JavaScript code. Wouldn’t it be great if we can do the server side processing and return the result such as a string or a json object back to the client side? Well, this is precisely what we can do using WebMethod framework.
Continue reading “WebMethods in SharePoint using JQuery”

Cross Domain Library in SharePoint 2013

Let’s have a look at the Cross Domain Library in SharePoint 2013

In this series of posts, I will be posting my experience following along to the Microsoft Virtual Academy course on SharePoint Online Development for Office 365.

Let’s see how to use the cross domain library from a provider hosted app.
Continue reading “Cross Domain Library in SharePoint 2013”

Provider Hosted App on Office 365

Lets see how to create and deploy a Provider Hosted App on Office 365

In this series of posts, I will be posting my experience following along to the Microsoft Virtual Academy course on SharePoint Online Development for Office 365. Follow along to create and deploy a provider hosted app on your Office 365 tenant.
Continue reading “Provider Hosted App on Office 365”

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);
otherClientContext.load(oList);

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

own1ClientContext.load(oListItem);
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#”