Office 365 and PnP-PowerShell 2013 : Fields
Now the time to learn about the Fields or so called SharePoint “List” and “Content Type” Columns.
The below mentioned cmdlets lets you create and remove the Fields to content type and directly to the SharePoint List.
|Adds a field to a list or as a site column|
|Returns a field from a list or site|
|Removes a field from a list or a site|
|Adds a field to a list or as a site column based upon a CAML/XML field definition|
|Adds a taxonomy field to a list or as a site column.|
If you want to take a better control over to the list columns better way to design and developed via “Add‑PnPFieldFromXml” method. As this method you only need to work on the XML part for this you need to invest your time to check CAML Documentation.
So I am going use “Add‑PnPFieldFromXml” cmdlets to create the utility to create the columns and configuration done via CSV file.
So before going ahead you need to know about the basic understanding about the CAML Documentation.
Let’s quickly jump in to the example. This Utility is tried and tested please feel free if you face any issue related to this scripts.
In this example, I am going to create the CSV files called "SiteColumns.CSV" in which I will provide you all the type of the columns example.
Also Please check the all the columns closely before going ahead to do any modification mostly please keep check the "optional" columns in the csv which is used to enter the optional data into the Field Xml like make the column to enter only datetime data, or make it required. Also the "optional" field is separated by Pipe "|" symbol to enter the multiple values inside the tags. Also for example if you set the default value to the choice column.
Here is the Source code. Hope you like it and please let me know your issue and feedback about this.