deleting subfolders in share point server

sharepoint India
  • 15 years ago
    hi there,

    I am doing an application that will watch a particular directory /folder (FileSystemWatcher) and upload the files and folder that are added or modified in that directory to the share point server.

    Now,I want to delete a subfolder in the sharepoint server.

    Dim docLibPath As String = ConfigurationSettings.AppSettings("DocUploadPath")
    Dim thisProjectWeb As SPWeb = SPControl.GetContextWeb(context)
    thisProjectWeb.AllowUnsafeUpdates = True
    Dim parentfolder As SPFolder = thisProjectWeb.GetFolder(docLibPath)
    oldfolder = parentfolder.SubFolders(oldfoldername)
    parentfolder.SubFolders.Delete(oldfolder.url)


    it works fine if the oldfoldername=Firstfolder and returns error if the firstfolder contains any subfolder ie
    if oldfoldername=firstfolder/secondfolder.

    Can anyone pointout whats the error i am doing here.

    Thanks
    Praveena



Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity.” - Dennis Ritchie