Create UserCustomAction for SharePoint Framework Extensions (Tenant-Scoped)
-
02-01-2021 - |
Question
I have created a SPFx Extension (Application Customizer - Tenant Scoped) and I have uploaded it to the App Catalog succesfully.
Now I'm trying to add it in a Site creating a UserCustomAction, but I'm getting the next error:
'ClientSideComponentId and ClientSideComponentProperties are not supported for actions that are not used for client-side extensions.'
This is the code for the creation of the UserCustomAction:
...
// var colCustomActions = cc.Web.UserCustomActions; // << also tried in the web
var colCustomActions = cc.Site.UserCustomActions;
var newCustomAction = colCustomActions.Add();
newCustomAction.ClientSideComponentId = new Guid(guidFromTheManifest);
newCustomAction.ClientSideComponentProperties = "";
newCustomAction.Update();
cc.ExecuteQueryRetry();
Any hints? Do you have an example of the code for the creation of the UserCustomAction?
Thank you very much in advance.
Best regards.
La solution
This line was missing, the location property:
newCustomAction.Location = "ClientSideExtension.ApplicationCustomizer";
:)
Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange