5 Things SharePoint Client Side Developers Should Stop Doing Immediately (5/5)

Posted by: Mark Rackley on February 17, 2017

…in order to prepare for Modern sites, pages, and the SharePoint mobile application.

Woo hoo! We finally made it. Day 5… with all of our fingers and toes intact. What do you think of the format? Love it? Hate it? Personally I like it because it gets me blogging more often without the concern of writing a long blog post. But hey, if you don’t like it I offer a money back guarantee for the cost of the blog. :)

Let’s get things wrapped up. Yesterday we talked about why you should stop manipulating the DOM. Today we’ll take things one step further and explain that in order to be fully equipped for that modern team site, pages and mobile application you should really stop…

Using CEWP and Script Editor Web Parts to inject script

Wait a second… didn’t I tell you on day 1 that you SHOULD use Content Editor Web Parts and Script Editor Web Parts to get your scripts on the page? Yes, Yes I did, and that’s the perfect way to get you out of SharePoint Designer and ready for the next big thing. Getting used to using CEWP’s for your client side development tasks not only makes your solutions easier to maintain, upgrade, and deploy, but it also works in SharePoint 2007, 2010, 2013, 2016, and on classic pages in Office 365. This is something you can start doing today, no matter what platform you are on, to make your life easier if you were previously creating and editing pages in SharePoint Designer. Heck, using this method you can even get away from using SharePoint Hosted Add-Ins if you don’t need the extra benefits that SharePoint Hosted Add-Ins give you.

So, are CEWP’s good or bad? They are good, but the new modern sites and pages do not have a CEWP or Script Editor Web Part. So, you won’t be able to rely on them for those scenarios…

Instead you should…

As I mentioned earlier Microsoft has given us new tools to work with the modern pages. Chief among these is the SharePoint Framework (SPFx). Using the SharePoint Framework developers can create Client Side Web Parts that replicate the same functionality as our previous CEWP customizations. In fact, I put together a blog post on how you can convert one of your customizations to the SPFx (yes, I need to update it for RC0, but you can get an idea for how easy it can be).  If you want to get down to it, you could even create a SPFx client web part that does the same thing as a CEWP and I’d bet a billion dollars that someone will do so (if they haven’t already).

So, your previous CEWP customizations were not wasted efforts by any means, you’ll be able to reuse these with a little bit of work. However, you really should learn how to develop in the SharePoint Framework to be ready for the modern sites and pages.

There you have it folks, 5 ways you can change what you are doing today to better prepare for tomorrow.

But… What if I don’t WANT to use the new Modern Sites and Pages?

First of all, you are not alone. Many people prefer the classic look for many reasons including the fact that you do lose so many web parts and some functionality. The good news is, you don’t HAVE to use the Modern Sites and Pages. You can stick with the “Classic” view so that you don’t have to change the way you are working today. However, if want to fully embrace the new SharePoint Mobile application, you’ll need to embrace the new Modern pages and sites.

You can force the Classic view under the Settings section in the SharePoint Admin section of your Office 365 Admin Panel. You can also specify the classic look as a setting in your lists and libraries. If you accidentally switch a page to classic view and want to switch it back all you have to do is clear your cookies and reload the page.

Microsoft has stated on more than one occasion that they have no plans to get rid of the classic views. What this says to me is that they are looking at telemetry and when enough people stop using the classic views they will get phased out. So, I urge people that love the classic view to keep using the classic view!

Okay Then, What Should I Do Next?

No matter what version of SharePoint you are currently using I do encourage you to stop editing pages in SharePoint Designer and putting script references in your master page. Use Content Editor Web Parts and Script editor web parts to get script on a page so that the page is maintainable and if you need it, create a custom page layout. Use Custom Actions to reference scripts instead of putting them in your master page. You will be much better positioned for the future, whatever it may be.

For those on SharePoint Online or planning to go to SharePoint 2016 (with feature packs) you really need to invest the time to learn to use the SharePoint Framework. One important note. SharePoint Framework Client Web Parts work on both Modern and Classic pages. How cool is that? Plus, by using Client Web Parts you get a lot of benefits over using CEWP’s like a web part properties panel so you can allow users to customize your script’s settings without having to edit the script (this is huge). You also get things like script isolation, and a much better deployment and maintenance story. If you are using SharePoint Online you REALLY should learn the SharePoint Framework.

For most developers learning the SharePoint Framework is going to be a daunting task. If you are a traditional .NET developer, the open source tooling is going to be a hurdle. If you are a CEWP JavaScript developer, TypeScript and the open source tooling is going to be a substantial hurdle. There is hope though. There’s a lot of great blog content out there from people like Waldek Mastykarz and Chris O’Brien as well as other folks. In Addition, SharePoint legend (that’s another way of saying old fart) Andrew Connell has a great course on “Mastering the SharePoint Framework” over at Voitanos. I do recommend that you get some training on the SPFx unless you really are a glutton for punishment as it is such a different way of creating web parts for SharePoint.

We are at a crossroads with SharePoint. Be prepared for your future whether you choose Classic or Modern. Take steps now to allow your organization to better prepare for the future and reduce the headaches that will be coming. It’s no longer the wild west of SharePoint development.  This comes with some growing pains, but in the end we could all use a little law and order to help ensure success not just today, but for tomorrow and whatever comes next.

Thanks for going on this journey with me!

Topics: SharePoint, SharePoint Framework, Office 365, JavaScript, SPFx

    Recent Posts

    Categories