In Development

Integrating FileMaker and SharePoint Using Microsoft Graph

Often times documents are commonly needed in multiple programs, but the lack of integration can result in having to enter in the same files in different applications. Microsoft Graph is a powerful tool that provides a unified API interface for many of Microsoft’s most popular Cloud programs, including the popular web-based application SharePoint.

Integration between SharePoint and FileMaker is even possible using Microsoft Graph. In this example I will demonstrate how to upload files from a FileMaker solution into your SharePoint site.

There are three main steps to the integration. Allowing access to your Microsoft Application, setting up OAuth 2.0 authentication, and the actual uploading of documents to Sharepoint.

Watch on Youtube: Integrating FileMaker and SharePoint Using Microsoft Graph

Setting Up Your Microsoft Application
In order to allow FileMaker to talk to your SharePoint solution using Microsoft Graph, you will first need to set up a Microsoft Application to allow access using OAuth 2.0. If you go to Microsoft’s My Applications page you can either edit an existing application or create a new one. (If you don’t have a site already, you will need to create a site in SharePoint prior to this). Make note of the Application ID (sometimes called the Client ID), you’ll need this in your FileMaker solution.

filemaker my apps

Next you’ll need to create a new Application Secret (again, sometimes called Client Secret). Generate and copy the password. This is the only time you will be able to copy this password, so be sure to document it somewhere or else you will have to generate a new password.

Now add a new web platform, and allow implicit flow and enter in the Redirect URI. The Redirect URI is just the web page the user will go to after they allow access to the SharePoint application.

filemaker secret redirect

Next you will need to allow Microsoft Graph Delegated Permissions. For the purposes of this demo you will only need the ones referenced in the image or in our Demo file.

filemaker delegated permissions

Setting Up OAuth 2.0 Connection
Now that we have our Microsoft Application set up, using the Application ID, Application Secret, Redirect URI, and Site Name we can talk to our SharePoint solution! The first step is getting the access code. You will need to call this in a web browser or Web Viewer in FileMaker using a URL.

filemaker allow access

Once you accept, you can grab the access code in the URL. Then using this, you can request a token to access your SharePoint site. A JSON-encoded response will bring you the account and refresh tokens, which you can then use to talk to your SharePoint solution.

For more about how OAuth 2.0 works, reference the OAuth 2.0 Authorization Code Flow.

Uploading Documents to SharePoint through FileMaker
With everything set in place, we can now upload documents through FileMaker into your SharePoint site.  In order to upload files, we will need to use them to grab your Site ID in SharePoint.  Below is the URL template.

https://graph.microsoft.com/beta/sharepoint:/YOUR_SITE_NAME_HERE

Be sure to set your authorization headers using the BE_HTTP_Set_Custom_Header and the access token before performing your GET call.

filemaker oauth2 token siteID

Next, use your Site ID to grab the drive ID where the document will be uploaded.

https://graph.microsoft.com/beta/sharepoint/sites/YOUR_SITE_ID_HERE/drive

Again be sure to set your authorization header with the access token.  Then using the drive ID, you can use a PUT call to create the file in SharePoint! If it is successfully created, you will receive a JSON-response code with the information about the newly created item.

filemaker sharepoint item response code

And in the documents in SharePoint, the new document is created!

filemaker new document

The potential of SharePoint and FileMaker integration using Microsoft Graph goes beyond this.  You can reference all the functionality on their API Documentation.  There are even more Microsoft programs that can be integrated with FileMaker using Microsoft Graph, such as Excel, Outlook, and Webhooks.

Conclusion
With those three steps, documents added into FileMaker can easily be uploaded automatically into SharePoint.  This integration allows documents to quickly and easily be uploaded and viewable in both applications.  Microsoft Graph’s ever-expanding capabilities continue to allow for further integrations with Microsoft and other programs using a unified API interface.

Did you know we are an authorized reseller for FileMaker Licensing?
Contact us to discuss upgrading your FileMaker software.

DownloadDownload Integrating FileMaker And SharePoint

Please complete the form below to download your FREE FileMaker database file.

Ian Haas
Ian is a skilled Application Developer who has a passion for building custom applications in various platforms, including FileMaker, iPhone, iPad, and for the web.
Integrating FileMaker With RESTful APIs