class Contact
User's contact.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/outlook/contacts/contact.py
18 - 131
moderate
Purpose
User's contact.
Source Code
class Contact(OutlookItem):
"""User's contact."""
@property
def business_phones(self):
"""The contact's business phone numbers."""
return self.properties.setdefault("businessPhones", StringCollection())
@property
def display_name(self):
# type: () -> Optional[str]
"""
The contact's display name. You can specify the display name in a create or update operation.
Note that later updates to other properties may cause an automatically generated value to overwrite the
displayName value you have specified. To preserve a pre-existing value, always include it as displayName
in an update operation.
"""
return self.properties.get("displayName", None)
@property
def manager(self):
# type: () -> Optional[str]
"""
The name of the contact's manager.
"""
return self.properties.get("manager", None)
@manager.setter
def manager(self, value):
# type: (str) -> None
"""Sets name of the contact's manager."""
self.set_property("manager", value)
@property
def mobile_phone(self):
# type: () -> Optional[str]
"""The contact's mobile phone number."""
return self.properties.get("mobilePhone", None)
@mobile_phone.setter
def mobile_phone(self, value):
# type: (str) -> None
"""Sets contact's mobile phone number."""
self.set_property("mobilePhone", value)
@property
def home_address(self):
"""The contact's home address."""
return self.properties.get("homeAddress", PhysicalAddress())
@property
def email_addresses(self):
# type: () -> ClientValueCollection[EmailAddress]
"""The contact's email addresses."""
return self.properties.setdefault(
"emailAddresses", ClientValueCollection(EmailAddress)
)
@property
def extensions(self):
# type: () -> EntityCollection[Extension]
"""The collection of open extensions defined for the contact. Nullable."""
return self.properties.get(
"extensions",
EntityCollection(
self.context, Extension, ResourcePath("extensions", self.resource_path)
),
)
@property
def photo(self):
"""Optional contact picture. You can get or set a photo for a contact."""
return self.properties.get(
"photo",
ProfilePhoto(self.context, ResourcePath("photo", self.resource_path)),
)
@property
def multi_value_extended_properties(self):
# type: () -> EntityCollection[MultiValueLegacyExtendedProperty]
"""The collection of multi-value extended properties defined for the Contact."""
return self.properties.get(
"multiValueExtendedProperties",
EntityCollection(
self.context,
MultiValueLegacyExtendedProperty,
ResourcePath("multiValueExtendedProperties", self.resource_path),
),
)
@property
def single_value_extended_properties(self):
# type: () -> EntityCollection[SingleValueLegacyExtendedProperty]
"""The collection of single-value extended properties defined for the Contact."""
return self.properties.get(
"singleValueExtendedProperties",
EntityCollection(
self.context,
SingleValueLegacyExtendedProperty,
ResourcePath("singleValueExtendedProperties", self.resource_path),
),
)
def get_property(self, name, default_value=None):
if default_value is None:
property_mapping = {
"businessPhones": self.business_phones,
"emailAddresses": self.email_addresses,
"homeAddress": self.home_address,
"multiValueExtendedProperties": self.multi_value_extended_properties,
"singleValueExtendedProperties": self.single_value_extended_properties,
}
default_value = property_mapping.get(name, None)
return super(Contact, self).get_property(name, default_value)
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
OutlookItem | - |
Parameter Details
bases: Parameter of type OutlookItem
Return Value
Returns unspecified type
Class Interface
Methods
business_phones(self)
property
Purpose: The contact's business phone numbers.
Returns: None
display_name(self)
property
Purpose: The contact's display name. You can specify the display name in a create or update operation. Note that later updates to other properties may cause an automatically generated value to overwrite the displayName value you have specified. To preserve a pre-existing value, always include it as displayName in an update operation.
Returns: None
manager(self)
property
Purpose: The name of the contact's manager.
Returns: None
manager(self, value)
Purpose: Sets name of the contact's manager.
Parameters:
value: Parameter
Returns: None
mobile_phone(self)
property
Purpose: The contact's mobile phone number.
Returns: None
mobile_phone(self, value)
Purpose: Sets contact's mobile phone number.
Parameters:
value: Parameter
Returns: None
home_address(self)
property
Purpose: The contact's home address.
Returns: None
email_addresses(self)
property
Purpose: The contact's email addresses.
Returns: None
extensions(self)
property
Purpose: The collection of open extensions defined for the contact. Nullable.
Returns: None
photo(self)
property
Purpose: Optional contact picture. You can get or set a photo for a contact.
Returns: None
multi_value_extended_properties(self)
property
Purpose: The collection of multi-value extended properties defined for the Contact.
Returns: None
single_value_extended_properties(self)
property
Purpose: The collection of single-value extended properties defined for the Contact.
Returns: None
get_property(self, name, default_value)
Purpose: Retrieves property
Parameters:
name: Parameterdefault_value: Parameter
Returns: None
Required Imports
from typing import Optional
from office365.directory.extensions.extended_property import MultiValueLegacyExtendedProperty
from office365.directory.extensions.extended_property import SingleValueLegacyExtendedProperty
from office365.directory.extensions.extension import Extension
from office365.directory.profile_photo import ProfilePhoto
Usage Example
# Example usage:
# result = Contact(bases)
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class ContactFolder 60.9% similar
-
class UserCollection_v1 51.6% similar
-
class UserProfile_v1 49.0% similar
-
class Presence 48.0% similar
-
class EmailAddress 46.6% similar