web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / how to specify/restric...
Power Apps
Answered

how to specify/restrict a particular room from "Book A Room" template?

(0) ShareShare
ReportReport
Posted on by

I would like to use the "Book A Room" template for booking one special room only. However, the "Book A Book" template show all available room from the room list. Any way to limit it?

 

 

Categories:
I have the same question (0)
  • Krishna92 Profile Picture
    Microsoft Employee on at

    @Anonymous 

     

    The rooms data is retrieved and is stored in a collection, this process is happening on the OnStart and you can see the same on the app's OnStart property. 

     

    If you want to limit the number of rooms list being retrieved, you can set the collection formula to,

     ClearCollect(AllRooms, FirstN(Office365.GetRoomLists().value,5))

     

    Where the number indicates number of rooms, that you want. In the above formula I'm retrieving only top 5 rooms so I have put the number to 5 the same way you can indicate any number and it will fetch the room details accordingly.

     

    If this information helps you, please hit the like button and mark the solution as resolved, so that it will help other users in future.

  • Verified answer
    Community Power Platform Member Profile Picture
    on at

    @Anonymous 

    If you just want to book a particular room you could do something like this:

     

    1. Add a Button to the screen called "RoomListSelectScreen"

    2. Add Text to this button that means something eg "Book Special Room"

    3. Add this code to the OnSelect

    Office365.V2CalendarPostItem(
     MyCalendar,
     User().FullName & "'s Booking",
     StartDateTimeUTC,
     EndDateTimeUTC,
     {
     RequiredAttendees: "Room Email address",
     Location: "Room Name",
     Importance: "Normal",
     ShowAs: "Busy"
     }
    );

    Where:

    - "Room Email Address" is the email address of the special room you wish to book, and

    - "Room Name" is the room name given to the special room you wish to book

    - Email & Name need to be inside the double quotes

     

    Note: This code will attempt to book the room you specify using the Date & Times you have selected. The App user will receive an email to say the room is then BOOKED and their calendar will update ... or ... if the room isn't available the user receives a "Booking declined ..." email. You could mess around with the code a bit more to get a better UX if you like eg. user sees a message in the App saying room is booked if unavailable, etc

     

    I tried this code on a button I created in this app and it worked fine.

  • v-xida-msft Profile Picture
    on at

    Hi @Anonymous ,

    Could you please share a bit more about your scenario?

    Do you want the "Book a Room" template app to be limited to a single one specific room rather than list all available rooms?

     

    Based on the needs that you mentioned, I think the Filter function could achieve your needs. I have made a test on my side, please consider take a try with the following workaround:

    1.JPG

    Set the OnVisible property of RoomSelectScreen to following:

    Set(CalendarFromSelectMeeting, false);
    If(DateTimeRoomChange,
     Set(AvailableRoomsCounter, 1);
     UpdateContext({ShowLoading: true});
     Set(RoomsLeft, Blank());
     Set(DateTimeRoomChange, false);
     If(!NoRoomsList,
     ClearCollect(AllRooms, // Modify formula here
    Filter(Office365.GetRoomsInRoomList(RoomsListsGallery.Selected.Address).value, Name = "Speicific Room Name You want to display"))
     );
     If(CountRows(AllRooms) > 20,
     Set(AllRoomsConnector, Concat(FirstN(AllRooms, 20), Address & ";")),
     Set(AllRoomsConnector, Concat(AllRooms, Address & ";"))
     );
    
     ClearCollect(AvailableRooms, Office365.FindMeetingTimes({RequiredAttendees: AllRoomsConnector, IsOrganizerOptional: true, 
     Start: StartDateTimeUTC, End: EndDateTimeUTC, MeetingDuration: DateDiff(StartDateTime, EndDateTime, Minutes),
     MinimumAttendeePercentage: "1", ActivityDomain: "Unrestricted"}));
    
     ClearCollect(AvailableRoomsSorted, SortByColumns(First(AvailableRooms).MeetingTimeSuggestions, "Confidence", Descending));
    
     ClearCollect(AvailableRoomsConcat, Concat(Filter(First(AvailableRoomsSorted).AttendeeAvailability, Availability = "Free"), 
     Attendee.EmailAddress.Address, ","));
    
     ClearCollect(AvailableRoomEmails, Split(First(AvailableRoomsConcat).Value, ","));
    
     ClearCollect(AvailableRoomEmailName, AddColumns(RenameColumns(AvailableRoomEmails, "Result", "Email"), "Name", 
     LookUp(AllRooms, Email = Address).Name));
    
     UpdateContext({ShowLoading: false});
     Set(RoomsLeft, CountRows(AllRooms) - 20 * AvailableRoomsCounter)
    )

    then re-load your app, check if the issue is solved.

     

    Best regards,

  • Community Power Platform Member Profile Picture
    on at

    Thanks for that! I can book the room i want, however, any ways to setup a few "available time" timelsot for users to select from?

    Like 10:00-10:30, 10:30-11:00 <- which system will only display those available timeslot...

    @Anonymous any idea?

  • Community Power Platform Member Profile Picture
    on at

    @Anonymous 

    Yes, this app builds a collection of available rooms based on the times/date selected. The code for this is spread across OnVisible and various buttons OnSelect. The idea would be to mirror this code for available time slots instead. A bit of work to setup but doable. 

  • Community Power Platform Member Profile Picture
    on at

    Thanks! Any sample code can share?

  • gsoandy94 Profile Picture
    2 on at

    Hello, I know this post is several years old, but I need to restrict the list of available rooms to rooms from a specific location. My specific building has about 8 rooms that we need to have users to have the ability to book while the organization has over 30. Currently the off the shelf app lists all the rooms in the organization. Can you share a code that will allow me to filter availability for only the 8 rooms in my building?

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard