Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
SharePoint Development with the SharePoint Framework

You're reading from   SharePoint Development with the SharePoint Framework Design and implement state-of-the-art customizations for SharePoint

Arrow left icon
Product type Paperback
Published in Sep 2017
Publisher Packt
ISBN-13 9781787121430
Length 386 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Authors (2):
Arrow left icon
Jussi Roine Jussi Roine
Author Profile Icon Jussi Roine
Jussi Roine
Olli Jääskeläinen Olli Jääskeläinen
Author Profile Icon Olli Jääskeläinen
Olli Jääskeläinen
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Introducing SharePoint Online for Developers FREE CHAPTER 2. Developing Solutions for SharePoint 3. Getting Started with the SharePoint Framework 4. Building Your First Web Part 5. Using Visual Studio Code and Other Editors 6. Packaging and Deploying Solutions 7. Working with SharePoint Content 8. Working with the Web Part Property Pane 9. Using React and Office UI Fabric React Components 10. Working with Other JavaScript Frameworks 11. Troubleshooting and Debugging SharePoint Framework Solutions 12. SharePoint APIs and Microsoft Graph 13. The Future of SharePoint Customizations

SharePoint Online--add-ins and client-side scripts

In addition to add-ins, developers often need to drop small functionality and bits of features to individual pages within SharePoint sites. A common approach is to add a Script Editor Web Part on a page and drop a piece of JavaScript and/or HTML within the page. This is a very simple approach but can be both powerful and troublesome in the long run.

The benefits of using a Script Editor Web Part (SEWP) is that it's very easy to add as an ad-hoc solution when in a meeting with the site owner and simply code on-the-fly whatever is needed. This is assuming the developer is quite capable and fluent with JavaScript and the SharePoint APIs.

Adding a SEWP on a page allows developers to write JavaScript through the browser and save it into SharePoint Online's own database:

Upon page load, the script is executed and the user gets the result of the preceding code in a popup since the sample is using the classic JavaScript alert() message box:

The downside is that pages tend to become littered with all sorts of small JavaScript tidbits that no-one can keep track of. One piece of code could reference an external library that has a locally stored copy of a SharePoint document library, while another piece of code (even on the same page!) might reference the very same external library but a different version through a public CDN URI. Thus, the payload for a user loading the page would be at least double, as the client browser would need to resolve both external frameworks, load the payload, and figure out which version to use and when. Imagine having hundreds of sites, thousands of pages, with customizations using the SEWP-approach on five percent of all pages. You very quickly run into performance and supportability issues, as well as troubleshooting errors that are not obvious as frameworks are not referenced in a proper manner.

You have been reading a chapter from
SharePoint Development with the SharePoint Framework
Published in: Sep 2017
Publisher: Packt
ISBN-13: 9781787121430
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime