Tuesday, December 21, 2010

Create folders in document librrary using web service

Hi All,

A very simple requirement of creating folder in the document library using web service comes many a times. So here is a simple three liner example that creates a folder in the document library.

All you need to do is add reference to the _vti_bin/DWS.asmx. Document workspace is the web service that manages all related to document workspace or even creating folder in normal team site document libraries.

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");

That is it. You have just created DemoFolder inside Shared Documents library of your site url.

No comments:

Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to sharepointkings@gmail.com with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to sharepointkings@gmail.com