Was trying to create Folder programatically in a Doc Library
I was trying to create Document librray programatically in a Sharepoint Site and is not working for me.I was trying to implement this as an Event Handler.
The aim of the code is to create a Folder with the same name as in folder which has been added.For eg if i am creating a folder titled A in a Doc library called A1 then I shud have a folder names A(programatically) in a document library called as 'Request for Proposals' (this is predifened)
below is the piece of code.
public class folder:SPItemEventReceiver
public override void ItemAdded(SPItemEventProperties properties)
site = new SPSite("http://a2ms04866:6000/presales");
web = site.OpenWeb();
SPListItem mainitem = properties.ListItem;
string fname=Convert.ToString (mainitem ["Name"]);
SPList list = web.Lists["Request For Proposal"];
if (list.EnableFolderCreation != true)
list.EnableFolderCreation = true;
string url = "http://a2ms04866:6000/presales/Request%20For%20Proposal";
list.Folders.Add(url , SPFileSystemObjectType.Folder, fname);
can somebody help me on this ??