cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Guero
Level: Powered On

Creating Office 365 Group error

Hi there,

 

I'm fairly new to this so forgive me if the answer to my question is quite obvious. I'm currently trying to build a flow which creates a corresponding O365 group whenever we add a client to a SharePoint list on our main group site. 

See Flow below:CG Flow 1.png

 

CG Flow 2.png

 

CG Flow 3.png

 

I've registered the Graph API application with the appropriate acccess and been able to make a POST request to get the access token (See flow below), however when I try to actually create the group in the 'HTTP 2' action, the flow fails and I get the following error details:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request - Invalid Header</h2>
<hr><p>HTTP Error 400. The request has an invalid header name.</p>
</BODY></HTML>

 

 

I know it's a syntax error I'm sure it's going to be something obvious, but for the life of me I just CANNOT see what the error is. I've even pasted what I've written in HTTP 2's body into the Graph Explorer, and it created the group for me? So I haven't got a clue where I'm going wrong in the process.

 

Any help would be appreciated.

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
SCTdan
Level 8

Re: Creating Office 365 Group error

Alright, I recreated this and it went through fine.  Two differences in the token request HTTP call-  URI (add the /v2.0 part) and body request (remove resource, add scope.  Your actual create group HTTP request should be fine.

 

(change tenant/client/secret of course)

POST https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token 

Content-Type: application/x-www-form-urlencoded

client_id=535fb089-9ff3-47b6-9bfb-4f1264799865&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default&client_secret=qWgdYAmab0YSkuL1qKv5bPX&grant_type=client_credentials

 

LnDJWJd

 

hVmGIti

View solution in original post

4 REPLIES 4
SCTdan
Level 8

Re: Creating Office 365 Group error

Check and confirm you have a space in between Bearer and your access token parameter.  Or instead of typing out 'Bearer', use the Token Type parameter in it's place (again making sure there is a space between the two).

Guero
Level: Powered On

Re: Creating Office 365 Group error

@SCTdan wrote:

Check and confirm you have a space in between Bearer and your access token parameter.  Or instead of typing out 'Bearer', use the Token Type parameter in it's place (again making sure there is a space between the two).


Thanks for the help - seems it may have been that, however I'm now getting a different error:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request - Invalid Hostname</h2>
<hr><p>HTTP Error 400. The request hostname is invalid.</p>
</BODY></HTML>

 

SCTdan
Level 8

Re: Creating Office 365 Group error

Alright, I recreated this and it went through fine.  Two differences in the token request HTTP call-  URI (add the /v2.0 part) and body request (remove resource, add scope.  Your actual create group HTTP request should be fine.

 

(change tenant/client/secret of course)

POST https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token 

Content-Type: application/x-www-form-urlencoded

client_id=535fb089-9ff3-47b6-9bfb-4f1264799865&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default&client_secret=qWgdYAmab0YSkuL1qKv5bPX&grant_type=client_credentials

 

LnDJWJd

 

hVmGIti

View solution in original post

Highlighted
Guero
Level: Powered On

Re: Creating Office 365 Group error

That's sorted it - brilliant. 

Thank you for your help!

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (5,051)