Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
SharePoint CSOM
Developer environment
None
What browser(s) / client(s) have you tested
Additional environment details
- Microsoft Edge 143.0.3650.80
Describe the bug / error
There is an error on the documentation page Support for Content Security Policy (CSP) in SharePoint Online.
In the section Can I update the trusted script sources list using script or code? contains an example of code using CSOM.
// cc is the CSOM ClientContext instance you've created for your tenant admin url
Tenant tenant = new Tenant(cc);
// Get trusted sources
var cspTrustedSources = tenant.GetContentSecurityPolicy();
cc.Load(cspTrustedSources);
cc.ExecuteQuery();
// Add trusted source
cspTrustedSources.Add("https://cdn.host.com/source/");
cc.ExecuteQuery();
// Remove trusted source
cspTrustedSources.Remove("https://cdn.host.com/source/");
cc.ExecuteQuery();
I tried to use it with the Microsoft.SharePointOnline.CSOM nuget package version 16.1.26914.12004 (release date is January 30). There is no method GetContentSecurityPolicy() inside Tenant.
There is no method GetContentSecurityPolicy() in CSOM documentation.
Steps to reproduce
- Go to https://learn.microsoft.com/en-us/sharepoint/dev/spfx/content-securty-policy-trusted-script-sources#can-i-update-the-trusted-script-sources-list-using-script-or-code
- Try to use CSOM code example.
Expected behavior
A working code example should be written in the documentation. Or a special version of CSOM should be specified in which this code will work.
Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
SharePoint CSOM
Developer environment
None
What browser(s) / client(s) have you tested
Additional environment details
Describe the bug / error
There is an error on the documentation page Support for Content Security Policy (CSP) in SharePoint Online.
In the section Can I update the trusted script sources list using script or code? contains an example of code using CSOM.
I tried to use it with the Microsoft.SharePointOnline.CSOM nuget package version 16.1.26914.12004 (release date is January 30). There is no method GetContentSecurityPolicy() inside Tenant.
There is no method GetContentSecurityPolicy() in CSOM documentation.
Steps to reproduce
Expected behavior
A working code example should be written in the documentation. Or a special version of CSOM should be specified in which this code will work.