1

I can get all the items from a library using the following code:

  HttpWebRequest endpointRequest = (HttpWebRequest)HttpWebRequest.Create("http://website/_vti_bin/ListData.svc/SharedDocuments");

        endpointRequest.Method = "GET";
        endpointRequest.Accept = "application/json;odata=verbose";           
        NetworkCredential cred = new System.Net.NetworkCredential("Administrator", password);
        endpointRequest.Credentials = cred;
        HttpWebResponse endpointResponse = (HttpWebResponse)endpointRequest.GetResponse();
        try
        {
            WebResponse webResponse = endpointRequest.GetResponse();
            Stream webStream = webResponse.GetResponseStream();
            StreamReader responseReader = new StreamReader(webStream);
            string response = responseReader.ReadToEnd();
            JObject jobj = JObject.Parse(response);
            JArray jarr = (JArray)jobj["d"]["results"];
            foreach (JObject j in jarr)
            {
                Console.WriteLine(j["Title"] );
            }

            responseReader.Close();
            Console.ReadLine();


        }
        catch (Exception e)
        {
            Console.Out.WriteLine(e.Message); Console.ReadLine();
        }

Apart from changing the method to POST, how can I create a folder in the library in this way?

I am familiar with How to create a folder in SharePoint 2010 document library using REST or HTTP methods and would prefer to avoid using SOAP.

Your Answer

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

Browse other questions tagged or ask your own question.