Delete a folder

    To delete a folder
  1. After getting the handle to the folder you want to delete, use the SmsUnlinkFolder function to unlink the folder from its parent (the parent is the container or folder that contains the folder to delete). Note that unlinking a folder only detaches the folder from its parent within the application's memory—the folder is not deleted from the site database.

    Example:

    // UnLink the folder from its parent.
    stat = SmsUnLinkFolder( hFolder );
    

    If the parent folder's handle is still open, your application can link the folder to its parent again.

  2. Use the SmsCommitFolder function to remove the unlinked folder from the site database.

    Example:

    // Remove the folder from the site database.
    stat = SmsCommitFolder( hFolder );
     

    Note that the folder is not deleted from the site database until the application calls the SmsCommitFolder function for that folder. If you do not want to delete the folder from the database, do not commit the unlinked folder.

    Important After your application deletes a folder from the site database by using the SmsCommitFolder function, the handle for the deleted folder can only be used for closing the folder with the SmsCloseFolder function.