SPFx Development with Docker & VS Code

Developing SharePoint Framework (SPFx) solutions requires a compatible version of Node.js, the SPFx generator and its associated build tools. Keeping these tools working together can become awkward when you work across multiple projects or need to switch between toolchain versions.

One way to simplify SPFx development is to use Docker and Visual Studio Code Dev Containers. Rather than installing Node.js and the SPFx toolchain directly on Windows, you run them inside a Linux container managed by Docker Desktop.

Although this guide targets Windows developers, the container uses Linux, with WSL 2 providing the underlying environment. VS Code connects directly to the container, allowing you to edit code, run commands and build solutions from your familiar development environment. In this article, we’ll set up a repeatable SPFx development environment using Docker Desktop, WSL 2 and VS Code.

Continue reading →
Posted in Development, Docker, SharePoint, SPFx, Visual Studio Code | Tagged , | Leave a comment

Developing a Provider-Hosted Add-In

Following on from the post detailing setting up a development environment for provider-hosted add-ins, let’s move on and walk through creating an add-in.

Start by creating a new “SharePoint Add-In”. Then give the solution a name and choose a save location, like you would any other project. Next, select Provider-hosted (not SharePoint-hosted). Next choose how to host the solution, either Web Forms or MVC. For this, I’ll be using Web Forms. Lastly, select to “Use a certificate”, as this is an example of developing an on-premise provider-hosted add-in. You will have all the details required for this if you followed my post on registering a self-signed certificate.

Continue reading →
Posted in .Net, Development, SharePoint, Visual Studio | Tagged , , | Leave a comment

Scripting Add-Ins for Deployment

Scripting the creation of SharePoint add-in packages is pretty straight forward. As I found there to be not very many posts on this topic, I thought I’d share how I implemented it.

To create and deploy is also easy from a developers box, all of this is achievable from inside Visual Studio.

The purpose of this post is to show how you would go about creating packages to be deployed on downstream environments.

I’m not going to go into the creation of certificates or the add-in client id. I’m going to take it for granted that if you’ve got to this stage, you already know how to do all of that.

Lets say you have a solution with one add-in and related web and you want to be able to script the creation of the packages to your UA environment.

Continue reading →
Posted in Deployment, SharePoint | Tagged , , , , | Leave a comment

Register Self-Signed Certificate

If you’re setting up your development environment for writing provider-hosted SharePoint add-ins, you need a register the SharePoint IIS certificate with the remote web used by the add-in(s). A quick and easy way to do this is to register a self-signed certificate and turn off the requirement for SSL over OAuth. This saves you having to create and register a SSL certificate, which isn’t really needed for SharePoint development.

Configuring your environment for developing provider-hosted add-ins, follow this post here.

Continue reading →
Posted in Configuration, SharePoint | Tagged , , , | Leave a comment

Unregistering an Add-in

Registering an add-in for SharePoint is easy enough. You go to the _layouts/appregnew.aspx page for the site and register the add-in.

Permissions are set when the add-in is installed on the site too. This happens after you’ve clicked Trust It when adding the add-in to a site.

To revoke the permissions for an add-in in a site is also straight forward. To do this, you go to the _layouts/appprincipals.aspx page and click the delete icon next to the add-in you want to revoke permissions for. Or for a specific web, add ?Scope=Web to the URL.

There’s no admin page for unregistering and add-in for a site though. To do this, we can run some PowerShell. This does require a hybrid installation where you still have access to the SharePoint farm itself and can run SharePoint PowerShell cmdlets.

Continue reading →
Posted in SharePoint | Tagged , | Leave a comment