Module Name | schema | applicable | online version | external help file | title |
---|---|---|---|---|---|
PnP.PowerShell |
2.0.0 |
SharePoint Online |
PnP.PowerShell.dll-Help.xml |
Add-PnPFieldFromXml |
Adds a field to a list or as a site column based upon a CAML/XML field definition
Add-PnPFieldFromXml [-List <ListPipeBind>] [-FieldXml] <String>
[-Connection <PnPConnection>]
Allows to add new field by specifying its definition in CAML/XML format to list or site columns.
$xml = '<Field Type="Text" Name="PSCmdletTest" DisplayName="PSCmdletTest" ID="{27d81055-f208-41c9-a976-61c5473eed4a}" Group="Test" Required="FALSE" StaticName="PSCmdletTest" />'
Add-PnPFieldFromXml -FieldXml $xml
Adds a field with the specified field CAML code to the site.
$xml = '<Field Type="Text" Name="PSCmdletTest" DisplayName="PSCmdletTest" ID="{27d81055-f208-41c9-a976-61c5473eed4a}" Group="Test" Required="FALSE" StaticName="PSCmdletTest" />'
Add-PnPFieldFromXml -List "Demo List" -FieldXml $xml
Adds a field with the specified field CAML code to the list "Demo List".
Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.
Type: PnPConnection
Parameter Sets: (All)
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CAML snippet containing the field definition. See https://learn.microsoft.com/sharepoint/dev/schema/field-element-list
Type: String
Parameter Sets: (All)
Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The name of the list, its ID or an actual list object where this field needs to be added
Type: ListPipeBind
Parameter Sets: (All)
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Microsoft 365 Patterns and Practices Field CAML documentation