1

I am a fresher and want to use SharePoint 2013 with php. What I really want to do is create folders, sub-folders and write .xlsx files inside these folders and also want to read and download these files using php. can anyone help me? I only understand PHP and java-script.

4

You can create folders and subfolders using the Lists web service using the UpdateListItems method. The following example code takes a foldername argument and creates a folder in the root folder of the list. If you want to create a folder within another folder then just change the RootFolder attribute to the url of the folder. Hope this helped.

http://msdn.microsoft.com/en-us/library/lists.aspx

public static void UpdateListItemCreateFolder(string folderName)
{
        listservice.Lists listProxy = new listservice.Lists();

        string xmlconst = "<Batch OnError='Continue' 
RootFolder='http://basesmcdev2/sites/tester1/tester2'><Method ID='1' 
Cmd='New'><Field Name='ID'>New</Field><Field Name='FSObjType'>1</Field>
<Field Name='BaseName'>!@foldername</Field></Method></Batch>";


        listProxy.Url = 
"http://basesmcdev2/sites/tester1/_vti_bin/lists.asmx";
        listProxy.UseDefaultCredentials = true;


        XmlDocument doc = new XmlDocument();
        string xmlFolder = xmlconst.Replace("!@foldername", folderName);
        doc.LoadXml(xmlFolder);
        XmlNode batchNode = doc.SelectSingleNode("//Batch");
        XmlNode resultNode = listProxy.UpdateListItems("tester2", 
batchNode);
0

Like @Sara says, you can use list web services to create items in a document library. If you want to use only JavaScript, you can use SharePointPlus.js. This library allows you to use list web services via JavaScript.

https://aymkdn.github.io/SharepointPlus/files.html#createFolder

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.