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 : CeOi6iK7dcXalgzdS8CNpp
Power Apps - Building Power Apps
Answered

Calendar Post Item writing to today's date and not the selected Events date.

Like (0) ShareShare
ReportReport
Posted on 17 Sep 2021 17:09:02 by 67

Hi Pros,

 

I need some help that I have been banging my head on all week. Now it's time to call in the muscles here πŸ˜Š πŸ’ͺ

 

Summary:

My Powerapp is not writing an Outlook V4 Post Item calendar event to the correct date. The times get posted correct.

 

Setup:

The SharePoint List has Single Text columns for 'Event Date', 'Start Time', and 'End Time'.

 

How it works:

User selects Event from a gallery and is presented with a confirmation registration screen where the Register button is located. This screen serves as a summary to confirm if the date, time, and other details are correct before clicking Register.

 

Problem:

When the user clicks the Register button in the RegistrationConfirmScreen, the code below creates the Outlook calendar event always for the current date rather than the desired 'Event Date' as selected from the gallery back on Screen1.

 

The Ask:

How can I get this thing to post for the correct date? Times are correct even though they are in different SP List columns. Can someone stretch and help me out so I can get over this roadblock?

 

Office365Outlook.V4CalendarPostItem(
 LookUp(
 Office365Outlook.CalendarGetTables().value,
 DisplayName = "Calendar"
 ).Name,
 LabelTitleValue.Text,
 EventView1.Selected.'Event Date' + Text(EventView1.Selected.'Start Time',DateTimeFormat.UTC),
 
 LabelEndTimeValue.Text,
 LabelFriendTimeZoneValue.Text,
 {body: LabelDescriptionValueHTML.HtmlText}
);

 

Thanks,

TAG

I have the same question (0)
  • earlgarnethe Profile Picture
    6 on 04 Aug 2023 at 05:29:41
    Re: Calendar Post Item writing to today's date and not the selected Events date.

    Hi,

     

    I'm new to PowerApps, I'm building a reservation app for my company. Now I'm trying to patch the date from my datepicker canvas to Outlook365 Calendar, is that even possible? I already tried my best but whenever I select a date from the datepicker, once I click the button with patch function, it will save in my SP List with correct selected date but in the outlook 365 calendar it post the date Today..

    Please help me. 

  • GigaenvyTAG69 Profile Picture
    67 on 20 Sep 2021 at 17:29:22
    Re: Calendar Post Item writing to today's date and not the selected Events date.

    Thanks so much. I was using this before except I never tried DateTimeValue. I was using Time Value and trying to combine a date with time. This worked without the TimeOffset () param as it was altering the start time hours later.

  • GigaenvyTAG69 Profile Picture
    67 on 20 Sep 2021 at 15:37:07
    Re: Calendar Post Item writing to today's date and not the selected Events date.

    Hi @StalinPonnusamy 

     

    Sorry I was away from work over the weekend and will check out the example above and let you know how it works. If successful I will flag this as solved. πŸ™‚

     

    TAG

  • Verified answer
    StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on 17 Sep 2021 at 18:57:31
    Re: Calendar Post Item writing to today's date and not the selected Events date.

    Hi @GigaenvyTAG69 

     

    The concept is the same. Gets the information from the gallery or variable. And convert into proper Datetime.

    Office365Outlook.V4CalendarPostItem(
     "Calendar",
     "Stalin Test 4",
     DateAdd(
     DateTimeValue(
     Gallery1.Selected.'Event Date' & " " & TimeValue(Gallery1.Selected.'Start Time')
     ),
     TimeZoneOffset(),
     Minutes
     ),
     DateAdd(
     DateTimeValue(
     Gallery1.Selected.'Event Date' & " " & TimeValue(Gallery1.Selected.'End Time')
     ),
     TimeZoneOffset(),
     Minutes
     ),
     "(UTC) Coordinated Universal Time",
     {body: "Test"}
    )

     

    StalinPonnusamy_1-1631905028327.png

     

     

  • GigaenvyTAG69 Profile Picture
    67 on 17 Sep 2021 at 18:36:31
    Re: Calendar Post Item writing to today's date and not the selected Events date.

    Thanks for this, but there is no DatePicker - the user is selecting an Items list from an Event gallery where the columns for 'Event Date' (date only), 'Start Time' and 'End Time' are all single text. I believe that's what I wrote above. In other words, I am pulling the Event details for the record from a Sharepoint List as I wrote above from a gallery. There is no minutes value neither as this is not a picker dropdown scenario as you provided above. 

     

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on 17 Sep 2021 at 17:43:51
    Re: Calendar Post Item writing to today's date and not the selected Events date.

    Hi @GigaenvyTAG69 

     

    Here is the converted date to UTC time

     

    Office365Outlook.V4CalendarPostItem(
     "Calendar",
     "Stalin Test 4",
     DateAdd(
     DateTimeValue(
     DatePicker2.SelectedDate & " " & Time(
     Value(StartHourDropdown.Selected.Value),
     Value(StartMinutesDropdown.Selected.Value),
     0
     )
     ),
     TimeZoneOffset(),
     Minutes
     ),
     DateAdd(
     DateTimeValue(
     DatePicker3.SelectedDate & " " & Time(
     Value(EndHourDropdown.Selected.Value),
     Value(EndMinutesDropdown.Selected.Value),
     0
     )
     ),
     TimeZoneOffset(),
     Minutes
     ),
     "(UTC) Coordinated Universal Time",
     {body: RichTextEditor1.HtmlText}
    )

     

     

    Setup

    StalinPonnusamy_1-1631903406069.png

     

    StalinPonnusamy_0-1631903374686.png

     

     

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on 17 Sep 2021 at 17:36:28
    Re: Calendar Post Item writing to today's date and not the selected Events date.

    Hi @GigaenvyTAG69 

     

    I suggest verifying the Datetime value. For testing, I created an event but make sure to send it as UTC time 

    Office365Outlook.V4CalendarPostItem(
     "Calendar",
     "Stalin Test",
     DateTimeValue(DatePicker2.SelectedDate & " 10:00:00 PM"),
     DateTimeValue(DatePicker2.SelectedDate & " 10:30:00 PM"),
     "(UTC) Coordinated Universal Time",
     {body: RichTextEditor1.HtmlText}
    )

     

    StalinPonnusamy_0-1631900126594.png

     

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…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 936 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 375 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 330 Super User 2025 Season 2

Last 30 days Overall leaderboard
Loading started
Loading complete