cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PJBruen
Resolver I
Resolver I

Create Outlook Calendar event from a PowerApp (w. Sharepoint)

Hi All...

I have a Powerapp (demo) collecting booking information. The booking date is stored in Sharepoint along with a field with booking length in Mins (stored as a number). 

 

Sharepoint fields are:

  • Timeslot (stored as Date & Time) eg 12/08/2020 09:00 (12th Aug)
  • SlotLength (number) eg 60 (mins)

I then have this code to create a record in Outlook, but i need to know how I change this so that the date time is store in UK format.

 

Current code:

Office365Outlook.V4CalendarPostItem(

    LookUp(Office365Outlook.CalendarGetTables().value, DisplayName="Calendar").Name,

    ThisItem.Title,

    DateAdd(ThisItem.TimeSlot,TimeZoneOffset(), Minutes),

    DateAdd(ThisItem.TimeSlot, ThisItem.SlotLength + TimeZoneOffset(), Minutes),

    "(UTC) Coordinated Universal Time",

    {

        body: "Meeting created with PowerAppps"

    }

)

Presently, a booking for 12th August is saving a record on the 8th December.

 

Can anyone advise how I need to change this to save in UK timezone in Outlook please? It should create a 60 min meeting on 12th Aug.

 

Many thanks.

Paul

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PJBruen
Resolver I
Resolver I

I seem to have resolved this now. Here's my fix if this is useful to others.

 

Set(varStartDate, Text(ThisItem.TimeSlot, "[$-en-GB] dd/mm/yyyy hh:mm:ss"));
Set(varEndDate, Text(DateAdd(ThisItem.TimeSlot,ThisItem.SlotLength, Minutes), "[$-en-GB] dd/mm/yyyy hh:mm:ss"));

Office365Outlook.V4CalendarPostItem(
   LookUp(Office365Outlook.CalendarGetTables().value, DisplayName="Calendar").Name,
   ThisItem.Title,
   Text(DateTimeValue(varStartDate,"en-GB"), DateTimeFormat.LongDateTime),
   Text(DateTimeValue(varEndDate, "en-GB"), DateTimeFormat.LongDateTime),
   "(UTC+00:00) Dublin, Edinburgh, Lisbon, London",
   {
       body: "Meeting created with PowerAppps"
   }
)

View solution in original post

1 REPLY 1
PJBruen
Resolver I
Resolver I

I seem to have resolved this now. Here's my fix if this is useful to others.

 

Set(varStartDate, Text(ThisItem.TimeSlot, "[$-en-GB] dd/mm/yyyy hh:mm:ss"));
Set(varEndDate, Text(DateAdd(ThisItem.TimeSlot,ThisItem.SlotLength, Minutes), "[$-en-GB] dd/mm/yyyy hh:mm:ss"));

Office365Outlook.V4CalendarPostItem(
   LookUp(Office365Outlook.CalendarGetTables().value, DisplayName="Calendar").Name,
   ThisItem.Title,
   Text(DateTimeValue(varStartDate,"en-GB"), DateTimeFormat.LongDateTime),
   Text(DateTimeValue(varEndDate, "en-GB"), DateTimeFormat.LongDateTime),
   "(UTC+00:00) Dublin, Edinburgh, Lisbon, London",
   {
       body: "Meeting created with PowerAppps"
   }
)

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Solution Authors
Top Kudoed Authors
Users online (4,075)