Power Community

Power Community

Graph API responding with Unexpected response from the service in Power Automate

Unexpected response from the service

Today a real SharePains post. I create a flow that makes a call to the Microsoft Graph API and I’m getting “Unexpected response from the service”. This is as good as something went wrong.

Unexpected response from the service

The Unexpected response from the service error message doesn’t give us very much. You get these errors when something is wrong within the request. This error seems to catch all the errors that can possibly happen when we try to do something in SharePoint with the Graph API.

Some of the issues I’ve found generating this error are:

  • Permissions
  • Incorrect Header
  • Incorrect URL supplied for the Graph API end point
  • Something is wrong with the SharePoint site, list, content types

So in short something is wrong, but how do we solve this issue

Error responses and fixing the issues

The documentation gives us a list of failure codes. Anything above the 400 status code is a bit helpful. But the 400 error code is simply just a pain. For more details on the error codes please see the following link: https://learn.microsoft.com/en-us/graph/errors

Well you could have a look at the documentation first. We might just have made a typo somewhere.

In my example above I tried to copy a content type from the Content Type Gallery to a list. In the documentation we will see that we will have to supply the Content-Type header. It is such an easy thing to forget.

Graph API responding with Unexpected response from the service in Power Automate Microsoft Graph image 4

We can also see the fields required in the body of the request. In this case we need to supply a contentTypeId.

Graph API responding with Unexpected response from the service in Power Automate Microsoft Graph image 5

Well, I got that right too. So where do I go next?

The 400 error means two things. There is something wrong within SharePoint or I’ve done something wrong. We just checked that I got the request right, so there is something wrong in SharePoint.

Sounds easy, but the solution may still not be easy to find.

Content Type Gallery

So I’m trying to do something with Content Types. So it is always worth it to try to do manually within the SharePoint UI what I’m trying to do with the Graph API.

In this case I went to the site and found that I had an issue with one of my content types as there was an issue with one of the the site columns. So I’m quite lucky that SharePoint just gave me the answer. Quite often where something is failing you just have to try manually what you tried to automate.

In my case my API call worked for 100s of sites and this one site had a column conflict.

Graph API responding with Unexpected response from the service in Power Automate Microsoft Graph image 6

And when I look at the Content type publishing error log I get further details on the issue. And quite quickly I found the column that was causing the problem.

Further Help with the Graph API

Please have a look at my series of posts about the Graph API within the Power Platform

This post was originally published on this site

- Advertisement -spot_img

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement - Advertisement

Latest News

Enabling TDS End Point for Dataverse (Preview Feature) from Power Platform Admin Center and its advantages

Hi Folks, Exciting news… Here is how you can enable TDS End Point in Dataverse… Navigate to Power Platform Admin Center…https://admin.powerplatform.microsoft.com/home Next navigate...

More Articles Like This

- Advertisement -spot_img