Skip to main content

Search

REST from action builder?

Comments

2 comments

  • Kilgore ServiceAccount

    Andrew,

    Have you considered using Powershell? PNP Powershell Module is required to run the below script.

    I have templates for each Field Type, but below is the Script to add Choice Columns as 'Site Columns'...

     

    #Config Variables
    $SiteURL = "https://TENANTNAME.sharepoint.com/sites/ABC/"
     
    #Connect to PnP Online
    Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)
      
    #Define XML Schema for Choice Field
    $FieldXML= "<Field Type='Choice' Name='Status5' ID='$([GUID]::NewGuid())' DisplayName='Status 5' Required ='FALSE' EnforceUniqueValues = 'FALSE' Indexed='FALSE' Group='Site Visit Report' FillInChoice='FALSE' Format='RadioButtons'><CHOICES><CHOICE>Not Applicable</CHOICE><CHOICE>Satisfactory</CHOICE><CHOICE>Non-Conforming</CHOICE></CHOICES></Field>"
    $FieldXML2= "<Field Type='Choice' Name='Status6' ID='$([GUID]::NewGuid())' DisplayName='Status 6' Required ='FALSE' EnforceUniqueValues = 'FALSE' Indexed='FALSE' Group='Site Visit Report' FillInChoice='FALSE' Format='RadioButtons'><CHOICES><CHOICE>Not Applicable</CHOICE><CHOICE>Satisfactory</CHOICE><CHOICE>Non-Conforming</CHOICE></CHOICES></Field>"
    $FieldXML3= "<Field Type='Choice' Name='Status7' ID='$([GUID]::NewGuid())' DisplayName='Status 7' Required ='FALSE' EnforceUniqueValues = 'FALSE' Indexed='FALSE' Group='Site Visit Report' FillInChoice='FALSE' Format='RadioButtons'><CHOICES><CHOICE>Not Applicable</CHOICE><CHOICE>Satisfactory</CHOICE><CHOICE>Non-Conforming</CHOICE></CHOICES></Field>"
    $FieldXML4= "<Field Type='Choice' Name='Status8' ID='$([GUID]::NewGuid())' DisplayName='Status 8' Required ='FALSE' EnforceUniqueValues = 'FALSE' Indexed='FALSE' Group='Site Visit Report' FillInChoice='FALSE' Format='RadioButtons'><CHOICES><CHOICE>Not Applicable</CHOICE><CHOICE>Satisfactory</CHOICE><CHOICE>Non-Conforming</CHOICE></CHOICES></Field>"
    $FieldXML5= "<Field Type='Choice' Name='Status9' ID='$([GUID]::NewGuid())' DisplayName='Status 9' Required ='FALSE' EnforceUniqueValues = 'FALSE' Indexed='FALSE' Group='Site Visit Report' FillInChoice='FALSE' Format='RadioButtons'><CHOICES><CHOICE>Not Applicable</CHOICE><CHOICE>Satisfactory</CHOICE><CHOICE>Non-Conforming</CHOICE></CHOICES></Field>"
    $FieldXML6= "<Field Type='Choice' Name='Status10' ID='$([GUID]::NewGuid())' DisplayName='Status 10' Required ='FALSE' EnforceUniqueValues = 'FALSE' Indexed='FALSE' Group='Site Visit Report' FillInChoice='FALSE' Format='RadioButtons'><CHOICES><CHOICE>Not Applicable</CHOICE><CHOICE>Satisfactory</CHOICE><CHOICE>Non-Conforming</CHOICE></CHOICES></Field>"
    $FieldXML7= "<Field Type='Choice' Name='Status11' ID='$([GUID]::NewGuid())' DisplayName='Status 11' Required ='FALSE' EnforceUniqueValues = 'FALSE' Indexed='FALSE' Group='Site Visit Report' FillInChoice='FALSE' Format='RadioButtons'><CHOICES><CHOICE>Not Applicable</CHOICE><CHOICE>Satisfactory</CHOICE><CHOICE>Non-Conforming</CHOICE></CHOICES></Field>"
    $FieldXML8= "<Field Type='Choice' Name='Status12' ID='$([GUID]::NewGuid())' DisplayName='Status 12' Required ='FALSE' EnforceUniqueValues = 'FALSE' Indexed='FALSE' Group='Site Visit Report' FillInChoice='FALSE' Format='RadioButtons'><CHOICES><CHOICE>Not Applicable</CHOICE><CHOICE>Satisfactory</CHOICE><CHOICE>Non-Conforming</CHOICE></CHOICES></Field>"
    $FieldXML9= "<Field Type='Choice' Name='Status13' ID='$([GUID]::NewGuid())' DisplayName='Status 13' Required ='FALSE' EnforceUniqueValues = 'FALSE' Indexed='FALSE' Group='Site Visit Report' FillInChoice='FALSE' Format='RadioButtons'><CHOICES><CHOICE>Not Applicable</CHOICE><CHOICE>Satisfactory</CHOICE><CHOICE>Non-Conforming</CHOICE></CHOICES></Field>"
    $FieldXML10= "<Field Type='Choice' Name='Status14' ID='$([GUID]::NewGuid())' DisplayName='Status 14' Required ='FALSE' EnforceUniqueValues = 'FALSE' Indexed='FALSE' Group='Site Visit Report' FillInChoice='FALSE' Format='RadioButtons'><CHOICES><CHOICE>Not Applicable</CHOICE><CHOICE>Satisfactory</CHOICE><CHOICE>Non-Conforming</CHOICE></CHOICES></Field>"
    $FieldXML11= "<Field Type='Choice' Name='Status15' ID='$([GUID]::NewGuid())' DisplayName='Status 15' Required ='FALSE' EnforceUniqueValues = 'FALSE' Indexed='FALSE' Group='Site Visit Report' FillInChoice='FALSE' Format='RadioButtons'><CHOICES><CHOICE>Not Applicable</CHOICE><CHOICE>Satisfactory</CHOICE><CHOICE>Non-Conforming</CHOICE></CHOICES></Field>"
    $FieldXML12= "<Field Type='Choice' Name='Status16' ID='$([GUID]::NewGuid())' DisplayName='Status 16' Required ='FALSE' EnforceUniqueValues = 'FALSE' Indexed='FALSE' Group='Site Visit Report' FillInChoice='FALSE' Format='RadioButtons'><CHOICES><CHOICE>Not Applicable</CHOICE><CHOICE>Satisfactory</CHOICE><CHOICE>Non-Conforming</CHOICE></CHOICES></Field>"
    $FieldXML13= "<Field Type='Choice' Name='Status17' ID='$([GUID]::NewGuid())' DisplayName='Status 17' Required ='FALSE' EnforceUniqueValues = 'FALSE' Indexed='FALSE' Group='Site Visit Report' FillInChoice='FALSE' Format='RadioButtons'><CHOICES><CHOICE>Not Applicable</CHOICE><CHOICE>Satisfactory</CHOICE><CHOICE>Non-Conforming</CHOICE></CHOICES></Field>"
    $FieldXML14= "<Field Type='Choice' Name='Status18' ID='$([GUID]::NewGuid())' DisplayName='Status 18' Required ='FALSE' EnforceUniqueValues = 'FALSE' Indexed='FALSE' Group='Site Visit Report' FillInChoice='FALSE' Format='RadioButtons'><CHOICES><CHOICE>Not Applicable</CHOICE><CHOICE>Satisfactory</CHOICE><CHOICE>Non-Conforming</CHOICE></CHOICES></Field>"
    $FieldXML15= "<Field Type='Choice' Name='Status19' ID='$([GUID]::NewGuid())' DisplayName='Status 19' Required ='FALSE' EnforceUniqueValues = 'FALSE' Indexed='FALSE' Group='Site Visit Report' FillInChoice='FALSE' Format='RadioButtons'><CHOICES><CHOICE>Not Applicable</CHOICE><CHOICE>Satisfactory</CHOICE><CHOICE>Non-Conforming</CHOICE></CHOICES></Field>"
    $FieldXML16= "<Field Type='Choice' Name='Status20' ID='$([GUID]::NewGuid())' DisplayName='Status 20' Required ='FALSE' EnforceUniqueValues = 'FALSE' Indexed='FALSE' Group='Site Visit Report' FillInChoice='FALSE' Format='RadioButtons'><CHOICES><CHOICE>Not Applicable</CHOICE><CHOICE>Satisfactory</CHOICE><CHOICE>Non-Conforming</CHOICE></CHOICES></Field>"
      
    #Create Single Line of Choice site column
    Add-PnPFieldFromXml -FieldXml $FieldXML
    Add-PnPFieldFromXml -FieldXml $FieldXML2
    Add-PnPFieldFromXml -FieldXml $FieldXML3
    Add-PnPFieldFromXml -FieldXml $FieldXML4
    Add-PnPFieldFromXml -FieldXml $FieldXML5
    Add-PnPFieldFromXml -FieldXml $FieldXML6
    Add-PnPFieldFromXml -FieldXml $FieldXML7
    Add-PnPFieldFromXml -FieldXml $FieldXML8
    Add-PnPFieldFromXml -FieldXml $FieldXML9
    Add-PnPFieldFromXml -FieldXml $FieldXML10
    Add-PnPFieldFromXml -FieldXml $FieldXML11
    Add-PnPFieldFromXml -FieldXml $FieldXML12
    Add-PnPFieldFromXml -FieldXml $FieldXML13
    Add-PnPFieldFromXml -FieldXml $FieldXML14
    Add-PnPFieldFromXml -FieldXml $FieldXML15
    Add-PnPFieldFromXml -FieldXml $FieldXML16
    0
  • Andrew Kirby

    Many thanks. I'm not an IT professional, so might be a bit of a stretch.. Plus our system is really locked down by our remote IT company.  But.. what you show above doesn't look impossible for me with a bit of work...

    0

Please sign in to leave a comment.