SharePoint Connector or Graph API in Power Automate Desktop?

As of November 2024, all the Cloud connectors are now generally available in Power Automate Desktop. So… SharePoint connector or Graph API? And is there a big difference?

In this bog post, we’ll use each method to create an item in SharePoint Online, plus what’s required, and… is it worth the effort!

Authentication

When using the Graph API we’ll need to authenticate. You’ll need to create an App Registration in Entra ID and assign Application permissions for Graph API.

Depending on your needs, you may want to grant Sites.Selected instead of Sites.FullControl.All to follow the least privileges principle.

Once the application has been created, we’re going to create a secret. Navigate to Certificates & secrets then create a new secret.

⚠️ Make sure to copy the value of the secret because you won’t be able to see it again! ⚠️

Finally, grab all the following information from Entra ID for later:

  • Tenant ID
  • App (client) ID
  • Client Secret value

Graph AuthN in Power Automate Desktop

Let’s open Power Automate Desktop and set our 3 variables from the information above. Drag the Set variable action to the canvas and set them to your values.

You can mark those as sensitive under the Flow variables panel (right side of the canvas)

Next, to run a query from the Graph API we’ll need to use the Invoke web service action. We’re trying to first retrieve a token to authenticate by using a POST method.

A few important things to note are the URL, Content type, and Request body. Fortunately, you don’t need to remember all of that! Refer to the official documentation for the parameters.

⚠️ Expand the Advanced section, and uncheck “Encode Request body ⚠️

Then, I’m renaming the variables produced to differentiate them from another Invoke web service action we’ll use later 😉

Finally, we want to use the Convert JSON to custom object action with our WebServiceResponseTOKEN variable from the previous step.

The authentication part should look like below.

Now run the flow and if all goes well, the values should be populated on the Flow variables (right hand side) and a token acquired.

Create item in SharePoint

Choose (or create) a SharePoint site and a list so we can test the Graph method and the SharePoint connector at the same time. I’m going to set the SiteID and the ListID into variables but this is not mandatory. You can use other ways if you want.

Our next two (2) actions will create the item in our SharePoint site 😁

For Graph API to create an item, drag the an Invoke web service action into the canvas and configure it as follows. Once again, a few important things to note like the URL, Custom headers (for authorization), and Request body.

And here’s the Advanced section expanded:

For the SharePoint connector to create an item, drag the Create item action into the canvas and configure it as follows.

The item creation part will look like this:

Run the flow!

Let’s run the desktop flow and see the results!

Our flow variables have been populated, no errors, and the items have been created in the list! 🎉

Conclusion

So… as you can see there’s a lot more to do when using the Graph API compared to the SharePoint connector. But the big difference is that the SharePoint connector is a premium connector.

If you’re already paying for other premium connectors, then you’re good to go. Or you might be ready to invest because you do not have the knowledge in-house for Graph development.

However, if you’re still evaluating or have the knowledge within your organisation, then using the Graph API method is free and a strong competitor!

Thanks for reading! 🙂

Discover more from Veronique's Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading