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.
When creating a document library, you must perform the following steps:
Check whether the document library already exists.
Before you create the document library, you must check whether a document library with the same ID already exists.
Create the document library.
If the document library does not exist, you create a new document library with the specified ID.
Set the required properties.
When creating a new document library, it is recommended to set at least the following properties:
You can also set any other properties in this step.
Save the document library.
Save all changes that you have made to the document library.
The example below shows you how to create a document library with predefined ID.
The following code creates a document library with the specified ID and Title.
First, you get an instance of the LibrariesManager class. You check whether a document library with the same ID already exists. To create the document library, you call the CreateDocumentLibrary method of the LibrariesManager class and pass the specified ID. You can create a document library with either predefined or auto-generated ID depending on which overload of the method you use. Then, you set the properties of the document library object. It is recommended to set at least the following properties: Title, UrlName, LastModified,DateCreated. Finally, to save the document library, you call the SaveChanges method of the manager.
First, you check whether a document library with the same ID already exists. To create the document library, you call the CreateNewmethod of the singular document library facade. You can create a document library with either predefined or auto-generated ID depending on which overload of the method you use. To set the properties of the document library, you call the Do 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