The process of building custom applications and tools that interact with Microsoft SharePoint, including SharePoint Online in Microsoft 365.
Please note that our forum is a public platform, and we will modify your question to hide your personal information in the description. Kindly ensure that you hide any personal or organizational information the next time you post an error or other details to protect personal data.
Hi KarthikeyanBalasubramani-1991
The error you are encountering is expected due to the recent tightening of Content Security Policy (CSP) controls in SharePoint Online. Inline scripts and patterns such as unsafe-eval are no longer permitted, and Microsoft is enforcing stricter security measures across all tenants. This is aligned with updated CSP requirements, where overly permissive directives like unsafe-inline and unsafe-eval are not supported.
Ref: Support for Content Security Policy (CSP) in SharePoint Online | Microsoft Learn
While splitting the HTML, JavaScript, and CSS into separate files may have worked temporarily, this approach is not fully compliant with CSP. Even when scripts are referenced externally, execution patterns such as inline handlers or dynamic evaluation can still trigger violations.
Additionally, using custom script injection is no longer recommended due to security considerations. As CSP enforcement moves towards full blocking mode starting from June 1st, 2026, these approaches will continue to fail. Security considerations of allowing custom script - SharePoint in Microsoft 365 | Microsoft Learn
For the official and long-term supported approach, Microsoft recommend migrating to SharePoint Framework (SPFx) and using Trusted Script Sources (if applicable).
I hope this information helps.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.