Updated SPFx Content Slider Code for GA

I recently wrote about converting your Content Editor Web Part and Script Editor Web Part customizations to SharePoint Framework Client Web Parts:

Converting your CEWP Customizations to the SharePoint Framework

Since then, the SharePoint Framework has gone GA (General Availability) and there were quite a few changes made. I needed to recreate the project for it to work properly.

The one major change that broke my project was the removal of the spPageContextInfo object in RC0 which was previously used to get the URL of the website for REST queries… …I ended up getting the website URL from the pageContext object (this.context.pageContext.site.absoluteUrl) and passing that information as a parameter to my JavaScript file

You can find the updated project in the same location at https://github.com/mrackley/PAITSliderSPFx

For the most part I simply had to create a new SPFx project and then manually copy over the functionality as I did in the video from my previous blog post. The one major change that broke my project was the removal of the spPageContextInfo object in RC0 which was previously used to get the URL of the website for REST queries. For the updated project, I ended up getting the website URL from the pageContext object (this.context.pageContext.site.absoluteUrl) and passing that information as a parameter to my JavaScript file.

Leave Comment

Your email address will not be published. Required fields are marked *