SOLVED

Updating Site Scripts in SPO

Brass Contributor

I have a site script I am using that creates a site column for any site using the Site Script. The issue I am running into is that I want to update the Site Column via the script but I am not getting it to work. Is there a way to do this programmatically so that I wouldn't have to go in to all sites using the column and update it?

5 Replies
What specific problem are you having? Site scripts are designed so you can apply them also on existing sites...but not sure if you can apply them also programmatically...normally PowerShell is used for that task

Sorry, I meant through Powershell. Do I have to reapply to the existing site? I have not tried that yet or done a search for commands.

I had just found that blog before you posted and ran step 5 to invoke the site design on the existing site. The problem is that it creates everything a 2nd time rather than just updating the information in the Site column that was already created. That doesn't quite do what I am looking for. I just want to be able to run the script and apply it to the site(s) using it to have columns or content types updated rather than created a 2nd time. If it just creates them again, it does nothing to help us with our Information Architecture.

best response confirmed by Beau Cameron (MVP)
Solution

@Joe Volk you need to specify the fields id's in order to prevent them to be recreated

 

example:

{
  "verb": "createSiteColumn",
  "fieldType": "User",
  "internalName": "siteColumn4User",
  "displayName": "Project Owner",
  "isRequired": false,
  "id": "181c4370-cdae-471b-9499-730046e55b75"
}
1 best response

Accepted Solutions
best response confirmed by Beau Cameron (MVP)
Solution

@Joe Volk you need to specify the fields id's in order to prevent them to be recreated

 

example:

{
  "verb": "createSiteColumn",
  "fieldType": "User",
  "internalName": "siteColumn4User",
  "displayName": "Project Owner",
  "isRequired": false,
  "id": "181c4370-cdae-471b-9499-730046e55b75"
}

View solution in original post