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.
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"))
Solved! Go to Solution.
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!
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!
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!
User | Count |
---|---|
251 | |
102 | |
94 | |
48 | |
37 |