Power Automate, SharePoint, Dataverse and DATES - Gotchas That'll Getcha

Power Automate, SharePoint, Dataverse and DATES - Gotchas That'll Getcha

Dates... They are pains in the neck. They should be easy. But... They aren't. One of the biggest Gotchas I find with dates is moving between SharePoint and Dataverse. It should be easy right? I mean both come from Microsoft, they should play nice? Sometimes they do.. But, there are a few gotchas that you have to be aware of.

First... Dataverse and SharePoint both store dates in the UTC format. It looks like this: 2023-03-06T20:00:00Z. This date is the year, 2023, the Month, 03, the TIME ZONE, 06, and then the time, 20:00:00Z. In a friendly format this is March 3rd, 2023 at 2:00 PM Central Standard Time. If I pass this information from SharePoint to Dataverse, it works no muss no fuss. My date/time information is passed and written just as I expect it.

The very first gotcha is going to be from ANY input or datasource, you want your time to be formatted in this way. It saves a ton of time and heartache.

The problem comes when I pass a date from SharePoint that is JUST a date. In other words my column in SharePoint is configured for Date Only:

No alt text provided for this image

This column does not store any time information, and that means that a date of March 3rd, 2023 here looks like this: 2023-03-20T00:00:00Z, you will notice that there is NO time zone information. So this comes across as 12:00AM UTC, rather than 12 AM Central Time. That can be a big problem if I try to write this date to Dataverse.

To demonstrate, I created a quick flow that moved data from SharePoint to Dataverse. I passed two dates, an Unfriendly date with no time, and a Unfriendly date With time.

No alt text provided for this image

I created a Davaverse table with two date fields, Date and Time, and Just Date. Here is my flow:

No alt text provided for this image

The output in Datverse looks like this (SharePoint to Dataverse):

No alt text provided for this image

You'll notice that the first date matches exactly, but the second date is one day behind. This is because the Dataverse interface is showing me the date according to my locally configured time zone. Because the date comes in as midnight on 3/20/2023 UTC, that is 3/19/2023 Central Time USA.

This can be a big issue... There is no easy way in Power Automate to grab the Time Zone of the site collection during the write operation. What can be done is to add your time zone offset to the time when you do the write operation. However, that doesn't work well when you have a site or application that is used in multiple time zones. My best advice is to use a date and time field, or use a calculated column to add the time zone data, when you have a list that may write to any other datasource.

Coming back from dataverse to SharePoint, we use the following flow:

No alt text provided for this image

Using this data, that was input directly in from dataverse:

No alt text provided for this image

And we see this in SharePoint

No alt text provided for this image

Looking at the raw inputs:

No alt text provided for this image

we see that the time zone information in dataverse is set for the local time zone, and not stripped out.

We also notice that the date and times in SharePoint, no matter how they are formatted from the display point of view, accept the same kind of date format and are presented as expected.

So... In this example, we find that from Dataverse to SharePoint the writing of dates is pretty straight forward, but when moving from SharePoint to Dataverse, there can be issues with time zones.

要查看或添加评论,请登录

Matthew Meyer的更多文章

  • Are They Gonna Take 'er Jobs???

    Are They Gonna Take 'er Jobs???

    For a bit now I have been saying: "AI isn't coming to take your jobs. People who can USE AI will be.

    4 条评论
  • Rules? Who Needs Them???

    Rules? Who Needs Them???

    I'm not a huge fan of rules. I know, I know, a Libertarian who doesn't like rules, quelle surprise.

    1 条评论
  • Restricting CoPilot - Search? RSS? RAC?

    Restricting CoPilot - Search? RSS? RAC?

    In talking to my clients and trying to go over all of the ways to get CoPilot for Microsoft 365 to work or not work…

  • Immediate ROI From SharePoint Advanced Management

    Immediate ROI From SharePoint Advanced Management

    It has been announced that Microsoft will automatically archive unlicensed OneDrive storage starting in January 2025…

  • AI - I Don't Want a Chatbot... What Can I USE????

    AI - I Don't Want a Chatbot... What Can I USE????

    Chatbots are fun, and I like to use LLMs to help me write articles. BUT, while that is cute and all, what can I use to…

  • Architecture Doesn't Care About Your Feelings

    Architecture Doesn't Care About Your Feelings

    I've been spending some time looking over old solutions, and trying to come up with ways that I can improve them…

    3 条评论
  • Process Mining and Software Development

    Process Mining and Software Development

    Almost every engagement that I have starts with my clients wanting to create a new program, or they want to do an…

    1 条评论
  • How Do I Improve My AI Builder Model?

    How Do I Improve My AI Builder Model?

    Once you have completed you AI Builder model, you release it in to production, and that is the end of it! Yay!…

  • Invite Your Whole Channel to a Meeting... No, Seriously

    Invite Your Whole Channel to a Meeting... No, Seriously

    I see lots of stuff on the Microsoft Social pages about trying to send a bulk meeting request to an entire Team or…

    2 条评论
  • SharePoint and Azure Blob Storage... Which Do I Use???

    SharePoint and Azure Blob Storage... Which Do I Use???

    You have made the decision to move to the cloud! Yay!!!! You want to take advantage of the flexibility, security, and…

社区洞察

其他会员也浏览了