SPWeb.Folders.Add() will not throw exception if the folder already exists. If that’s the case it will return that folder object. However the parent folder must already exists, versus in C#, Directory.CreateDirectory() will automatically create the whole tree. I had to write my own function to automatically create the whole tree.
SPFolder.Delete() and SPFile.Delete() will not throw exception if the folder/file doesn’t exist. So you can just call it directly without checking Exists property. Watch out for checked out file.
Items deleted through UI will be in Recycle Bin. (Recycle Bin can be disabled.) But items deleted using delete() API will be deleted permanently (there is a SPFile.Recycle() function that does what it’s named). When a file is restored from Recycle Bin, ItemAdded event will be fired. However no event is fired when a folder is restored.
This entry was posted on Wednesday, July 25th, 2007 at 5:20 pm and is filed under Events. You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
Hi,
Is it possible to share your code with me that creates a specific folder structure, including subfolders?
Thanks,
I don’t know what “specific folder structure” you are talking about.