This project is read-only.

Installing in SharePoint

Install the Prerequisites

Download and install the Camelot .NET Connector
http://www.bendsoft.com/redirect/camelot-net-connector/

Download and install the Camelot SharePoint Integration Toolkit
http://camelottoolkit.codeplex.com/

Note! To use the Camlot JSON API you don't need to start the Camelot SharePoint Integration Service, simply install the toolkit is enough.

Install the Camelot JSON API binaries

Donwnload the latest binaries from this site and simply drag them to the bin folder of your SharePoint web site. Usually the path is similar to this C:\inetpub\wwwroot\wss\VirtualDirectories\80\bin, if you plan to use the JSON API on more than one SharePoint Web simply copy and paste the binaries into the bin folders of the other webs as well.

There should be two .dll files in the package, place them in the /bin folder of your SharePoint Web

  • Camelot.JSONAPI.dll
  • Newtonsoft.Json.dll

Modify your web.config

Note! This example is for SharePoint 2013 running .net 4. Other samples will be posted asap.

Create a backup of your web.config before editing the file!

Locate the web.config file from the parent directory of where you placed the binary files. Open the file in the text editor of your choice.

Add a connectionstring

Insert a connection string in the <configuration> section. The name of the connection string is the reference to the connection parameter in the Camelot JSON Command Object.

<connectionStrings>
  <add name="Default" connectionString="server=serverurl;database=/;user=accountname;domain=;password=yourpassword;DefaultLimit=10000;TimeOut=120"/>
</connectionStrings>

To add several connection strings simply create several elements

<connectionStrings>
  <add name="Default" connectionString="server=serverurl;database=/;user=accountname;domain=;password=yourpassword;DefaultLimit=10000;TimeOut=120"/>
  <add name="Web1" connectionString="server=web1;database=/;user=accountname;domain=;password=yourpassword;DefaultLimit=10000;TimeOut=120"/>
  <add name="Web1_Sales" connectionString="server=web1;database=/sales/;user=accountname;domain=;password=yourpassword;DefaultLimit=10000;TimeOut=120"/>
  <add name="OtherConnectionString" connectionString="server=otherserver;database=/;user=accountname;domain=;password=yourpassword;DefaultLimit=10000;TimeOut=120"/>
</connectionStrings>

Official connection string documentation: http://www.bendsoft.com/documentation/camelot-net-connector/latest/reference/connection-string-options/

Add the Service Model

Next step is to register the JSON service in the web.config file allowing us to communicate with SharePoint through the API.

Find the <system.serviceModel> element in the web.config file, if it doesn't exist simply create it in the <configuration> section

<system.serviceModel>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" minFreeMemoryPercentageToActivateService="0">
    <serviceActivations>
      <add relativeAddress="~/camelot/jsonapi.svc" service="Camelot.JSONAPI.JsonService" factory="System.ServiceModel.Activation.WebScriptServiceHostFactory" />
    </serviceActivations>
  </serviceHostingEnvironment>

  <behaviors>
    <endpointBehaviors>
      <behavior name="EndpBehavior">
        <!--<enableWebScript />-->
        <webHttp />
      </behavior>
    </endpointBehaviors>

    <serviceBehaviors>
      <behavior name="ServiceBehavior">
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="true" />
      </behavior>
      <behavior name="">
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="true" />
      </behavior>
    </serviceBehaviors>
  </behaviors>

  <services>
    <!-- webHttpBinding is required to consume the service from JS -->
    <service behaviorConfiguration="ServiceBehavior" name="JsonService">
      <endpoint address="" behaviorConfiguration="EndpBehavior" binding="webHttpBinding" contract="JsonService">
      </endpoint>
    </service>
  </services>
</system.serviceModel>

Note! Some of these settings may be customized to better fit your needs

Add a location element (optional)

Adding a location element is optional but may help in some setups. Insert the location element after the closing of the </system.serviceModel> element.

<location path="camelot">
  <system.web>
    <identity impersonate="true" />
    <authorization>
      <allow users="?"/>
    </authorization>
  </system.web>
</location>

Last edited Jan 24, 2013 at 5:01 PM by Bendsoft, version 11

Comments

No comments yet.