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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Creating all day event...
Power Automate
Answered

Creating all day event in Sharepoint from approve/reject flow

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi all,

 

I've created a flow for employee vacation requests using the approve/reject flow. When a request is approved, it adds the employees vacation to a calendar on SharePoint. This is easy enough, however the blocked off time on the calendar is always short by one day as the events are automatically created to 0h. So if someone has an approved request from June 11-14, only 11-13 will be blocked off on the calendar under their name. I really don't want employees to have to select time alongside date (i.e. June 11 00:00 to June 14 23:55) when booking vacation, since it's always full days.

 

I've tried the below solution, but know I'm missing something. I also tried running a script on the SharePoint list itself to automatically default new calendar event entries as "all day" but this is not being recognized from the flow that creates said entries. I'm newer to Flow, so go easy!

 

FlowExample.png

 

Any guidance would be greatly appreciated.

Categories:
I have the same question (0)
  • v-yamao-msft Profile Picture
    Microsoft Employee on at

    Hi BuzzwordMaster,

     

    According to your description, I create a flow looks like below.
    When an item created on ListC is approved, it will be created on the Leave Request list(Calendar list).

    3.PNG

     

    Then I create an item on ListC to run the flow, the vacation is from 4.17-4.20.
    While the item created on Leave Request list is 4.17-4.19. See the screenshot below.
    I will report this issue on my side and back to you once I got any response.

    1.png

     

    About this sentence “I really don't want employees to have to select time alongside date (i.e. June 11 00:00 to June 14 23:55) when booking vacation, since it's always full days”, how do you configure the Date and Time column?
    Please try to configure its format as “Date Only”, then the employees will not have to select time alongside date.
    Please try if this works for you.

    4.PNG

     


    Best regards,
    Mabel Mao

     

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi Mabel,

     

    Thank you for looking into this and for the detailed response. The issue you've ran into on the calendar is the issue I'm referring to. I mentioned not wanting employees to input time as a reference to this (i.e. if they put 23h 55m on the 'End Date' then the calendar issue would be solved). I've found a solution to all of this by writing some Jquery that applies 0h 0m to 'Start Date' and 23h 55m to the 'End Date' automatically, and then hides the time columns. Now the calendar is issue is fixed and everything is working as intended.

     

    Edit: I've added the script here incase others are having the same issue:

     

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script>

    <script type="text/javascript">
    $(document).ready(function(){
    $('[id ^=Start][id $=DateTimeFieldDateHours]').hide();
    $('[id ^=Start][id $=DateTimeFieldDateMinutes]').hide();
    $('[id ^=End][id $=DateTimeFieldDateHours]').val(23).hide();
    $('[id ^=End][id $=DateTimeFieldDateMinutes]').val(55).hide();
    });
    </script>

     

    Cheers!

  • Aethyta Profile Picture
    on at

    I dont have issue updating the SP calendar with all day event. But maybe because I'm using a custom list with calendar view not an actual SP Calendar? My issue was with Outlook when the event is all day, the create event action changes my time zone to utc 0, and im at -7 (PDT). I used compose and startOfDay function to set my dates to midnight for the [create event] action

     

    On SharePoint:
    All Day Event = Yes

    Start Date: 04/13/2017

    End Date: 04/13/2017

    Outlook Calendar

    Compose: Start Date -- "@startOfDay(triggerBody()?['EventDate'])"

    Compose: End Date -- "@startOfDay(adddays(triggerBody()?['EndDate'], 1))

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Tamras - I tried using the @ functions prior to having to go with script, and I came to the conclusion that because Flow treats outlook calendar entries as 'events' it's not an issue. With SharePoint however, because it's updating an 'item' and the calendar is a 'list', I was unable to use the @ functions (I could be mistaken though).

     

     

  • AngelinaSpring Profile Picture
    25 on at

    Hi Buzzword Master

     

    I'm struggling with getting Sharepoint to add my event to the site calendar, after approval.

    Can you share the details of this part of your flow so that I can try to replicate for my system please?

     

    Thank you!

  • hiranfilho Profile Picture
    44 on at

    @Anonymous ,

     

    where I put this code?? Could you explain???

  • medasbabu Profile Picture
    29 on at

    @Anonymous 

     

    Even I'm facing this issue, got stuck for a long time and reached this post, but where should I add this code, could you please provide details.

  • roxyshenton Profile Picture
    36 on at

    How can I add the code to the sharepoint calendar?

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 873

#2
Valantis Profile Picture

Valantis 813

#3
Haque Profile Picture

Haque 526

Last 30 days Overall leaderboard