How to create a Microsoft SharePoint folder in a document library, by using WebClient in C#

  If you want to create a folder in a document library, by using WebClient in C#, you can use the following code:   namespace Research { using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Net; [TestClass] public class RliResearch { [TestMethod] public void CreateSharePointFolderInDocumentLibrary() { string folderToCreateUri = "https://1.1.1.1/sites/mysite/Shared%20Documents/FolderIWantToCreate"; using (var client …

Combine base URL string with a relative path string in C#

One way of combining a base URL string with a relative path string in C#:   [TestMethod] public void Combine_base_url_with_relative_path_test() { Char slash = ‘/’; // Make sure sharePointUrl does not end with a slash. string sharePointUrl = "https://mySharePointServer/sites/mysites"; if (sharePointUrl.EndsWith(slash.ToString())) { sharePointUrl = sharePointUrl.TrimEnd(slash); } // Make sure templatesRelatviePath …

POST multiple parameters to an ASP .NET Web Api REST service from a .NET 3.5 assembly, by using one dynamic JObject "options" parameter.

  Client code in .NET 3.5   namespace WordMerge.EndToEndTests { using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Net; using Newtonsoft.Json; [TestClass] public class UnitTest1 { [TestMethod] public void Execute_a_post_request() { string url = "http://localhost:63544/api/document"; object result = string.Empty; // Uses the System.Net.WebClient and not HttpClient, because .NET 2.0 must be supported. using …