I'm going to write a lot of code that works with SharePoint lists and libraries over REST and C# (HttpClient)

I want to create or find helper classes that help me do the following tasks over REST:

  • Get all list items (preferably in nice C# objects with all SP properties)
  • Get item/file by list ID
  • Get items using CAML
  • Delete item/file by ID
  • Update item/file
  • Create folder
  • Upload a file
  • Add List item

Is there a project/library you can recommend I can reuse so that I don't write all these things myself?

Additional info:

  • CSOM (ClientContext) is not an option
  • There are a lot of samples with REST online, but they are too messy
  • I did some googling, but could not find one good Library/Project online that does all these things in a way I want
  • Preferably, I want this library/project to use HttpClient class
  • 3
    Re: "There are a lot of samples with REST online, but they are too messy". That's because using the REST API in C# is messy. You have to deal with raw XML or raw JSON. In my opinion you're much better off using the Client Object Model. Apr 10 '16 at 21:05
  • agree, except for the fact that I cannot use CSOM. I have to deal with Xamarin and Windows Phone SDK. you cannot use CSOM with Xamarin. And I cannot aithenticate via CSOM in Wndows Phone apps because of ADFS Apr 10 '16 at 21:24
  • if you can get it working with raw json ( returning specifically ) then the guide made by rob is perfect link Apr 11 '16 at 8:53

(I must say it is embarrassing to admit this) I have (partially) done this with REST.

I had used Newtonsoft.Json to parse the responses and HttpWebRequests to interact with the REST API. (I think you would be able to work with Atom using System.Xml as well.)

However I am not aware of a single library doing the process end-to-end.

  • 1
    I'm in a long process of creating CSOM-like classes that work via REST. it's actually a lot of fun. Here is an example: Authenticator aithenticator = new Authenticator(Login, password, siteUrl); XContext context = await aithenticator.GetCookiesAndDigest(); XList list = await context.GetList("Photos"); List<XListItem> listItems = await list.GetItems(caml); await listItems[0].Delete(); Apr 20 '16 at 2:21
  • That does make sense. After all you could then reuse your code in future projects! Good luck :)
    – Nisarg
    Apr 20 '16 at 8:32

I've uploaded a sample XSOM project here

The code will look like so: enter image description here

enter image description here

There are some basic operations available, but it's a good start

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.