Programmatically delete Customized Reports document library in SharePoint 2010

Customized Reports - Document library that contains the templates to create Web Analytics custom reports for the site collection.

Go to the Customized Reports deocument library, in the ribbon interface click on Library tab and then click on Library Settings.

In the Permissions and Management section, you could not be able to see an option Delete this document library.

You can delete this document library using SharePoint Object Model.

Code Snippet:

 

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using Microsoft.SharePoint;

using System.Xml;

 

namespace DeletCustomizedReports

{

    class Program

    {

        public static void Main(string[] args)

        {

            using (SPSite site = new SPSite("http://serverName:21359/sites/VJTesting/"))

            {

                using (SPWeb web = site.OpenWeb())

                {

                    SPList list = web.Lists.TryGetList("Customized Reports");

                    if (list != null)

                    {

                        list.AllowDeletion = true;

                        list.Update();

                        list.Delete();

                        System.Console.WriteLine("List is created successfully");

                        System.Console.ReadLine();

                    }

                    else

                    {

                        System.Console.WriteLine("List does not exists in the site");

                        System.Console.ReadLine();

                    }

                }

            }

        }

    }

}