Question

I need to develop a solution in Visual Studio 2015 for SharePoint 2013 which has the ability to update and items to a list.

I have already created a solution which can query list items, but for this I used ClientContext, Web and CAML Queries.

For my next project, I would like to use the official SharePoint REST APIs as this seems like a far better option.

However, when I select File -> New Project -> SharePoint 2013 - Empty Project, I am seeing this message:

enter image description here

I have installed the Office Developer Tools for VS 2015 as suggested elsewhere online, but this had no effect.

I am developing on a machine which is on the same network as the SharePoint site I wish to connect to, but I am not developing on the actual server.

How can I configure my machine so that I can create SP solutions remotely?

Was it helpful?

Solution 2

As I can't seem to find a way of setting this up on my machine, I am using this method instead:

using Microsoft.SharePoint.Client;

namespace SharePointListUpdater
{
    class Program
    {
        private static string SiteUrl = "http://mytestsite/";
        private static string ListName = "mylist";

        static void Main(string[] args)
        {
            ClientContext clientContext = new ClientContext(SiteUrl);
            Web web = clientContext.Web;

            List oList = web.Lists.GetByTitle(ListName);
            ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
            ListItem oListItem = oList.AddItem(itemCreateInfo);

            oListItem["Title"] = "My New Item!";
            oListItem.Update();

            clientContext.ExecuteQuery(); // .Dispose() ???
        }
    }
}

The ClientContext method of connecting with SharePoint in C# has proven to be very useful when others fail.

OTHER TIPS

The Visual Studio tools for building Solution projects will only work if you have SharePoint installed on your development machine.

The Visual Studio tools for building App/Add-In projects can be used with remote SharePoint sites (i.e. on your network or in the cloud).

Project types

You mention the ClientContext so I should also discuss the different APIs. There is the Server Object Model, the Client Object Model (CSOM) and the REST API.

The Server Object Model can only be used on SharePoint machines. This means a client application running on the SharePoint server or, more commonly, in an assembly deployed to the SharePoint server in a Solution project.

The Client Object Model and REST API are remote APIs that communicate with SharePoint via Web Services. These can be used in a SharePoint Solution project, a SharePoint App/Add-In project, or in an external client or Web application.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top