sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Site Design Create Content Type action gives an invalid type error

Open joshburnssp opened this issue 7 years ago • 6 comments

Category

  • [ ] Question
  • [ ] Typo
  • [x ] Bug
  • [ ] Additional article idea

Expected or Desired Behavior

When using the createContentType action in a site design I expect the content type to be created in the site that has been created from a site design which contains that site script.

Observed Behavior

When using a createContentType action from the Site Design json schema, I get: One or more of the properties on this action has an invalid type.

sitedesignerror

Steps to Reproduce

Put a script with the createContentType action in variable in PowerShell, I used the example of the Site Design document:

{ "verb": "createSiteColumn", "fieldType": "Text", "internalName": "To", "displayName": "To", "isRequired": false }, { "verb": "createSiteColumn", "fieldType": "Text", "internalName": "From", "displayName": "From", "isRequired": false }, { "verb": "createSiteColumn", "fieldType": "Text", "internalName": "CC", "displayName": "CC", "isRequired": false }, { "verb": "createSiteColumn", "fieldType": "Text", "internalName": "BCC", "displayName": "BCC", "isRequired": false }, { "verb": "createSiteColumn", "fieldType": "DateTime", "internalName": "SentOn", "displayName": "Sent On", "isRequired": false }, { "verb": "createSiteColumn", "fieldType": "DateTime", "internalName": "ReceivedTime", "displayName": "Received Time", "isRequired": false }, { "verb": "createSiteColumn", "fieldType": "Text", "internalName": "Importance", "displayName": "Importance", "isRequired": false }, { "verb": "createSiteColumn", "fieldType": "Text", "internalName": "AttachCount", "displayName": "Attach Count", "isRequired": false }, { "verb": "createSiteColumn", "fieldType": "Text", "internalName": "Sensivity", "displayName": "Sensitivity", "isRequired": false }, { "verb": "createSiteColumn", "fieldType": "Text", "internalName": "MessageID", "displayName": "Message ID", "isRequired": false }, { "verb": "createContentType", "name": "Email", "description": "Project Email", "parentName": "Item", "hidden": false, "subactions": [{ "verb": "addSiteColumn", "internalName": "To" }, { "verb": "addSiteColumn", "internalName": "From" }, { "verb": "addSiteColumn", "internalName": "CC" }, { "verb": "addSiteColumn", "internalName": "BCC" }, { "verb": "addSiteColumn", "internalName": "SentOn" }, { "verb": "addSiteColumn", "internalName": "ReceivedTime" }, { "verb": "addSiteColumn", "internalName": "Importance" }, { "verb": "addSiteColumn", "internalName": "AttachCount" }, { "verb": "addSiteColumn", "internalName": "Sensitivity" }, { "verb": "addSiteColumn", "internalName": "MessageID" } ] }

Submission Guidelines

Using the powershell scripts - Add-spositedesign etc

joshburnssp avatar Jan 18 '19 15:01 joshburnssp

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

msft-github-bot avatar Jan 18 '19 15:01 msft-github-bot

There appears to be a discrepancy between the script you posted and the script that running on your site design.

Notice the internal names of the columns in your site script. Now, look at the sub actions in the image you posted. The screen shot shows "Add site column HLTo to content type". This means it's looking for an internal field names that start with HLTo... but in your createSiteColumn, the internal name is "To". The site script you posted is valid, but it's not the one that is being executed in your site design.

The error is not super helpful, but it's the error that shows up when trying to add a site column that doesn't exist.

To verify, call Get-SPOSiteScript and compare that site script to the one you posted.

If it is different, set the site script again with your new script json posted using Set-SPOSiteScript

bcameron1231 avatar Jan 18 '19 18:01 bcameron1231

Hi Beau,

thanks for your response, my mistake. I have gone through and updated the site script so that all of the internal names are now matching.

Unfortunately i am still receiving the same error...

image

Script is { "verb": "createSiteColumn", "fieldType": "Text", "internalName": "To", "displayName": "To", "isRequired": false }, { "verb": "createSiteColumn", "fieldType": "Text", "internalName": "From", "displayName": "From", "isRequired": false }, { "verb": "createSiteColumn", "fieldType": "Text", "internalName": "CC", "displayName": "CC", "isRequired": false }, { "verb": "createSiteColumn", "fieldType": "Text", "internalName": "BCC", "displayName": "BCC", "isRequired": false }, { "verb": "createSiteColumn", "fieldType": "DateTime", "internalName": "SentOn", "displayName": "Sent On", "isRequired": false }, { "verb": "createSiteColumn", "fieldType": "DateTime", "internalName": "ReceivedTime", "displayName": "Received Time", "isRequired": false }, { "verb": "createSiteColumn", "fieldType": "Text", "internalName": "Importance", "displayName": "Importance", "isRequired": false }, { "verb": "createSiteColumn", "fieldType": "Text", "internalName": "AttachCount", "displayName": "Attach Count", "isRequired": false }, { "verb": "createSiteColumn", "fieldType": "Text", "internalName": "HLSensivity", "displayName": "Sensitivity", "isRequired": false }, { "verb": "createSiteColumn", "fieldType": "Text", "internalName": "MessageID", "displayName": "Message ID", "isRequired": false }, { "verb": "createContentType", "name": "Email", "description": "HL Project Email", "parentName": "Item", "hidden": false, "subactions": [{ "verb": "addSiteColumn", "internalName": "To" }, { "verb": "addSiteColumn", "internalName": "From" }, { "verb": "addSiteColumn", "internalName": "CC" }, { "verb": "addSiteColumn", "internalName": "BCC" }, { "verb": "addSiteColumn", "internalName": "SentOn" }, { "verb": "addSiteColumn", "internalName": "ReceivedTime" }, { "verb": "addSiteColumn", "internalName": "Importance" }, { "verb": "addSiteColumn", "internalName": "AttachCount" }, { "verb": "addSiteColumn", "internalName": "Sensitivity" }, { "verb": "addSiteColumn", "internalName": "MessageID" } ] },

Thanks again.

joshburnssp avatar Jan 21 '19 09:01 joshburnssp

I would double check, it looks like you missed HLSensitivity.

bcameron1231 avatar Jan 21 '19 14:01 bcameron1231

🤦

bad spelling, many apologies and thanks :)

Josh

joshburnssp avatar Jan 21 '19 14:01 joshburnssp

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

msft-github-bot avatar Jan 25 '20 12:01 msft-github-bot