cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
a-mccormack
Microsoft
Microsoft

Patch Outlook Calendar

Hi All,

 

I'm trying to patch existing calendar entries, but I get the error below. Creating and deleting entries work just fine.

amccormack_0-1654872763288.png

Was wondering if anyone could help point me in the right direction. Code listed below. It was originally found here: Power Apps Guide - Outlook - How to add, edit, delete, and list Outlook calendar events - Power Apps...

 

With({idCalendarEntry:
        First(
            Office365Outlook.GetEventsCalendarViewV3(calendarID ,
                    Concatenate(DatePicker1_1.SelectedDate, " ", If(Toggle1.Value=true,"00:00:00",TextInput7_1.Text)),
	        Concatenate(DatePicker1_2.SelectedDate, " ", If(Toggle1.Value=true,"23:59:59",TextInput7_2.Text)),
                    {search:Concatenate("Event: ",adsComboboxEvents_2.Selected.structureName)}
             ).value
            )
       },
    Office365Outlook.V3CalendarPatchItem(
           calendarID.
           idCalendarEntry.id,
           "New Subject Text",
           Concatenate(DatePicker1_1.SelectedDate, " ", If(Toggle1.Value=true,"00:00:00",TextInput7_1.Text)),
	        Concatenate(DatePicker1_2.SelectedDate, " ", If(Toggle1.Value=true,"23:59:59",TextInput7_2.Text)), 
           {Body:"Updated calendar entry body text"}
   )                    
)    

 

Thanks in advance.  

4 REPLIES 4
v-qiaqi-msft
Community Support
Community Support

Hi @a-mccormack,

The Office365Outlook.V3CalendarPatchItem method requires the calendar ID, and calendar entry ID.

Based on the above, I think there is something syntax wrong with your calendarID, could you please tell me that how you define your calendarID?

 

To find out the calendarID, I think we could use the following formula to get it:

 

Set(calendarID, 
    LookUp(Office365Outlook.CalendarGetTablesV2().value, 
           name="Calendar").id
)

 

So, on your side, please modify your formula as below:

With({idCalendarEntry:
        First(
            Office365Outlook.GetEventsCalendarViewV3(calendarID ,
                    Concatenate(DatePicker1_1.SelectedDate, " ", If(Toggle1.Value=true,"00:00:00",TextInput7_1.Text)),
	        Concatenate(DatePicker1_2.SelectedDate, " ", If(Toggle1.Value=true,"23:59:59",TextInput7_2.Text)),
                    {search:Concatenate("Event: ",adsComboboxEvents_2.Selected.structureName)}
             ).value
            )
       },
    Office365Outlook.V3CalendarPatchItem(
           LookUp(Office365Outlook.CalendarGetTablesV2().value, name="Calendar").id,
           idCalendarEntry.id,
           "New Subject Text",
           Concatenate(DatePicker1_1.SelectedDate, " ", If(Toggle1.Value=true,"00:00:00",TextInput7_1.Text)),
	        Concatenate(DatePicker1_2.SelectedDate, " ", If(Toggle1.Value=true,"23:59:59",TextInput7_2.Text)), 
           {Body:"Updated calendar entry body text"}
   )                    
)    

Or you could reference to the variable as below:

With({idCalendarEntry:
        First(
            Office365Outlook.GetEventsCalendarViewV3(calendarID ,
                    Concatenate(DatePicker1_1.SelectedDate, " ", If(Toggle1.Value=true,"00:00:00",TextInput7_1.Text)),
	        Concatenate(DatePicker1_2.SelectedDate, " ", If(Toggle1.Value=true,"23:59:59",TextInput7_2.Text)),
                    {search:Concatenate("Event: ",adsComboboxEvents_2.Selected.structureName)}
             ).value
            )
       },
    Office365Outlook.V3CalendarPatchItem(
           calendarID,//Here you should replace the dot with the comma ","
           idCalendarEntry.id,
           "New Subject Text",
           Concatenate(DatePicker1_1.SelectedDate, " ", If(Toggle1.Value=true,"00:00:00",TextInput7_1.Text)),
	        Concatenate(DatePicker1_2.SelectedDate, " ", If(Toggle1.Value=true,"23:59:59",TextInput7_2.Text)), 
           {Body:"Updated calendar entry body text"}
   )                    
)    ​
Best Regards,
Qi

Thanks for the help. Unfortunately, the problem is still there.

HI @a-mccormack,

Do you mean you set the calendarID as I suggested and the issue is still?

Could you please show me your formula?

 

Please make sure that you have replace the dot with comma.

Best Regards,
Qi
a-mccormack
Microsoft
Microsoft

This is the code I'm using right now that doesn't work. This is supposed to make changes to the event.

 

 

With({idCalendarEntry:
        First(
            Office365Outlook.GetEventsCalendarViewV3("AAM <rest of calendar ID here > ,
            Concatenate(DatePicker1_1.SelectedDate, " ",
If(Toggle1.Value=true,"00:00:00",TextInput7_1.Text)),
	        Concatenate(DatePicker1_2.SelectedDate, " ", If(Toggle1.Value=true,"23:59:59",TextInput7_2.Text)),
            {search:Concatenate("Event: ",adsComboboxEvents_2.Selected.structureName)}
             ).value
            )
    },
    Office365Outlook.V4CalendarPatchItem(
          "AAM <rest of calendar ID here >",
           idCalendarEntry,
           "New Subject Text",
           Concatenate(DatePicker1_1.SelectedDate, " ", If(Toggle1.Value=true,"00:00:00",TextInput7_1.Text)),
	        Concatenate(DatePicker1_2.SelectedDate, " ", If(Toggle1.Value=true,"23:59:59",TextInput7_2.Text)),
            "(UTC-08:00) Pacific Time (US & Canada)", 
           {Body:"Updated calendar entry body text"}
   )                    
)   

 

 

But it works here when deleting an event.

 

With({idCalendarEntry:
         First(
            Office365Outlook.GetEventsCalendarViewV3(
                    "AAM < rest of calendar ID here >",
            Concatenate(DatePicker1_1.SelectedDate, " ", If(Toggle1.Value=true,"00:00:00",TextInput7_1.Text)),
	        Concatenate(DatePicker1_2.SelectedDate, " ", If(Toggle1.Value=true,"23:59:59",TextInput7_2.Text)),
                    {search:Concatenate("Event: ",adsComboboxEvents_2.Selected.structureName)}
             ).value
            )
       },

    Office365Outlook.CalendarDeleteItemV2 (
            "AAM < rest of calendar ID here >",
           idCalendarEntry.id                    
))

 

 

Thanks again,

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,890)