Remove Multiple Columns From Default View of Document Library From Site Collection

Objective

This purpose of this article is to mention the steps to remove multiple columns from default view of a document library from selected set of site collection configured in XML files in a single go using PowerShell script. The reusable script for this job is also attached with this document. This script offers - 
  • To read a set of site collections, from which we want to remove site columns. 
  • Remove column from Default view of a document library.
Business Case

S. No. Business Case
1. For several reasons SharePoint system users may want an overhead of column in default view of a document library, so user may request to remove these not necessary column from default view from multiple/all site collection. Doing this one by one is a painful job for administrator/developer. This script will allow administrator/developers to do the job just by configuring the XML file.
 
Targeted Audience
  • SharePoint Application Developers
  • SharePoint Administrator
  • SharePoint Architect
Offerings
  • One reusable PowerShell script is provided which needs to be run to remove column from default view of a document library.
  • Format of XML file is provided where site collection needs to be configured.
Technical Details

Below are the technical details for this PowerShell script,

5.1 Pre-requisites

1. Login to server with Farm administrator account and copy the folder and paste the same to the location where you want to keep it.

2. Open the folder and Configure XML file as per your requirement.

code

As shown in below image; enter Web Application URL at https://myWebApplicationURL , configure a set of columns to remove from document library and configure a set of Site collection relative URL which you want to backup as shown in above image.

Note: Name the file as Configuration.xml only.

5.2 Execution

Prerequisite:

Login to SharePoint Server as Farm Administrator and copy the required files (PowerShell script and configuration XML).Configure the XML file as per your requirement.

Run:

1. Run the PowerShell Script as “Run as Administrator“.

2. Browse the folder path where you have kept this PowerShell script file and execute a command as shown in below image.

Note:

1. As shown in above image; Script will ask you for a path where you want to keep these backup files.

2. In case you have typed site collection URL wrongly this script will show you an error in red color asking you to check if you have typed the URL correctly.

error
 
5.3 Output Folder

1. Please find below folder location which we have configured in our script to maintain a site collection backup output location.

output
PowerShell Script

RemoveMultiPleColumnFromDefaultViewOfDocumentLibrary.PS1  folder

Read more articles on PowerShell:


Similar Articles