0

this question is related with this one. How can I create a folder to put the files I upload inside them without using the SharePoint API (I'm executing the application on another host)?

Thanks in advance.

Community
  • 1
  • 1
Ignacio Soler Garcia
  • 21,122
  • 31
  • 128
  • 207

2 Answers2

0
     SPSite _MySite = new SPSite("http://adfsaccount:2222/");
                SPWeb _MyWeb = _MySite.OpenWeb();

                SPDocumentLibrary _MyDocLibrary = (SPDocumentLibrary) _MyWeb.Lists["My Documents"];
                SPFolderCollection _MyFolders = _MyWeb.Folders;
                _MyFolders.Add("http://adfsaccount:2222/My%20Documents/" + txtUpload.Text + "/");
                _MyDocLibrary.Update();
_MyWeb.Dispose();
_MySite .Dispose();
  • Sorry, I forgot to mention that I cannot use SharePoint API because I'm at other host. – Ignacio Soler Garcia Dec 21 '10 at 12:19
  • 1
    DWorkSpace is webservice instance reference name. DWorkSpace.Dws dwspace = new DWorkSpace.Dws(); dwspace.Credentials = System.Net.CredentialCache.DefaultCredentials; dwspace.Url = "{your_site}/_vti_bin/DWS.asmx"; dwspace.CreateFolder("Shared Documents/DemoFolder"); – Ashutosh Singh-MVP SharePoint Dec 21 '10 at 12:28
0

I created console application to create folders. I need to give seperate permissions for each and every folder because those are all state folders. So you can look at the breakroleinheritence property also.

Chinnari
  • 114
  • 2
  • 6