I'm looking to copy fields and views from one site to another. I get the message that column does not exist and believe its down to when they are created.
I'm using the below to add create a field
list.Fields.AddFieldAsXml(fieldXml, addToDefaultView, AddFieldOptions.AddFieldInternalNameHint);
From what I have read, specifying
AddFieldOptions.AddFieldInternalNameHint
Should create the field with internal name. Below is the XML for the field
<Field ID="{c29e077d-f466-4d8e-8bbe-72b66c5f205c}" Name="URL0" SourceID="http://ift.tt/1k7JiLs" StaticName="URL" Group="Base Columns" Type="URL" DisplayName="URL" AllowDeletion="TRUE" ColName="nvarchar122" RowOrdinal="0" ColName2="nvarchar123" RowOrdinal2="0" />
It creates the field with the the following internal name _x0055_RL0
When it comes to create the views the column does not exist. I assume the views refer to the internalname?
What is the best way to go about create fields and views between sites as its abit confusing with the staticname and internal name, I will also need to update any associated fields with data, which I guess will now work because the field does not exist.
Part of the testing I am doing is creating fields from the UI and then adding fields from "Add from existing site Columns"
0 commentaires:
Enregistrer un commentaire