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 Apps
Answered

Error Handling

(1) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi All,

 

I have a button that deletes an event in Outlook and works just fine. If the event doesn't exist it should notify the user or at least exit. I'm not sure why but I cannot get the IfError function to work. Or maybe I should use something else? Code below. Thanks in advance for any help.

amccormack_0-1653670403054.png

 

 

IfError(
With({idCalendarEntry:
 First(
 Office365Outlook.GetEventsCalendarViewV3(
 _myCalendarId,
 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 (
 _myCalendarId,
 idCalendarEntry.id 
 )), Notify ("Event Does not Exist in Outlook Calendar"))

 

Categories:
  • Verified answer
    Ben_Hoople Profile Picture
    81 on at

    thats some high-level powerapps coding, so i appreciated just reading it.

    That being said the code looks good, the problem may be with powerapps itself 😞

     

    if i can break it down into simple terms:

     

    IfError(
     With({record : First()},Delete),
     Notify()
    );

     

    I think whats happening is the IfError is looking at the With() function for an error (which it doesn't error) but the delete function inside the With() does.

     

    I might try this a couple of ways, to work with your code i might try this:

    With(
     {record : First()},IfError(Delete, Notify())
    );

     

    or:

    UpdateContext({varCalendarToDelete: First("Get calendar")});
    
    If(IsEmpty(varCalendarToDelete), Error(), Delete());


    like anything in coding, theres a million ways to do something, and as long as something works and its consistent, then its a perfectly valid solution.

     

    Hope this helps!

  • a-mccormack Profile Picture
    Microsoft Employee on at

    I couldn't get the above to work but am using the advice you gave to help solve my problem. I think you pointed me in the right direction. Thank you!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard