Posts

Showing posts from December, 2015

C# Call SharePoint Web API from Server Object Model

In my last blog  SharePoint 2013 Create and Host Web Service . I have explained how to create SharePoint Web Service. So we need to consume that service. We can consume that service from JSOM as well as SSOM. Here I am explaining how we can consume web service from C# code(SSOM). So first of all we need to define same entity for getting data, Which we had used in operation contract of service. So below is an example of entity. a. Entity in Service Contract     [DataContract]     public class ModuleDetails     {         [DataMember]         public string ID { get; set; }         [DataMember]         public string ModuleName { get; set; }         [DataMember]         public string AppName { get; set; }     } b. Entity where we will consume that service     public class ModuleDetails     {   ...

SharePoint 2013 Create and Host Web Service

Image
In this post we will discuss about how we can create WCF/Web service in SharePoint environment. Here you can get step by step instruction to create web service. This web service can be used to get data from share point. This service can return output in json and xml format. this service can be used in client side code as well as server side code. Suppose that there is a requirement say you want to perform same action from multiple platforms or multiple applications, So in such scenarios you can go with service. Its too simple to create and implementation is same as what we are doing in C# code. In WCF services hosting is always a challenge. But in SharePoint web service we can host on existing web application. So there is no need to put extra efforts to host SharePoint web service.  Below is the step to step instruction to create SharePoint Web Service. 1. Open visual studio with Run as administrator 2. Create new solution and select SharePoint 2013 - Empty Project ...