web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Using Connectors
Answered

Passing DateTime through the SharePoint Connector HTTP action: an adventure

(0) ShareShare
ReportReport
Posted on by 129

So, I'm using the SP REST API to update a date field in a sp.list via the SharePoint connector HTTP action. However, in some scenarios I won't submit a date (datevalue = ""). If you're not aware, the REST API gets cranky if you attempt to post an empty string for a date. That is, if you don't have a date to post, it wants a null instead. If you send it an empty string, the specific error message you'll get back is:

 

"Cannot convert a primitive value to the expected type 'Edm.DateTime'."

 

IMO, this is wonky as all getout, because any date that you pass IS A STRING. But I digress...

 

Unfortunately, I can't use an IF statement to rewrite the date value as null if the incoming json date value is an empty string, because the null gets stringified by the IF statement. Doh.

 

My current hack of a workaround for this is to use a Condition to see if the incoming date is empty. If it includes a date, I include it in a Compose action.  If it's empty, I exclude it. Like this: 

 

hacktastic.PNG

 

It works, but it's just unpleasant to look at. If anyone else has a better solution, I'd appreciate it. If this is currently the only solution, hopefully someone else finds this helpful.

 

PS: Of course, this begs the question "why not just use the SharePoint connector Create Item action, which handles dates gracefully?" I started with that, but I need to update a hyperlink fieldtype in the list in the same action. The Create Item action doesn't give you access to the Description attribute of the SP.FieldUrlValue type, which I need.

 

PPS: "Why not just push two separate updates to the list item, and use the HTTP action only to push the Description attribute?" Good question. Unfortunately, there are other Flows triggering off of changes to this list, and the downstream Flow owners were getting a little annoyed I was using up their quota by sending them two triggers for every row update I was making.

I have the same question (0)
  • Verified answer
    v-yamao-msft Profile Picture
    on at
    Re: Passing DateTime through the SharePoint Connector HTTP action: an adventure

    Hi @StevenWade,

     

    I am afraid that currently saving a null value into a Date time column of SharePoint using Microsoft Flow is not available.

     

    I have seen a similar request on Flow Ideas Forum. If you need this feature, please vote the idea at here:

    https://powerusers.microsoft.com/t5/Flow-Ideas/Insert-blank-values-into-Flow-Sharepoint-Update-Items/idi-p/83796

     

     

    Best regards,

    Mabel Mao

  • StevenWade Profile Picture
    129 on at
    Re: Passing DateTime through the SharePoint Connector HTTP action: an adventure

    Thanks Mabel--that's what I suspected.

     

    Question--is there any plan to update the SharePoint connector so that the Update Item action can access the Description attribute of a hyperlink list field?

  • krishnamohanaht Profile Picture
    2 on at
    Re: Passing DateTime through the SharePoint Connector HTTP action: an adventure

    hello.  looking for help.  

    I am trying to create a an event in google calender from the date and time passed from cognito forms.  but the MS Flow is throwing an error (not recognizing the date and time I am sending..).  What standard date/time format does MS Flow accept?

     

     

  • StevenWade Profile Picture
    129 on at
    Re: Passing DateTime through the SharePoint Connector HTTP action: an adventure

    I've seen flow handle most things that get close to ISO8601 without complaining. If I'm having issues, I'll use a convertToUTC() and use the default format ('o').

     

    More guidance here:

     

    https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#convertToUtc
    https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings#Roundtrip

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 650 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 341 Moderator

#3
developerAJ Profile Picture

developerAJ 256

Last 30 days Overall leaderboard

Featured topics