Skip to content

Adding SharePoint Integration to the Employee Self-Service Portal Without Server-side Code – Part 1

Nicholas Hayduk August 15, 2018 2 Min.To Read

In this series I’m going to step through how you can add an integration with SharePoint to the Employee Self-Service Portal in Dynamics 365 without using server-side code. While the recent news that the October ’18 release of the Portal capabilities for Dynamics 365 with include out-of-the-box SharePoint integration may make this series obsolete in a hurry, I’m sharing it as it might inspire other solutions that can leverage the same techniques.

Why the Employee Self-Service Portal?

In order to interact with SharePoint without using server-side code, we’re going to use the SharePoint REST API and call it directly from JavaScript on our portal. Obviously SharePoint requires that these requests be authenticated – anonymous users don’t have access to use the SharePoint REST API.

While, in theory, we could hard-code credentials into our JavaScript, this would be bad practice. Therefore, we want to leverage the user’s existing session to allow us to access SharePoint. This only works if the user is logged in via Azure AD, with a user account that has SharePoint privileges.

So, if we’re assuming that the user has to use Azure AD to log into the portal, this means the most likely scenario is that you’re implementing employee self-service.

To be clear, there is no reason you couldn’t use this technique on any of the portals, as long as you’re using Azure AD for authentication. You could also, in theory, only show the SharePoint integration pieces if the user is logged in to Azure AD, and hide it for everyone else. But I’m not going to explore that in this series.

Our Sample Scenario and Prerequisites

In this series, we’re going to add the ability to view SharePoint documents related to a case as exposed in the Employee Self-Service Help Desk.

Let’s assume:

  1. You’ve created a SharePoint site, enabled the out-of-the-box SharePoint integration with Dynamics 365, and selected the Case entity as being enabled for Document Management.
  2. You’ve provisioned an Employee Self-Service Portal and are able to login to the portal with a user that also has permissions to SharePoint site used in the integration.

High Level Steps

The technique involves the following steps, which I’ll describe in upcoming posts:

  1. Use FetchXML and Liquid to determine the SharePoint folder for current entity
  2. Use the SharePoint REST API to display a list of documents in the SharePoint folder related to the current entity
  3. Bonus: Use the SharePoint REST API to upload a new document to the SharePoint folder

Leave a Reply

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

6 responses to "Adding SharePoint Integration to the Employee Self-Service Portal Without Server-side Code – Part 1"

Back to top