Remove-SPField

The Remove-SPField cmdlet deletes the specified field from the given list or web.

Remove-SPField -Web <SPWebPipeBind> -InternalFieldName <String> [-Force [<SwitchParameter>]] [-AssignmentCollection [<SPAssignmentCollection>]]

Remove-SPField -List <SPListPipeBind> -InternalFieldName <String> [-Force [<SwitchParameter>]] [-AssignmentCollection [<SPAssignmentCollection>]]

Remove-SPField -Field <SPField> [-Force [<SwitchParameter>]] [-AssignmentCollection [<SPAssignmentCollection>]]

Parameters

1

ParameterRequiredTypeDescription
WebTrueSPWebPipeBind

The web to remove the field from.

The value must be a valid URL in the form http://server_name

InternalFieldNameTrueString

The internal name of the field to remove from the list.

ForceFalseSwitchParameter

Used to force deletion if AllowDeletion property is false.

AssignmentCollectionFalseSPAssignmentCollection

Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.

When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.

2

ParameterRequiredTypeDescription
ListTrueSPListPipeBind

The list to remove the field from.

The value must be a valid URL in the form http://server_name

InternalFieldNameTrueString

The internal name of the field to remove from the list.

ForceFalseSwitchParameter

Used to force deletion if AllowDeletion property is false.

AssignmentCollectionFalseSPAssignmentCollection

Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.

When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.

3

ParameterRequiredTypeDescription
FieldTrueSPField

The field to remove.

The value must be a valid SPField object.

ForceFalseSwitchParameter

Used to force deletion if AllowDeletion property is false.

AssignmentCollectionFalseSPAssignmentCollection

Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.

When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.

Detailed Description

The Remove-SPField cmdlet deletes the specified field from the given list or web.

Copyright 2016 Falchion Consulting, LLC

> For more information on this cmdlet and others:

> http://blog.falchionconsulting.com/

> Use of this cmdlet is at your own risk.

> Gary Lapointe assumes no liability.

Examples

------------------EXAMPLE 1-----------------------

PS C:\> Remove-SPField -Web "http://demo" -InternalFieldName "MyField"

This example deletes the "MyField" field from the web "http://demo".

------------------EXAMPLE 2-----------------------

PS C:\> Remove-SPField -List "http://demo/documents" -InternalFieldName "MyField"

This example deletes the "MyField" field from the list "http://demo/documents".

------------------EXAMPLE 3-----------------------

PS C:\> (Get-SPList "http://demo/documents").Fields.GetFieldByInternalName("MyField") | Remove-SPField -InternalFieldName "MyField"

This example deletes the "MyField" field from the list "http://demo/documents".