简体   繁体   中英

Create folder sharepoint foundation Programmatically

I have a list with calculated value on it. I need that value to be a folder that get created in another lib. how can I do that Programmatically. thanks!

Let's say that value is you computed value, then you can create a folder in another library with name equals value using following code:

SPWeb web=SPContext.Current.Web; //just for example

var libUrl="host_relative_url_to_lib";
var docsLibrary = (SPDocumentLibrary)web.GetList(libUrl);
var libraryFolders = docsLibrary.RootFolder.SubFolders; //get all folders in lib
libraryFolders.Add(libUrl + "/" + value); //create a folder with name value
docsLibrary.Update(); //commit changes

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM