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 Platform Community / Forums / Power Apps / Calling Office 365 Use...
Power Apps
Answered

Calling Office 365 Users connection multiple times in an If-statement

(0) ShareShare
ReportReport
Posted on by 19

Hi!

I am making an app to get an overview of the users who have booked the meeting rooms in my department.

 

Because there are so many ways to book rooms in Outlook, the syntax has to account for solutions where the user who book can end up being both the organizer for the event, but also just a required attendee. 

Likewise, the meeting room might sometimes be an organizer, and at other times a resource attendee, an optional attendee, or a required attendee.

 

I have made an if-statement with two different alls to the Office 365 Users-connection, based on whether the user is the organizer or an attendee. However, the If-statement runs both calls, and since only one of them will ever be true at any time, I get a 404 error. 

Any ideas on how to make it so that the code skips the call that doesn't match the inital check? Or, any other tips on how to make this work? I feel like the solution is probably simple, but I am just so lost on this one 😅

 

 

 

 

If(
 //Checks if there is a reservation on the meeting room. If yes, returns photo, if no, returns icon showing free
 IsEmpty(Search(colEvents,"MeetingRoom","organizer","optionalAttendees","requiredAttendees","resourceAttendees")),
 
 //If the meeting room is not organizer, looks up user as organizer
 If(
 IsBlank(LookUp(colEvents,"MeetingRoom" in organizer)),
 'Office365-brukere'.UserPhotoV2(
 LookUp(colEvents,"MeetingRoom" in resourceAttendees Or organizer Or optionalAttendees,organizer)),
 
 //If meeting room is organizer, looks up user from Required Attendees, and cleans string
 'Office365-brukere'.UserPhotoV2(
 Left(LookUp(colEvents,"MeetingRoom" in organizer,requiredAttendees),
 Len(LookUp(colEvents,"MeetingRoom" in organizer,requiredAttendees))-1))),
 
 //If no, show space as free
 ledig_ico)

 

 

 

 

Any tips would be very welcome!

Categories:
I have the same question (0)
  • Verified answer
    idanorin Profile Picture
    19 on at

    Ended up solving this by putting the If-statement within the Outlook 365-call. 

     

    Additionally, I am running the if-statement first with an IsBlankOrError to ensure that the statement will return an id for the office365-connection to use. If it does, I pass on the query. If not, it instead puts in a placeholder icon. 

     

    //Same code snippet twice – first to check for error or blank – if it is, it will show reservation icon
     If(!IsBlankOrError('Office365-brukere'.UserPhotoV2(
    
     If(
     
     //If meeting room is organizer, fetch participant from requiredAttendees, and clean string to fetch image
     !IsBlank(LookUp(colEvents,"MeetingRoom" in organizer)),
     (Left(LookUp(colEvents,"MeetingRoom" in organizer,requiredAttendees),
     Len(LookUp(colEvents,"MeetingRoom" in organizer,requiredAttendees))-1)),
    
    
     //If participant is organizer, fetch image
     !IsBlank(Search(colEvents,"MeetingRoom","optionalAttendees","requiredAttendees","resourceAttendees")),
     First(Search(colEvents, "MeetingRoom", "optionalAttendees", "requiredAttendees", "resourceAttendees")).organizer))), 
    
    'Office365-brukere'.UserPhotoV2(
    
     If(
     
     //If meeting room is organizer, fetch participant from requiredAttendees, and clean string to fetch image
     !IsBlank(LookUp(colEvents,"MeetingRoom" in organizer)),
     (Left(LookUp(colEvents,"MeetingRoom" in organizer,requiredAttendees),
     Len(LookUp(colEvents,"MeetingRoom" in organizer,requiredAttendees))-1)),
    
     //If participant is organizer, fetch image
     !IsBlank(
    Search(colEvents,"MeetingRoom","optionalAttendees","requiredAttendees","resourceAttendees")),
     First(Search(colEvents, "MeetingRoom", "optionalAttendees", "requiredAttendees", "resourceAttendees")).organizer)),
    
     
     //If room is free, set reservation icon
    
    ledig_ico)

     

  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @idanorin,

    Thanks for your sharing.

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
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 207 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 150 Super User 2026 Season 2

Last 30 days Overall leaderboard