We can retrieve a sitescript using m365 spo sitescript get --id <some-guid>.
The result is a JSON string stringified in a JSON string. There are a few downsides to this:
- It's bad for readability.
- You need to do more work to get at the real sitescript
- (maybe a bug) You'll often get escaped newline characters thrown in.
⚙️ The fix
In the new major version we want to fix the json string and just return the entire script as a json object in its parent metadata object:
{
"Content": {
"$schema": "https://developer.microsoft.com/json-schemas/sp/site-design-script-actions.schema.json",
"actions": [
{
"verb": "activateSPFeature",
"name": "SiteNotebook feature",
"title": "SiteNotebook feature",
"featureId": "f151bb39-7c3b-414f-bb36-6bf18872052f",
"scope": "web"
}
],
"bindata": {},
"version": 1
},
"ContentByteArray": null,
"Description": "Contoso site script",
"Id": "43d4ffa0-c7ee-4a97-91d7-db27e5b62de5",
"IsSiteScriptPackage": false,
"Title": "Contoso",
"Version": 1
}
Additional Info
Originally posted by @martinlingstuyl in #5549
We can retrieve a sitescript using
m365 spo sitescript get --id <some-guid>.The result is a JSON string stringified in a JSON string. There are a few downsides to this:
⚙️ The fix
In the new major version we want to fix the json string and just return the entire script as a json object in its parent metadata object:
{ "Content": { "$schema": "https://developer.microsoft.com/json-schemas/sp/site-design-script-actions.schema.json", "actions": [ { "verb": "activateSPFeature", "name": "SiteNotebook feature", "title": "SiteNotebook feature", "featureId": "f151bb39-7c3b-414f-bb36-6bf18872052f", "scope": "web" } ], "bindata": {}, "version": 1 }, "ContentByteArray": null, "Description": "Contoso site script", "Id": "43d4ffa0-c7ee-4a97-91d7-db27e5b62de5", "IsSiteScriptPackage": false, "Title": "Contoso", "Version": 1 }Additional Info
Originally posted by @martinlingstuyl in #5549