Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

Web Service code to Create new folder in document library?

  Asked By: Chaim Odom         Date: Oct 12, 2006      Category: Sharepoint      Views: 2103
 

Any idea how to create a folder in document library through web service.

Tagged:                    

 

9 Answers Found

 
Answer #1       Answered By: Percy Beach          Answered On: Oct 12, 2006       

If your document  library is located at <<http://portal/sites/test/Shared
Documents>> and you want to create  a folder  called "test folder", then
from a command prompt type:

MKDIR "\\portal\sites\test\Shared Documents\test folder"

 
Answer #2       Answered By: Christop Mcfadden          Answered On: Oct 12, 2006       

But I want to create  windows application to
create a folder  in document  library using web  service as I need to
create it from client machine.

 
Answer #3       Answered By: Kundan Jambhale          Answered On: Oct 12, 2006       

Using Windows scripting...

Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CreateFolder("\\portal\sites\test\Shared Documents\test folder")

 
Answer #4       Answered By: Alyssa Butler          Answered On: Oct 12, 2006       

What is our requirement is something by
adding web-refernce some asmx(Imaging.asmx,List.asmx,custom.asmx)
file.
Then something like folder.add("docLib/Myfolder"); should create  a
folder in mentioned document  library docLib.

 
Answer #5       Answered By: Katy Patton          Answered On: Oct 12, 2006       

I'm not sure of the syntax for the specific web  application, but as long
as the WebClient service  is running on the client machine, then creating
folders in SharePoint is the same as creating them on the local file
system.

 
Answer #6       Answered By: Ana Payne          Answered On: Oct 12, 2006       

There is a CreateFolder method for a document  workspace. I don't know if you can use that on a Team site...

You may have to write a custom web  service to accomplish this. There is a document on MSDN that discusses creating a custom web service.

 
Answer #7       Answered By: Hema Hegde          Answered On: Oct 12, 2006       

In Sharepoint object model we have the below piece of code  to create
new folder

SPSite site = SPControl.GetContextSite(Context);
SPFolderCollection folders = site.GetFolder("Shared
Documents").SubFolders;
folders.Add("Folder_Name");

but I want to execute the same with web  service. I think there is no
web service  for this. do we need to create  our own web service?

 
Answer #8       Answered By: Damon Garner          Answered On: Oct 12, 2006       

The document  Workspace service  is not just for Document Workspaces, but for
doing things against document libraries.

Here's how to create  a new folder  in a document library  using the web  service.
It's killer easy:

Add a reference to the dws on the site where you want to create the folder (e.g.
http://servername/sites/sitename/_vti_bin/Dws.asmx)

Now the code  to call the service (the service is called myserver but can be
whatever you want):

myserver.Dws ws = new myserver.Dws();
ws.Credentials = System.Net.CredentialCache.DefaultCredentials;
ws.CreateFolder("DocumentLibraryName/NewFolderName");

 
Answer #9       Answered By: Megan Martin          Answered On: Oct 12, 2006       

CreateFolder in dws.asmx worked fine.............

 
Didn't find what you were looking for? Find more on Web Service code to Create new folder in document library? Or get search suggestion and latest updates.


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].