Site Scripts and Hyperlink/Picture Site Columns

Copper Contributor

I am developing a site script to create some site columns and content types.  Mostly it is working OK, but I'm having trouble figuring out how to use the createSiteColumnXml verb to create a hyperlink/picture field.  First I tried this:

"schemaXml": "<Field Type=\"Url\" DisplayName=\"MsgImage\" Required=\"FALSE\" Format=\"Image\" StaticName=\"MsgImage\" Name=\"MsgImage\" Group=\"_ActsCustom\"></Field>"
 

That didn't work.  After some additional research I thought maybe I needed to include a value for ID, so I generated a GUID and changed it to:

 

"schemaXml": "<Field Type=\"Url\" DisplayName=\"MsgImage\" Required=\"FALSE\" Format=\"Image\" StaticName=\"MsgImage\" Name=\"MsgImage\" Group=\"_ActsCustom\" ID=\"{23ed08db-f248-42ef-9ea7-d615fdeca8c2}\"></Field>"
 
That fails as well.  Any ideas how I should modify this to make it work?
4 Replies

@Gary_Stewart  I don't believe you can create that type of column in site scripts at the moment.  This is a good tool to see what is available at the moment https://www.sitedesigner.io

@Tanya Denton thanks.  That is a pretty handy tool.

@Gary_Stewart I would suggest creating the the picture field on a list and using PowerShell command "Get-SPOSiteScriptFromList" to extract out the values you need. 

"schemaXml": "<Field DisplayName=\"TestPicture\" Format=\"Image\" Name=\"TestPicture\
" Title=\"TestPicture\" Type=\"URL\" ID=\"{6f2db82c-f1a6-415d-9678-324b1d809f17}\" StaticName=\
"TestPicture\" />"

@Gary_Stewart I got this working for URL fields:

 

{
"verb": "addSPFieldXml",
"schemaXml":"<Field Type=\"URL\" DisplayName=\"Website\" Required=\"FALSE\" Format=\"Hyperlink\" StaticName=\"Website\" Name=\"Website\"></Field>",
"addToDefaultView": true
},