cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Need help with HTTP Request to modify SharePoint List Item

Hi there!

I'm trying to get a flow together that ultimately updates a SharePoint Calendar List Item to be an All Day Event. I've scoured the forums, and can't find a solution to the error I'm currently getting. The Flow

  1. Creates the List Item from a O365 Group Event
  2. Adds five hours to the start and end time, and adds -1 minute to the end time to get the item to the correct time zone (Central Standard Time). This accounts for the fact that the SharePoint Item formats all datetime as The Universal Sortable ("u") Format Specifier which uses GMT, and neither the convertTimeZone nor the convertFromUTC nor the formatDateTime expressions do anything to correct this when creating the event.
  3. Initializes two variables Start and End
  4. Checks to see if the SharePoint list item start and end time equal 00:00:00 and 11:59:00 PM
  5. If they do, it sets the Start and End variables using formatDateTime to yyyy:MM:dd for the SharePoint item's EventDate and EndDate
  6. It then calls a "Send an HTTP request to SharePoint" action to set the list values, since I can't set fAllDayEvent through any other means. And here's where I get stuck. At this action I get a Status code 400, and the following error:
    Invalid JSON. A token was not recognized in the JSON content.
    clientRequestId: 6661d61b-ce90-4a3b-80e7-98997401ac04
    serviceRequestId: 34014c9f-80a1-0000-5836-ef2bdf7a6761

 

 

 

 

{
  "status": 400,
  "message": "Invalid JSON. A token was not recognized in the JSON content.\r\nclientRequestId: 6661d61b-ce90-4a3b-80e7-98997401ac04\r\nserviceRequestId: 34014c9f-80a1-0000-5836-ef2bdf7a6761",
  "source": "https://questar365.sharepoint.com/sites/Infrastructure/_api/web/lists/getbytitle('Furlough')/items",
  "errors": [
    "-1",
    "Microsoft.SharePoint.Client.InvalidClientQueryException"
  ]
}

 

 

 

 

I've searched high and low and from what I've read I shouldn't need an OAUTH token since all of this occurs inside the same Office 365 tenant. Please help! I've been banging my head against the wall on this for two days.

HTTP Request.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Need help with HTTP Request to modify SharePoint List Item

 

Hi @derek_hansell ,

 

Could you share the blog or article you are referring to so that we could do a similar test and analyze the cause of the issue?

 

According to the screenshot you provide, we notice that you entered the wrong “” outside Start variables. It should be "".

Or you could remove the “” and check if the same issue still exists.

 

Besides, we need to use the expression to get the value of the variable. Like:

50.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Highlighted
Helper V
Helper V

Re: Need help with HTTP Request to modify SharePoint List Item

@derek_hansell,

 

Hi there! I have a couple of questions to start.  First, have you successfully created an item against this list using an HTTP POST without all the additional variables?  That's a good place to begin because then you can start to see if it's the call against the list that is a problem, or if the problem lies somewhere with your variables and fields.

 

Second, when you say "SharePoint Calendar list item," is this a classic list with a calendar view in O365?  Or, are you using a modern SP Events list?

 

Finally, a quick suggestion:  I don't think you need the "metadata" and list type in your body field, or the additional header. 

 

Here's a sample POST HTTP call for you: 

HTTP_Post-4-25-20.png

 

Let me know how it goes!!

 

-Ash

If this response provided an answer to your question please mark it as a solution so that others can find it.

If you found this helpful, consider giving it a thumbs up!

Highlighted
Community Support
Community Support

Re: Need help with HTTP Request to modify SharePoint List Item

 

Hi @derek_hansell ,

 

Could you share the blog or article you are referring to so that we could do a similar test and analyze the cause of the issue?

 

According to the screenshot you provide, we notice that you entered the wrong “” outside Start variables. It should be "".

Or you could remove the “” and check if the same issue still exists.

 

Besides, we need to use the expression to get the value of the variable. Like:

50.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Regular Visitor

Re: Need help with HTTP Request to modify SharePoint List Item

Barry,

 

Holy moly, I'm not sure if it was the quote marks being wrong or switching to using the expressions, but the Flow is now working! Thank you!

 

However, I'm not getting the intended result. Instead of modifying the existing event, it's creating a new one. I'll poke at it a bit more on my own, but, any suggestions?

 

Cheers,

DH

Highlighted
Helper V
Helper V

Re: Need help with HTTP Request to modify SharePoint List Item

@derek_hansell

 

If you want to modify the existing event, use PATCH instead of POST.  You'll need to pass in the ID of the item as well!

 

Take care,

Ashley

 

 

Highlighted
Regular Visitor

Re: Need help with HTTP Request to modify SharePoint List Item

Thanks. Instead I simplified the Flow a ton so that it uses the Send an HTTP Request action if the event is an All Day event, and it uses the SharePoint Create Item if it's not. Everything is now working as expected for event creation. Now, if only I could make it delete the SharePoint event if the original event is removed from the O365 Group Calendar...

Helpful resources

Announcements
firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

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!

Top Solution Authors
Users online (5,702)