Forum Discussion
Copy Column name and setting from one SharePoint List to another SharePoint List
Hi Jbrines1969 , you can create a script in CLI for M365, PowerShell, or a flow in Power Automate to do so.
As you can see, in most cases, an XML schema of the source field is required.
CLI for M365:
https://pnp.github.io/cli-microsoft365/cmd/spo/field/field-add/ command with --xml parameter
PnP PowerShell :
https://pnp.github.io/powershell/cmdlets/Add-PnPFieldFromXml.html to use XML
or
https://pnp.github.io/powershell/cmdlets/Add-PnPField.html#example-6 with Formula parameter
SharePoint HTTP Request REST API in PowerAutomate: with SchemaXMl parameter
Hi michalkornet I will give this a go and get back to you, many thanks.
- michalkornetJan 21, 2025Iron Contributor
Hi Jbrines1969, you can use for example CLI again check this command and SchemaXML in the result https://pnp.github.io/cli-microsoft365/cmd/spo/field/field-get/
- Jbrines1969Jan 22, 2025Brass Contributor
Hi michalkornet does this look right as I am getting an error.
Error - Missing required query string: @a1.
clientRequestId: cb54f27a-b004-4ab0-b086-c0a25730c103
serviceRequestId: f6037aa1-7095-b000-1646-476ebe9ca29b - Jbrines1969Jan 22, 2025Brass Contributor
Hi michalkornet thanks for this. I have managed to get the SchemaXml.
I take it that it will create any type of Field Type?
<Field Type="Calculated" DisplayName="Created Date" EnforceUniqueValues="FALSE" Indexed="FALSE" Format="DateOnly" LCID="2057" ResultType="Text" ReadOnly="TRUE" ID="{b77001d8-2be2-4c44-9170-fc3dc16211fd}" SourceID="{74c86529-bcbd-4c23-a60d-e960f9fb73d2}" StaticName="Created_x0020_Date0" Name="Created_x0020_Date0" ColName="sql_variant5" RowOrdinal="0" Version="2" CustomFormatter="" Required="FALSE"><Formula>=TEXT(Created,"dd/MM/yyyy")</Formula><FieldRefs><FieldRef Name="Created" /></FieldRefs></Field>