class Place
Represents a physical location with basic attributes including name, address, and phone number. Serves as a base class for more specialized location types like rooms and room lists.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/outlook/calendar/place.py
5 - 24
simple
Purpose
The Place class provides a standardized way to represent location information in the Office365 API context. It inherits from Entity and exposes location attributes through read-only properties. This class is designed to be used as a base type for richer location representations and provides access to display name, physical address, and phone number information stored in the underlying properties dictionary.
Source Code
class Place(Entity):
"""Represents basic location attributes such as name, physical address, and geographic coordinates.
This is the base type for richer location types such as room and roomList."""
@property
def display_name(self):
"""The name associated with the place.
:rtype: str or None
"""
return self.properties.get("displayName", None)
@property
def address(self):
"""The street address of the place."""
return self.properties.get("address", PhysicalAddress())
@property
def phone(self):
"""The phone number of the place."""
return self.properties.get("phone", None)
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
Entity | - |
Parameter Details
Entity_base_class: Inherits from Entity class which provides the base functionality and properties dictionary for storing location data. The Entity base class manages the underlying data structure accessed through self.properties.
Return Value
Instantiation returns a Place object that provides property-based access to location attributes. The display_name property returns a string or None, the address property returns a PhysicalAddress object (or empty PhysicalAddress if not set), and the phone property returns a string or None.
Class Interface
Methods
@property display_name(self) -> str | None
property
Purpose: Retrieves the name associated with the place from the properties dictionary
Returns: String containing the display name of the place, or None if not set
@property address(self) -> PhysicalAddress
property
Purpose: Retrieves the physical street address of the place
Returns: PhysicalAddress object containing the street address information, or an empty PhysicalAddress object if not set
@property phone(self) -> str | None
property
Purpose: Retrieves the phone number associated with the place
Returns: String containing the phone number, or None if not set
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
properties |
dict | Inherited from Entity base class. Dictionary storing the underlying place data including displayName, address, and phone keys | instance |
Dependencies
office365
Required Imports
from office365.entity import Entity
from office365.outlook.mail.physical_address import PhysicalAddress
Usage Example
# Assuming Entity base class is properly initialized
from office365.entity import Entity
from office365.outlook.mail.physical_address import PhysicalAddress
# Place is typically instantiated through Office365 API responses
# but can be created directly if needed
place = Place()
# Access location properties
name = place.display_name # Returns string or None
address = place.address # Returns PhysicalAddress object
phone = place.phone # Returns string or None
# Properties are read-only and retrieve data from underlying properties dict
if place.display_name:
print(f"Location: {place.display_name}")
if place.phone:
print(f"Phone: {place.phone}")
Best Practices
- This class is designed as a read-only data container - properties retrieve data from the underlying properties dictionary but do not provide setters
- The class is typically instantiated and populated by the Office365 API framework rather than manually constructed
- Always check if display_name or phone properties return None before using them, as they may not be set
- The address property returns an empty PhysicalAddress object if not set, rather than None, so check its contents rather than null-checking
- This class serves as a base type - consider using more specialized subclasses like Room or RoomList for specific use cases
- Properties access the underlying self.properties dictionary using get() method with defaults, ensuring safe access even if keys don't exist
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class Room 68.1% similar
-
class RoomList 65.2% similar
-
class Location 63.5% similar
-
class PhysicalAddress 61.3% similar
-
class FieldLocation 55.0% similar