Hi there. Sorry if this has been asked elsewhere. I have looked but can't find any definitive answers.
I'm writing an app for Sharepoint 2010 that needs to create folders in a document library; one for each "job" that the app processes, as a place to put the job output. But, I'm having problems with folder name collisions. Each "job" is encoded as an xml file in another sharepoint list. For example, it might contain an xml file called "from docx to pdf.xml". So far I have the app creating subfolders in the output list using the job files name minus the extension. So, a folder called "from docx to pdf" in this case. But, some time later, the app might have to re-process the exact same job. I want to be able to have another subfolder in the same list as the first, with the exact same name visible to the user in a browser...
Can you do this in Sharepoint lists? It seems ordinary SPListItems have Name, DisplayName and Title properties. Obviously, one of these must be unqiue, so that Sharepoint can uniquely identify that item. but which is it? And does the same apply to SPFolder items in a list? I guess here I want to have something like duplicated folder display names, but unique internal names. Any ideas on how to do this? So far, my crappy method goes something like this:
private SPFolder CreateSubFolder(SPList list, string visibleFolderName)
{
// create a new folder under the root folder
SPListItem newFolder = list.AddItem("", SPFileSystemObjectType.Folder, visibleFolderName);
newFolder.Update();
return newFolder.Folder;
}
This obviously doesn't work. Any ideas on how to alter to have the same visible name, but diff internal names (perhaps using Guids...)?:D Thanks in advance.