Skip to content

Instantly share code, notes, and snippets.

@sitefinitySDK
Created November 21, 2013 12:57
SF_10.1, SF_10.2, SF_11.0, SF_11.1, SF_11.2, SF_12.0, SF_12.1, SF_12.2, SF_13.0, SF_13.1, SF_13.2, SF_13.3, SF_14.0, SF_14.1, SF_14.2, SF_14.3 - https://docs.sitefinity.com/for-developers-delete-document-libraries
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Telerik.Sitefinity.Libraries.Model;
using Telerik.Sitefinity.Modules.Libraries;
namespace Telerik.Sitefinity.Documentation.CodeSnippets.DevGuide.SitefinityEssentials.Modules.MediaModules.DocumentsAndFiles.ManagingLibraries
{
public partial class LibrariesSnippets
{
private void DeleteDocumentLibraryNativeAPI(Guid documentLibraryId)
{
LibrariesManager manager = LibrariesManager.GetManager();
DocumentLibrary library = manager.GetDocumentLibraries().Where(b => b.Id == documentLibraryId).SingleOrDefault();
if (library != null)
{
//Mark the library to be deleted.
manager.DeleteDocumentLibrary(library);
//Save the changes.
manager.SaveChanges();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment