class LocationConstraint
A class representing location constraints for meeting scheduling, specifying whether locations are required, which locations to consider, and whether to suggest locations.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/outlook/calendar/location_constraint.py
6 - 21
simple
Purpose
This class encapsulates the conditions and preferences a client specifies regarding meeting locations when searching for available meeting times. It is used in conjunction with meeting scheduling services (like Microsoft Graph's findMeetingTimes API) to communicate location requirements, provide a list of acceptable locations, and indicate whether the service should suggest locations. The class inherits from ClientValue, making it suitable for serialization and transmission to remote services.
Source Code
class LocationConstraint(ClientValue):
"""The conditions stated by a client for the location of a meeting."""
def __init__(self, is_required=None, locations=None, suggest_location=None):
"""
:param bool is_required: The client requests the service to include in the response a meeting location
for the meeting. If this is true and all the resources are busy, findMeetingTimes will not return any
meeting time suggestions. If this is false and all the resources are busy, findMeetingTimes would still
look for meeting times without locations.
:param list[LocationConstraintItem] locations: Constraint information for one or more locations that the client
requests for the meeting
:param bool suggest_location: The client requests the service to suggest one or more meeting locations.
"""
self.isRequired = is_required
self.locations = ClientValueCollection(LocationConstraintItem, locations)
self.suggestLocation = suggest_location
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
ClientValue | - |
Parameter Details
is_required: Boolean flag indicating whether a meeting location must be included in the response. When True, the service will not return meeting time suggestions if all resources are busy. When False, the service will still suggest meeting times even if no locations are available. Defaults to None if not specified.
locations: A list of LocationConstraintItem objects representing specific locations that the client wants to consider for the meeting. Each item contains constraint information for a particular location. Can be None or an empty list if no specific locations are required.
suggest_location: Boolean flag indicating whether the client wants the service to suggest one or more meeting locations. When True, the service will provide location recommendations. Defaults to None if not specified.
Return Value
Instantiation returns a LocationConstraint object with three attributes: isRequired (bool or None), locations (ClientValueCollection of LocationConstraintItem objects), and suggestLocation (bool or None). The object can be used to configure location preferences for meeting time searches.
Class Interface
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
isRequired |
bool or None | Indicates whether a meeting location must be included in the response. When True, no meeting times will be suggested if all resources are busy. When False, meeting times may be suggested without locations. | instance |
locations |
ClientValueCollection[LocationConstraintItem] | A collection of LocationConstraintItem objects representing specific locations that the client requests for the meeting. Automatically wrapped in ClientValueCollection during initialization. | instance |
suggestLocation |
bool or None | Indicates whether the client requests the service to suggest one or more meeting locations. When True, the service will provide location recommendations. | instance |
Dependencies
office365
Required Imports
from office365.outlook.mail.location_constraint_item import LocationConstraintItem
from office365.runtime.client_value import ClientValue
from office365.runtime.client_value_collection import ClientValueCollection
Usage Example
from office365.outlook.mail.location_constraint import LocationConstraint
from office365.outlook.mail.location_constraint_item import LocationConstraintItem
# Create location constraint items
location1 = LocationConstraintItem()
location2 = LocationConstraintItem()
# Create a location constraint requiring specific locations
constraint = LocationConstraint(
is_required=True,
locations=[location1, location2],
suggest_location=False
)
# Access attributes
print(constraint.isRequired) # True
print(len(constraint.locations)) # 2
print(constraint.suggestLocation) # False
# Create a flexible constraint that allows location suggestions
flexible_constraint = LocationConstraint(
is_required=False,
suggest_location=True
)
Best Practices
- Set is_required=True only when a physical location is absolutely necessary, as this may limit available meeting time suggestions
- Use suggest_location=True when you want the service to recommend locations rather than specifying them explicitly
- Provide a list of LocationConstraintItem objects in the locations parameter when you have specific location preferences
- The locations attribute is automatically wrapped in a ClientValueCollection, so you can pass a plain list during initialization
- All parameters are optional and default to None, allowing flexible configuration based on specific needs
- This class is typically used as part of a larger meeting request object when calling findMeetingTimes or similar scheduling APIs
- The class inherits from ClientValue, which means it can be serialized for API requests automatically
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class LocationConstraintItem 85.1% similar
-
class TimeConstraint 69.2% similar
-
class Location 67.5% similar
-
class MeetingTimeSuggestion 64.9% similar
-
class MeetingInfo 57.0% similar