How do I figure out the path to CDN?
-
08-02-2021 - |
Pregunta
I am following this article to deploy add a script editor extension:
I've activated my CDN and I can build using --ship and deploy web parts or extensions to my SharePoint Online App Catalog and add them successfully in my pages.
The only problem is: I don't know the path to my CDN is.
I know I have enabled Office 365 public CDN and that I am using it but I don't know how to fill this:
"cdnBasePath": "-- PATH TO CDN --"
in the step 2 of the aforementioned article.
Solución
The CDN path can be configured in three ways :
- Azure CDN
- Office 365 Public CDN
- SharePoint Library in your tenant
How to configure the CDN in Office 365?
Follow the below steps:
Download and install the latest version of SharePoint Online Management Shell from https://www.microsoft.com/en-us/download/details.aspx?id=35588
Open the SharePoint Online Management Shell
Connect to SharePoint Online tenant using below cmdlet
Connect-SPOService -Url https://[tenant]-admin.sharepoint.com
Run below set of commands to review the existing Office 365 Public CDN settings on your tenant
Get-SPOTenantCdnEnabled -CdnType Public
How to Update CDN Path in the SPFx project file?
Open write-manifests.json from config folder
Update CDN base path as Office 365 CDN end point
https://publiccdn.sharepointonline.com/[tenant]/sites/[site-collection-name]/[document-library]/[folder]
Using the below command Prepare the package
gulp bundle --ship
Using the below command Deploy Package to SharePoint
gulp package-solution --ship
For details refer to the below article :
SharePoint Framework - Deploy SPFx WebParts To Office 365 Public CDN
Otros consejos
Path of CDN you have to pick, basically it is the location where all you files stored. it can be anywhere inside your site collection, as in your reference blogs, he created a new folder "CDN" inside the Site assets library.
You can do the same, go to your site collection > site content > Site assets > Now create a Folder "CDN" no use that path. it will be like this "https://tenantname.sharepoint.com/sites/Sitecollectionname/siteassets/CDN
"