class RoomList
Represents a group of room objects (room list) defined in a Microsoft 365 tenant, providing access to room collections and their email addresses.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/outlook/calendar/rooms/list.py
9 - 27
moderate
Purpose
This class models a room list in Microsoft 365/Outlook, which is a collection of meeting rooms. It extends the Place class to provide specific functionality for managing and accessing groups of rooms within a tenant. The class allows retrieval of the room list's email address and provides navigation to the individual Room objects contained within the list. It's primarily used in calendar and room booking scenarios within Microsoft 365 integrations.
Source Code
class RoomList(Place):
"""Represents a group of room objects defined in the tenant."""
@property
def email_address(self):
# type: () -> Optional[str]
"""The email address of the room list"""
return self.properties.get("emailAddress", None)
@property
def calendars(self):
# type: () -> EntityCollection[Room]
"""The calendars in the calendar group. Navigation property. Read-only. Nullable."""
return self.properties.get(
"rooms",
EntityCollection(
self.context, Room, ResourcePath("rooms", self.resource_path)
),
)
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
Place | - |
Parameter Details
context: The client context object required for making API calls to Microsoft 365 services. Inherited from parent Place class, used to maintain connection state and authentication.
resource_path: The resource path identifying this room list in the Microsoft Graph API hierarchy. Inherited from parent Place class, used for constructing API endpoints.
Return Value
Instantiation returns a RoomList object that represents a specific room list in the tenant. The object provides access to the room list's properties including its email address and a collection of Room objects. Properties return either Optional[str] for email_address or EntityCollection[Room] for calendars/rooms.
Class Interface
Methods
@property email_address() -> Optional[str]
property
Purpose: Retrieves the email address associated with this room list
Returns: The email address of the room list as a string, or None if not available
@property calendars() -> EntityCollection[Room]
property
Purpose: Provides access to the collection of Room objects contained in this room list
Returns: An EntityCollection containing Room objects that are part of this room list. This is a navigation property that is read-only and nullable.
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
properties |
dict | Dictionary containing the raw property data for the room list, inherited from parent class. Used internally to store API response data including emailAddress and rooms. | instance |
context |
ClientContext | The client context object used for making API calls to Microsoft 365 services. Inherited from parent Place class. | instance |
resource_path |
ResourcePath | The resource path identifying this room list in the Microsoft Graph API hierarchy. Inherited from parent Place class. | instance |
Dependencies
typingoffice365.entity_collectionoffice365.outlook.calendar.placeoffice365.outlook.calendar.rooms.roomoffice365.runtime.paths.resource_path
Required Imports
from typing import Optional
from office365.entity_collection import EntityCollection
from office365.outlook.calendar.place import Place
from office365.outlook.calendar.rooms.room import Room
from office365.runtime.paths.resource_path import ResourcePath
Usage Example
# Assuming you have a configured client context
from office365.outlook.calendar.rooms.room_list import RoomList
from office365.runtime.client_context import ClientContext
# Get a room list from the context (typically retrieved via API call)
room_list = context.get_room_list('room-list-id')
# Access the email address of the room list
email = room_list.email_address
print(f"Room list email: {email}")
# Access the collection of rooms in this list
rooms_collection = room_list.calendars
for room in rooms_collection:
print(f"Room: {room.display_name}")
# The calendars property provides navigation to individual Room objects
rooms = room_list.calendars.get().execute_query()
for room in rooms:
print(f"Room email: {room.email_address}")
Best Practices
- Always ensure the client context is properly authenticated before accessing RoomList properties
- The calendars property returns an EntityCollection which may require calling execute_query() to fetch actual data from the API
- Email address may be None if not set or not accessible, always check for None before using
- RoomList inherits from Place, so all Place properties and methods are available
- The properties dictionary is lazily loaded, so accessing properties may trigger API calls
- Use the calendars property to navigate to individual Room objects rather than accessing them directly
- Consider caching room list data if accessed frequently to minimize API calls
- Handle potential API errors when accessing properties that require network calls
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class Room 75.0% similar
-
class Place 65.2% similar
-
class Location 60.1% similar
-
class CalendarGroup 58.9% similar
-
class Event 56.5% similar