Export-SPContentType

Exports a Content Types to an XML file or the pipeline.

Export-SPContentType -Web <SPWebPipeBind[]> [-ContentType [<String>]] [-Group [<String>]] [-ListName [<String>]] [-ExcludeParentFields [<SwitchParameter>]] [-IncludeFieldDefinitions [<SwitchParameter>]] [-IncludeListBindings [<SwitchParameter>]] [-RemoveEncodedSpaces [<SwitchParameter>]] [-FeatureSafe [<SwitchParameter>]] [-OutputFile [<String>]] [-AssignmentCollection [<SPAssignmentCollection>]]

Export-SPContentType -Web <SPWebPipeBind[]> -Identity <SPContentTypePipeBind> [-ExcludeParentFields [<SwitchParameter>]] [-IncludeFieldDefinitions [<SwitchParameter>]] [-IncludeListBindings [<SwitchParameter>]] [-RemoveEncodedSpaces [<SwitchParameter>]] [-FeatureSafe [<SwitchParameter>]] [-OutputFile [<String>]] [-AssignmentCollection [<SPAssignmentCollection>]]

Export-SPContentType -List <SPListPipeBind[]> [-ContentType [<String>]] [-ExcludeParentFields [<SwitchParameter>]] [-IncludeFieldDefinitions [<SwitchParameter>]] [-IncludeListBindings [<SwitchParameter>]] [-RemoveEncodedSpaces [<SwitchParameter>]] [-FeatureSafe [<SwitchParameter>]] [-OutputFile [<String>]] [-AssignmentCollection [<SPAssignmentCollection>]]

Export-SPContentType -List <SPListPipeBind[]> -Identity <SPContentTypePipeBind> [-ExcludeParentFields [<SwitchParameter>]] [-IncludeFieldDefinitions [<SwitchParameter>]] [-IncludeListBindings [<SwitchParameter>]] [-RemoveEncodedSpaces [<SwitchParameter>]] [-FeatureSafe [<SwitchParameter>]] [-OutputFile [<String>]] [-AssignmentCollection [<SPAssignmentCollection>]]

Parameters

1

ParameterRequiredTypeDescription
WebTrueSPWebPipeBind[]

The source web containing the content type to export.

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

ContentTypeFalseString

The name of the content type to export.

GroupFalseString

The content type group to export. Specifying this will filter the exported content types to just those items in the group.

ListNameFalseString

The list name to filter by.

Specifying this along with the Web parameter will export content types from the list with the specified name only.

ExcludeParentFieldsFalseSwitchParameter

Exclude all fields defined in parent content types.

IncludeFieldDefinitionsFalseSwitchParameter

Include the field definitions in the exported XML.

IncludeListBindingsFalseSwitchParameter

Include the list bindings in the exported XML.

RemoveEncodedSpacesFalseSwitchParameter

Remove encoded spaces (_x0020_) in all field and content type names.

FeatureSafeFalseSwitchParameter

Remove any elements/attributes which are invalid in a SharePoint Solution Package Feature manifest file.

OutputFileFalseString

The path to the output file where the exported XML will be saved.

If omitted the output will be dumped to the pipeline.

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
WebTrueSPWebPipeBind[]

The source web containing the content type to export.

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

IdentityTrueSPContentTypePipeBind

The name of the content type to export. The type must be a valid content type name; a valid content type ID, in the form 0x0123...; or an instance of an SPContentType object.

ExcludeParentFieldsFalseSwitchParameter

Exclude all fields defined in parent content types.

IncludeFieldDefinitionsFalseSwitchParameter

Include the field definitions in the exported XML.

IncludeListBindingsFalseSwitchParameter

Include the list bindings in the exported XML.

RemoveEncodedSpacesFalseSwitchParameter

Remove encoded spaces (_x0020_) in all field and content type names.

FeatureSafeFalseSwitchParameter

Remove any elements/attributes which are invalid in a SharePoint Solution Package Feature manifest file.

OutputFileFalseString

The path to the output file where the exported XML will be saved.

If omitted the output will be dumped to the pipeline.

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
ListTrueSPListPipeBind[]

The source list containing the content type to export.

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

ContentTypeFalseString

The name of the content type to export.

ExcludeParentFieldsFalseSwitchParameter

Exclude all fields defined in parent content types.

IncludeFieldDefinitionsFalseSwitchParameter

Include the field definitions in the exported XML.

IncludeListBindingsFalseSwitchParameter

Include the list bindings in the exported XML.

RemoveEncodedSpacesFalseSwitchParameter

Remove encoded spaces (_x0020_) in all field and content type names.

FeatureSafeFalseSwitchParameter

Remove any elements/attributes which are invalid in a SharePoint Solution Package Feature manifest file.

OutputFileFalseString

The path to the output file where the exported XML will be saved.

If omitted the output will be dumped to the pipeline.

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.

4

ParameterRequiredTypeDescription
ListTrueSPListPipeBind[]

The source list containing the content type to export.

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

IdentityTrueSPContentTypePipeBind

The name of the content type to export. The type must be a valid content type name; a valid content type ID, in the form 0x0123...; or an instance of an SPContentType object.

ExcludeParentFieldsFalseSwitchParameter

Exclude all fields defined in parent content types.

IncludeFieldDefinitionsFalseSwitchParameter

Include the field definitions in the exported XML.

IncludeListBindingsFalseSwitchParameter

Include the list bindings in the exported XML.

RemoveEncodedSpacesFalseSwitchParameter

Remove encoded spaces (_x0020_) in all field and content type names.

FeatureSafeFalseSwitchParameter

Remove any elements/attributes which are invalid in a SharePoint Solution Package Feature manifest file.

OutputFileFalseString

The path to the output file where the exported XML will be saved.

If omitted the output will be dumped to the pipeline.

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

Exports a Content Types to an XML file or the pipeline.

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:\> Export-SPContentType -ContentType "ContentType1" -Web "http://server_name/" -OutputFile "c:\contentTypes.xml"

This example exports the ContentType1 content type from http://server_name and saves it to contentTypes.xml.

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

PS C:\> Export-SPContentType -ContentType "ContentType1" -List "http://server_name/lists/mylist" -OutputFile "c:\contentTypes.xml"

This example exports the ContentType1 content type from the list located at http://server_name/lists/mylist and saves it to contentTypes.xml.

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

PS C:\> Get-SPWeb "http://server_name" | Export-SPContentType -Identity "ContentType1" -OutputFile "c:\contentTypes.xml"

This example exports ContentType1 from http://server_name and saves it to contentTypes.xml.

------------------EXAMPLE 4-----------------------

PS C:\> Get-SPList "http://server_name/lists/mylist/" | Export-SPContentType -Identity "ContentType1" -OutputFile "c:\contentTypes.xml"

This example exports ContentType1 from the list located at http://server_name/lists/mylist and saves them to contentTypes.xml.

------------------EXAMPLE 5-----------------------

PS C:\> Get-SPWeb "http://server_name/*" | Export-SPContentType -List "Documents" -OutputFile "c:\contentTypes.xml"

This example exports all content types from all lists named Documents in all webs at http://server_name/* and saves them to contentTypes.xml.