SOLVED

Updating Site Scripts in SPO

%3CLINGO-SUB%20id%3D%22lingo-sub-294794%22%20slang%3D%22en-US%22%3EUpdating%20Site%20Scripts%20in%20SPO%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-294794%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20site%20script%20I%20am%20using%20that%20creates%20a%20site%20column%20for%20any%20site%20using%20the%20Site%20Script.%20The%20issue%20I%20am%20running%20into%20is%20that%20I%20want%20to%20update%20the%20Site%20Column%20via%20the%20script%20but%20I%20am%20not%20getting%20it%20to%20work.%20Is%20there%20a%20way%20to%20do%20this%20programmatically%20so%20that%20I%20wouldn't%20have%20to%20go%20in%20to%20all%20sites%20using%20the%20column%20and%20update%20it%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-294794%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-294902%22%20slang%3D%22en-US%22%3ERe%3A%20Updating%20Site%20Scripts%20in%20SPO%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-294902%22%20slang%3D%22en-US%22%3E%3CP%3EI%20had%20just%20found%20that%20blog%20before%20you%20posted%20and%20ran%20step%205%20to%20invoke%20the%20site%20design%20on%20the%20existing%20site.%20The%20problem%20is%20that%20it%20creates%20everything%20a%202nd%20time%20rather%20than%20just%20updating%20the%20information%20in%20the%20Site%20column%20that%20was%20already%20created.%20That%20doesn't%20quite%20do%20what%20I%20am%20looking%20for.%20I%20just%20want%20to%20be%20able%20to%20run%20the%20script%20and%20apply%20it%20to%20the%20site(s)%20using%20it%20to%20have%20columns%20or%20content%20types%20updated%20rather%20than%20created%20a%202nd%20time.%20If%20it%20just%20creates%20them%20again%2C%20it%20does%20nothing%20to%20help%20us%20with%20our%20Information%20Architecture.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-294887%22%20slang%3D%22en-US%22%3ERe%3A%20Updating%20Site%20Scripts%20in%20SPO%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-294887%22%20slang%3D%22en-US%22%3EYeap%2C%20take%20a%20look%20here%3A%20%3CA%20href%3D%22http%3A%2F%2Fdevjhorst.blogspot.com%2F2018%2F03%2Fsharepoint-site-design-and-site-script.html%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fdevjhorst.blogspot.com%2F2018%2F03%2Fsharepoint-site-design-and-site-script.html%3C%2FA%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-294866%22%20slang%3D%22en-US%22%3ERe%3A%20Updating%20Site%20Scripts%20in%20SPO%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-294866%22%20slang%3D%22en-US%22%3E%3CP%3ESorry%2C%20I%20meant%20through%20Powershell.%20Do%20I%20have%20to%20reapply%20to%20the%20existing%20site%3F%20I%20have%20not%20tried%20that%20yet%20or%20done%20a%20search%20for%20commands.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-294845%22%20slang%3D%22en-US%22%3ERe%3A%20Updating%20Site%20Scripts%20in%20SPO%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-294845%22%20slang%3D%22en-US%22%3EWhat%20specific%20problem%20are%20you%20having%3F%20Site%20scripts%20are%20designed%20so%20you%20can%20apply%20them%20also%20on%20existing%20sites...but%20not%20sure%20if%20you%20can%20apply%20them%20also%20programmatically...normally%20PowerShell%20is%20used%20for%20that%20task%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2006231%22%20slang%3D%22en-US%22%3ERe%3A%20Updating%20Site%20Scripts%20in%20SPO%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2006231%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F160575%22%20target%3D%22_blank%22%3E%40Joe%20Volk%3C%2FA%3E%26nbsp%3Byou%20need%20to%20specify%20the%20fields%20id's%20in%20order%20to%20prevent%20them%20to%20be%20recreated%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eexample%3A%3C%2FP%3E%3CPRE%3E%7B%0A%20%20%3CSPAN%20class%3D%22pl-s%22%3E%3CSPAN%20class%3D%22pl-pds%22%3E%22%3C%2FSPAN%3Everb%3CSPAN%20class%3D%22pl-pds%22%3E%22%3C%2FSPAN%3E%3C%2FSPAN%3E%3A%20%3CSPAN%20class%3D%22pl-s%22%3E%3CSPAN%20class%3D%22pl-pds%22%3E%22%3C%2FSPAN%3EcreateSiteColumn%3CSPAN%20class%3D%22pl-pds%22%3E%22%3C%2FSPAN%3E%3C%2FSPAN%3E%2C%0A%20%20%3CSPAN%20class%3D%22pl-s%22%3E%3CSPAN%20class%3D%22pl-pds%22%3E%22%3C%2FSPAN%3EfieldType%3CSPAN%20class%3D%22pl-pds%22%3E%22%3C%2FSPAN%3E%3C%2FSPAN%3E%3A%20%3CSPAN%20class%3D%22pl-s%22%3E%3CSPAN%20class%3D%22pl-pds%22%3E%22%3C%2FSPAN%3EUser%3CSPAN%20class%3D%22pl-pds%22%3E%22%3C%2FSPAN%3E%3C%2FSPAN%3E%2C%0A%20%20%3CSPAN%20class%3D%22pl-s%22%3E%3CSPAN%20class%3D%22pl-pds%22%3E%22%3C%2FSPAN%3EinternalName%3CSPAN%20class%3D%22pl-pds%22%3E%22%3C%2FSPAN%3E%3C%2FSPAN%3E%3A%20%3CSPAN%20class%3D%22pl-s%22%3E%3CSPAN%20class%3D%22pl-pds%22%3E%22%3C%2FSPAN%3EsiteColumn4User%3CSPAN%20class%3D%22pl-pds%22%3E%22%3C%2FSPAN%3E%3C%2FSPAN%3E%2C%0A%20%20%3CSPAN%20class%3D%22pl-s%22%3E%3CSPAN%20class%3D%22pl-pds%22%3E%22%3C%2FSPAN%3EdisplayName%3CSPAN%20class%3D%22pl-pds%22%3E%22%3C%2FSPAN%3E%3C%2FSPAN%3E%3A%20%3CSPAN%20class%3D%22pl-s%22%3E%3CSPAN%20class%3D%22pl-pds%22%3E%22%3C%2FSPAN%3EProject%20Owner%3CSPAN%20class%3D%22pl-pds%22%3E%22%3C%2FSPAN%3E%3C%2FSPAN%3E%2C%0A%20%20%3CSPAN%20class%3D%22pl-s%22%3E%3CSPAN%20class%3D%22pl-pds%22%3E%22%3C%2FSPAN%3EisRequired%3CSPAN%20class%3D%22pl-pds%22%3E%22%3C%2FSPAN%3E%3C%2FSPAN%3E%3A%20%3CSPAN%20class%3D%22pl-c1%22%3Efalse%3C%2FSPAN%3E%2C%0A%20%20%3CSPAN%20class%3D%22pl-s%22%3E%3CSPAN%20class%3D%22pl-pds%22%3E%22%3C%2FSPAN%3Eid%3CSPAN%20class%3D%22pl-pds%22%3E%22%3C%2FSPAN%3E%3C%2FSPAN%3E%3A%20%3CSPAN%20class%3D%22pl-s%22%3E%3CSPAN%20class%3D%22pl-pds%22%3E%22%3C%2FSPAN%3E181c4370-cdae-471b-9499-730046e55b75%3CSPAN%20class%3D%22pl-pds%22%3E%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%7D%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
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"
}