cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GigaenvyTAG69
Helper I
Helper I

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

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

1 ACCEPTED SOLUTION

Accepted Solutions
StalinPonnusamy
Community Champion
Community Champion

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

 

 

View solution in original post

6 REPLIES 6
StalinPonnusamy
Community Champion
Community Champion

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

 

StalinPonnusamy
Community Champion
Community Champion

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

 

 

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
Community Champion
Community Champion

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

 

 

View solution in original post

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

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.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,420)