Create folder in document library using SharePoint workflow
I want to create folder inside my document library based on other document library in the root. And I want to run this workflow on new document library creation.
So let say I have 4 document library:
- Help
- News
- Doc
- Archive
I want to create folder inside "Archive" Document library when New document library is created.
- Help
- News
- Doc
- Archive
- New Doc Library
and in Archive document library it will create folders
- Help
- News
- Doc
- New Doc Library
Is it possible..?
How can I do it.??
--
Thanks in advance.
string archiveListUrl = "http://myserver/Archive/";
SPSite site;
SPWeb web;
SPDocumentLibrary library;
using (site = new SPSite(archiveListUrl))
using (web = site.OpenWeb())
{
library = (SPDocumentLibrary)web.Lists["Archive"];
web.Folders.Add(archiveListUrl + "Help");
web.Folders.Add(archiveListUrl + "News");
web.Folders.Add(archiveListUrl + "Doc");
web.Folders.Add(archiveListUrl + "New Doc Library");
library.Update();
}
Thats difficult: Workflows are are always attached to one document/item. One thing you could do: Create the Library from a customized template - and you can customize this lib with an workflow to start on creation of a doc. Then add a document to the library and save the whole thing as template with content.
(Actually you might check if creating a lib template with existing folders might be easier...)
精彩评论