IMPORTANT: This version of Sitefinity CMS is out of support and the respective product documentation is no longer maintained and can be outdated. Use the version selector to view a supported product version.
This topic explains how to delete document libraries. The examples below show you how to delete all of the available document libraries or how to delete only a specific document library by its ID.
When deleting a specific document library by its ID, you must perform the following:
Get the document library.
First, get an instance of the document library that corresponds to the specified ID.
Delete the document library.
Mark the document library to be deleted and save the changes.
The following code deletes a document library by its ID.
First, you get an instance of the LibrariesManager class. Then, you get the document library with the specified ID. To mark the document library to be deleted, you call the DeleteDocumentLibrary method of the manager with the instance of the document library as an argument. Finally, you save the changes.
First, you get the singular facade of the document library with the specified ID. To mark the document library to be deleted, you call theDelete method of the facade. Finally, you call SaveChanges.
When deleting all document libraries, you must perform the following:
Get all document libraries.
Get instances of the available document libraries.
Delete each document library in the collection.
Iterate through the collection and delete each library.
The following code deletes all document libraries.
First, you get an instance of the LibrariesManager class. Then, you get all of the available document libraries. You iterate through the collection and mark each document library to be deleted. Finally, you save the changes.
First, you get the plural document libraries facade. To mark each item to be deleted, you call the Delete method of the facade. Finally, you save the changes.
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important