
Announcements
In Power Apps - App is adding selected users (which exist in Azure) to a Office365group.
For All(
my collection,
Office365Groups.AddMemberToGroup(
"xxx",
Id
)
);
How would you add an error handling routine where if all the items from the collection was added then "User(s) Added Successfully" Notification is displayed otherwise "Only User(s) that do not exist in Group were Added" Notification is displayed
Hi
To add error handling to your code in Power Apps, you can utilize a combination of functions like 'If', 'ForAll', and 'Notify'.
ClearCollect(
UserAddResults,
ForAll(
myCollection,
{
Result: Office365Groups.AddMemberToGroup("xxx", Id)
}
)
);
// Check if any user failed to be added to the group
If(
CountRows(Filter(UserAddResults, Result <> 200)) = 0,
Notify("User(s) Added Successfully", Success),
Notify("Only User(s) that do not exist in Group were Added", Error)
);
(Or)
ForAll(
MyCollection,
If(
Office365Groups.AddMemberToGroup("xxx", Id),
Notify("User(s) Added Successfully", NotificationType.Success),
Notify("Only User(s) that do not exist in Group were Added", NotificationType.Error) ) )
Thanks!
If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.