Posts

Showing posts from July, 2015

Upload a file in SharePoint using REST and c# console application

Image
Hi, In my last post , I have explained how to create a sub site using REST from and Console application. In this blog  will explain how we can upload a file, which is located in file system, will be uploaded to sharepoint Document library. So if I brief about requirement here: Need to upload a file to already created SharePoint site. Use REST(not even CSOM) will be used in order to create. API call will be send from some other machine(not SharePoint machine) which is in same domain and can access the SharePoint site. Follow the given steps to achieve the same: 1) Create a simple console application with c# selected language. 2) Next is to install the Newtonsoft.Json. Navigate to Visual studio menu: "View" > "Other Windows" > "Package Manager Console" and Then type the following: "Install-Package Newtonsoft.Json" 3) Now install RestSharp using the package manager. Type the following: "Install-Package RestSharp" 4) Now open th

Get SharePoint search results using REST ajax call from Html

Image
Hi, We all aware the SharePoint exposed REST Api in order to perform various action at client side. There are some other ways also which a developer can adopt instead of REST(like CSOM) but that requires again client context. So it is recommenced that if we are using SharePoint Apps then use CSOM to get and update the data. Where as REST can be used in apps as well as some external applications. This blog is intended to show how user can utilize the REST api and get the SharePoint Search results. There are few pre-requisites or conditions which must be fulfilled before proceeding further. The machine where this code will be executed must have access to sharepoint site which means machine must be either in same domain or cross domain accessibility is there. Search must be configured at SharePoint server. Data must be properly crawled and you must get some results when searched for some keyword. Steps: 1) Open the Explorer or any desired location and create a text file with ant des

Create Sub Site in SharePoint using REST and c# console application

Image
Hi, Recently, I got an requirement to create a SharePoint sub site from the some .Net application which is hosted somewhere hosted outside the SharePoint environment. It is provided that the .Net application can be added in same domain. So if I brief about requirement here: Need to create a sub site in SharePoint site collection based on some default template(later on custom template) Use REST(not even CSOM) will be used in order to create. API call will be send from some other machine(not SharePoint machine) which is in same domain and can access the SharePoint site. There are few challenges which I faces if we try to work with such kind of requirements. The authentication tokens and RequestDigest data are the crucial things to retrieve. I have explored some way to execute REST API and create a sub site without navigating to SharePoint site. Follow the given steps to achieve the same: 1) Create a simple console application with c# selected language. 2) Next is to install the New