0

I want to create 7 SharePoint lists and Fields in SharePoint online using a PowerShell script.

In XML I have mentioned the list names and Field Names with Field Types.

How to call this XML file to Create lists and Fields in SharePoint Online one by one, using PowerShell?

Can you please anyone share the sample PowerShell script to read the XML values in PowerShell?

Or suggest me some other way instead of calling XML file to create bulk list and fields.

    1 Answer 1

    1

    First, Read XML file

     $Listfile = Get-Content Lists.xml 

    Second, Based on your XML keys structure, perform nested loop for the list and its fields

    foreach( $list in $Listfile.Lists) { # create your list using PnP foreach( $field in $Listfile.Lists.Fields) { #Use PnP to create fields } } 

    Finally, at this link, you will find the cmdlets for CREATING LISTS AND FIELDS IN SHAREPOINT WITH PNP-POWERSHELL

      Start asking to get answers

      Find the answer to your question by asking.

      Ask question

      Explore related questions

      See similar questions with these tags.