spo customaction set with --clientSideComponentProperties param results in invalid JSON object
See original GitHub issueRunning the command:
o365 spo customaction set -u https://<tenant>.sharepoint.com/sites/<site> -i<id> -s Web -p '{"testMessage":"Test message"}'
Results in the following when running the corresponding get command:
o365 spo customaction get -u https://<tenant>.sharepoint.com/sites/<site>-i <id> -s Web -o JSON
ClientSideComponentId : <id>
ClientSideComponentProperties: '{testMessage:Test message}'
CommandUIExtension : null
Description : null
Group : null
Id : <customActionId>
ImageUrl : null
Location : ClientSideExtension.ApplicationCustomizer
Name : {<customActionId>}
RegistrationId : null
RegistrationType : 0
Rights : {"High":"0","Low":"0"}
Scope : Web
ScriptBlock : null
ScriptSrc : null
Sequence : 65536
Title : <customActionTitle>
Url : null
VersionOfUserCustomAction : 0.9.22.9201
Expected behaviour:
- The value of the
ClientSideComponentPropertiesproperty should be a valid JSON object - When the value is parsed by SPFx app customizer code that inherits from the
BaseApplicationCustomizerobject - thepropertiesobject should be hydrated with the “testMessage” value.
Observed behaviour:
- The value of the
ClientSideComponentPropertiesproperty is not a valid JSON object - The value parsed by the SPFx app customizer code inheriting
BaseApplicationCustomizer- thepropertiesobject has no properties
I suspect the above behaviour might be due to the way a POST to the _api/<scope>/UserCustomActions end point processes the ClientSideComponentProperties payload, and not the way the parameter is parsed by spo customaction set - but wanted to raise it here first to see if there’s anything that can be done in office365-cli
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (14 by maintainers)
Top Results From Across the Web
spo customaction set with --clientSideComponentProperties ...
Running the command: o365 spo customaction set -u https:// .sharepoint.com/sites/ -i -s Web -p ... param results in invalid JSON object #625.
Read more >IonFar.SharePoint.PowerShell
Returns a GUID that represents information about the full name of a person who is referenced in a specified Windows SharePoint Services contact...
Read more >spfx - How does one pass parameters to SharePoint ...
To set the properties that are passed into a field customizer for a particular list, set the field's ClientSideComponentProperties to the JSON ......
Read more >Migrating from UserCustomAction to SharePoint Framework ...
Migrate from old "classic" customizations (CustomAction) to the new model based on SharePoint Framework extensions.
Read more >SharePoint Online: How to Inject Custom CSS in Modern Sites?
sppkg file to tenant App catalog; Activate the SPFx Application customizer to the site through custom action. Step 1: Create a Custom CSS...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

From what I’ve seen, the first part of processing quotes happens already in the shell so if incorrectly quoted JSON string is passed into the CLI, it might be tough to make something out of it.
Here are my findings for tonight: Windows 8.1
Works for:
Does not work for:
{"ClientSideComponentProperties":"{"}I managed to make it work with the Windows PowerShell using:
Body request is
Seems the web service is able to convert single quote successfully, but this is pure luck.
Will keep you posted if I find the secret formula for PowerShell.exe
UPDATE: The node command prompt worked with both (Nodejs v8.9.1):