SharePoint Framework Context Explorer web part

image.png

The new SharePoint Framework developer preview is available now and you can check out how to get started over in the Microsoft GitHub repo here: https://github.com/SharePoint/sp-dev-docs/wiki

Follow through the setup and tutorials if you’re new to the SPFx and how it all hangs together.

With the new SPFx we get given a context object as part of the core which provides properties we can leverage inside our web part. This example is super simple and is aimed just to provide an easy to consume view of the context.

The full technical document is found  here

We can run the web part in the WorkBench hosted on localhost to see something like this

image

 

When we run the same web part within a SharePoint online hosted WorkBench it updates to show something like this

image

Extend the render

We inject some additional code into the render method to display the various properties.

Helper functions

There are a couple of additional functions to help deal with the objects and enums.

Clone and extend

Hopefully this will help you get familiar with some of the properties you have access to. Feel free to clone the code from my repo SPFx Context Explorer Repo.

Smile

Leave a Reply

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