How to remove Drop off library from the site using SharePoint 2010 Object Model



This article explains how to remove Drop off library from the SharePoint 2010 site using SharePoint 2010 Object Model.

SharePoint 2010 introduced a new feature called Content Organizer. This article does not explain the Content Organizer feature. After activitation of the Content Organizer feature a new Drop off Library will be created in the site. Like the normal document library you can't delete this document library. You won't be seeing an option "Delete this document library" (Drop off Library => Library Settings => Permissions and Management).

Fig1.gif

It doesn't work, if you try to remove this document library by deactivating the Content Organizer feature. You can remove this document library by using SharePoint object model or SharePoint Manager 2010 or Powershell.

Remove Drop Off Library using Powershell:

  • In this we will be seeing how to remove Drop Off Library using the following C# code.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.SharePoint;

    namespace DropOffLibrary{
        class Delete
        {
            static void Main(string[] args)
            {
                using (SPSite site = new SPSite("http://serverName:2011/"))
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        SPList list = web.GetList("http://serverName:2011/DropOffLibrary/");
                        list.AllowDeletion = true;
                        list.Update();
                    }
                }
            }
        }


    }

  • Go to the SharePoint Site => Drop Off Library => Library settings => Permissions and Management.
  • Now you will be able to see "Delete this document library" option.

    Fig2.gif