"The day you stop learning SharePoint is the day you stop using it."

Delete InfoPath Published Columns or Hidden Columns

Some of you may have encountered the problem of deleting the InfoPath published columns. These columns are actually published as Content Types, so better we call them as content types. A custom column is easy to delete using OOB feature but deleting an InfoPath published column is pain in the arse. Below is a small script that will help you delete the InfoPath published columns.

Note:
The below PowerShell Script can be use to delete any type of column - custom, InfoPath, or hidden

function Delete-WorkflowColumn ($webURL, $listName, $columnName)
    {
        #Setup variables from the user input
        $web = Get-SPWeb $webURL
        $list = $web.Lists[$listName]
        $column = $list.Fields[$columnName]
       
        #Make sure the column is not hidden or read only
        $column.Hidden = $false
        $column.ReadOnlyField = $false
        $column.Update()

        #Delete column and dispose of the web object
        $list.Fields.Delete($column)
        write-host "Deleted column"
        $web.Dispose()
    } //Press Enter

Delete-WorkflowColumn -webURL http://pro1:4444/sites/test -listName "EmpList" 

-columnName "EmpAddress"
//Press Enter

That's All... You are Done !!!




Share:

0 comments:

SharePoint-StackExchange Moderator

Author's Profile

My photo
India
A SharePoint Enthusiast working as a Lead Solution Architect for an IT Software & Consulting Company in Mumbai. I believe in giving back to the community through which I also learn and develop and eventually grow as an individual and professional. This blog is a small contribution to the community where I live in and may help someone who is seeking knowledge like me.

Popular Posts

Powered by Blogger.

Contact Form

Name

Email *

Message *

Total Pageviews