Teams

class O365.teams.Activity(*values)[source]

Bases: Enum

Valid values for Activity.

AVAILABLE = 'Available'
AWAY = 'Away'
INACALL = 'InACall'
INACONFERENCECALL = 'InAConferenceCall'
PRESENTING = 'Presenting'
class O365.teams.App(*, parent=None, con=None, **kwargs)[source]

Bases: ApiComponent

A Microsoft Teams app

__init__(*, parent=None, con=None, **kwargs)[source]

A Microsoft Teams app

Parameters:
  • parent (Teams) – parent object

  • con (Connection) – connection to use if no parent specified

  • protocol (Protocol) – protocol to use if no parent specified (kwargs)

  • main_resource (str) – use this resource instead of parent resource (kwargs)

app_definition

The details for each version of the app.

   Type: list[teamsAppDefinition]

object_id

The app ID generated for the catalog is different from the developer-provided ID found within the Microsoft Teams zip app package. The externalId value is empty for apps with a distributionMethod type of store. When apps are published to the global store, the id of the app matches the id in the app manifest.

   Type: str

class O365.teams.Availability(*values)[source]

Bases: Enum

Valid values for Availability.

AVAILABLE = 'Available'
AWAY = 'Away'
BUSY = 'Busy'
DONOTDISTURB = 'DoNotDisturb'
class O365.teams.Channel(*, parent=None, con=None, **kwargs)[source]

Bases: ApiComponent

A Microsoft Teams channel

__init__(*, parent=None, con=None, **kwargs)[source]

A Microsoft Teams channel

Parameters:
  • parent (Teams or Team) – parent object

  • con (Connection) – connection to use if no parent specified

  • protocol (Protocol) – protocol to use if no parent specified (kwargs)

  • main_resource (str) – use this resource instead of parent resource (kwargs)

get_message(message_id)[source]

Returns a specified channel chat messages :param message_id: number of messages to retrieve :type message_id: int or str :rtype: ChannelMessage

get_messages(limit=None, batch=None)[source]

Returns a list of channel chat messages :param int limit: number of messages to retrieve :param int batch: number of messages to be in each data set :rtype: list[ChannelMessage] or Pagination of ChannelMessage

send_message(content=None, content_type='text')[source]

Sends a message to the channel :param content: str of text, str of html, or dict representation of json body :type content: str or dict :param str content_type: ‘text’ to render the content as text or ‘html’ to render the content as html :rtype: ChannelMessage

description

Optional textual description for the channel.

   Type: str

display_name

Channel name as it will appear to the user in Microsoft Teams.

   Type: str

email

The email address for sending messages to the channel.

   Type: str

object_id

The channel’s unique identifier.

   Type: str

class O365.teams.ChannelMessage(**kwargs)[source]

Bases: ChatMessage

A Microsoft Teams chat message that is the start of a channel thread

__init__(**kwargs)[source]

A Microsoft Teams chat message that is the start of a channel thread

get_replies(limit=None, batch=None)[source]

Returns a list of replies to the channel chat message :param int limit: number of replies to retrieve :param int batch: number of replies to be in each data set :rtype: list or Pagination

get_reply(message_id)[source]

Returns a specified reply to the channel chat message :param message_id: the message_id of the reply to retrieve :type message_id: str or int :rtype: ChatMessage

send_reply(content=None, content_type='text')[source]

Sends a reply to the channel chat message :param content: str of text, str of html, or dict representation of json body :type content: str or dict :param str content_type: ‘text’ to render the content as text or ‘html’ to render the content as html

channel_id

The identity of the team in which the message was posted.

   Type: str

team_id

The identity of the channel in which the message was posted.

   Type: str

class O365.teams.Chat(*, parent=None, con=None, **kwargs)[source]

Bases: ApiComponent

A Microsoft Teams chat

__init__(*, parent=None, con=None, **kwargs)[source]

A Microsoft Teams chat :param parent: parent object :type parent: Teams :param Connection con: connection to use if no parent specified :param Protocol protocol: protocol to use if no parent specified (kwargs) :param str main_resource: use this resource instead of parent resource (kwargs)

get_member(membership_id)[source]

Returns a specified conversation member :param str membership_id: membership_id of member to retrieve :rtype: ConversationMember

get_members()[source]

Returns a list of conversation members :rtype: list[ConversationMember]

get_message(message_id)[source]

Returns a specified message from the chat :param message_id: the message_id of the message to receive :type message_id: str or int :rtype: ChatMessage

get_messages(limit=None, batch=None)[source]

Returns a list of chat messages from the chat :param int limit: number of replies to retrieve :param int batch: number of replies to be in each data set :rtype: list[ChatMessage] or Pagination of ChatMessage

send_message(content=None, content_type='text')[source]

Sends a message to the chat :param content: str of text, str of html, or dict representation of json body :type content: str or dict :param str content_type: ‘text’ to render the content as text or ‘html’ to render the content as html :rtype: ChatMessage

chat_type

Specifies the type of chat. Possible values are: group, oneOnOne, meeting, unknownFutureValue.

   Type: chatType

created_date

Date and time at which the chat was created.

   Type: datetime

last_update_date

Date and time at which the chat was renamed or the list of members was last changed.

   Type: datetime

object_id

The chat’s unique identifier.

   Type: str

topic

Subject or topic for the chat. Only available for group chats.

   Type: str

web_url

The URL for the chat in Microsoft Teams.

   Type: str

class O365.teams.ChatMessage(*, parent=None, con=None, **kwargs)[source]

Bases: ApiComponent

A Microsoft Teams chat message

__init__(*, parent=None, con=None, **kwargs)[source]

A Microsoft Teams chat message :param parent: parent object :type parent: Channel, Chat, or ChannelMessage :param Connection con: connection to use if no parent specified :param Protocol protocol: protocol to use if no parent specified (kwargs) :param str main_resource: use this resource instead of parent resource (kwargs)

channel_identity

If the message was sent in a channel, represents identity of the channel.

   Type: channelIdentity

chat_id

If the message was sent in a chat, represents the identity of the chat.

   Type: str

content

The content of the item.

   Type: str

content_type

The type of the content. Possible values are text and html.

   Type: bodyType

created_date

Timestamp of when the chat message was created.

   Type: datetime

deleted_date

Timestamp at which the chat message was deleted, or null if not deleted.

   Type: datetime

from_display_name

Name of the user or application message was sent from.

   Type: str

from_id

Id of the user or application message was sent from.

   Type: str

from_type

Type of the user or application message was sent from.

   Type: any

importance

The importance of the chat message.

   Type: str

last_edited_date

Timestamp when edits to the chat message were made. Triggers an “Edited” flag in the Teams UI.

   Type: datetime

last_modified_date

Timestamp when the chat message is created (initial setting) or modified, including when a reaction is added or removed.

   Type: datetime

message_type

The type of chat message.

   Type: chatMessageType

object_id

Unique ID of the message.

   Type: str

reply_to_id

ID of the parent chat message or root chat message of the thread.

   Type: str

subject

The subject of the chat message, in plaintext.

   Type: str

summary

Summary text of the chat message that could be used for push notifications and summary views or fall back views.

   Type: str

web_url

Link to the message in Microsoft Teams.

   Type: str

class O365.teams.ConversationMember(*, parent=None, con=None, **kwargs)[source]

Bases: ApiComponent

A Microsoft Teams conversation member

__init__(*, parent=None, con=None, **kwargs)[source]

A Microsoft Teams conversation member :param parent: parent object :type parent: Chat :param Connection con: connection to use if no parent specified :param Protocol protocol: protocol to use if no parent specified (kwargs) :param str main_resource: use this resource instead of parent resource (kwargs)

class O365.teams.PreferredActivity(*values)[source]

Bases: Enum

Valid values for Activity.

AVAILABLE = 'Available'
AWAY = 'Away'
BERIGHTBACK = 'BeRightBack'
BUSY = 'Busy'
DONOTDISTURB = 'DoNotDisturb'
OFFWORK = 'OffWork'
class O365.teams.PreferredAvailability(*values)[source]

Bases: Enum

Valid values for Availability.

AVAILABLE = 'Available'
AWAY = 'Away'
BERIGHTBACK = 'BeRightBack'
BUSY = 'Busy'
DONOTDISTURB = 'DoNotDisturb'
OFFLINE = 'Offline'
class O365.teams.Presence(*, parent=None, con=None, **kwargs)[source]

Bases: ApiComponent

Microsoft Teams Presence

__init__(*, parent=None, con=None, **kwargs)[source]

Microsoft Teams Presence

Parameters:
  • parent (Teams) – parent object

  • con (Connection) – connection to use if no parent specified

  • protocol (Protocol) – protocol to use if no parent specified (kwargs)

  • main_resource (str) – use this resource instead of parent resource (kwargs)

activity

The supplemental information to a user’s availability. Possible values are Available, Away, BeRightBack, Busy, DoNotDisturb, InACall, InAConferenceCall, Inactive, InAMeeting, Offline, OffWork, OutOfOffice, PresenceUnknown, Presenting, UrgentInterruptionsOnly.

   Type: list[str]

availability

The base presence information for a user. Possible values are Available, AvailableIdle, Away, BeRightBack, Busy, BusyIdle, DoNotDisturb, Offline, PresenceUnknown

   Type: list[str]

object_id

The unique identifier for the user.

   Type: str

class O365.teams.Team(*, parent=None, con=None, **kwargs)[source]

Bases: ApiComponent

A Microsoft Teams team

__init__(*, parent=None, con=None, **kwargs)[source]

A Microsoft Teams team

Parameters:
  • parent (Teams) – parent object

  • con (Connection) – connection to use if no parent specified

  • protocol (Protocol) – protocol to use if no parent specified (kwargs)

  • main_resource (str) – use this resource instead of parent resource (kwargs)

get_channel(channel_id)[source]

Returns a channel of the team

Parameters:

channel_id – the team_id of the channel to be retrieved.

Return type:

Channel

get_channels()[source]

Returns a list of channels the team

Return type:

list[Channel]

description

An optional description for the team.

   Type: str

display_name

The name of the team.

   Type: str

is_archived

Whether this team is in read-only mode.

   Type: bool

object_id

The unique identifier of the team.

   Type: str

web_url

A hyperlink that goes to the team in the Microsoft Teams client.

   Type: str

class O365.teams.Teams(*, parent=None, con=None, **kwargs)[source]

Bases: ApiComponent

A Microsoft Teams class

__init__(*, parent=None, con=None, **kwargs)[source]

A Teams object

Parameters:
  • parent (Account) – parent object

  • con (Connection) – connection to use if no parent specified

  • protocol (Protocol) – protocol to use if no parent specified (kwargs)

  • main_resource (str) – use this resource instead of parent resource (kwargs)

create_channel(team_id, display_name, description=None)[source]

Creates a channel within a specified team

Parameters:
  • team_id – the team_id where the channel is created.

  • display_name – the channel display name.

  • description – the channel description.

Return type:

Channel

get_apps_in_team(team_id)[source]

Returns a list of apps of a specified team

Parameters:

team_id – the team_id of the team to get the apps of.

Return type:

list[App]

get_channel(team_id, channel_id)[source]

Returns the channel info for a given channel

Parameters:
  • team_id – the team_id of the channel.

  • channel_id – the channel_id of the channel.

Return type:

list[Channel]

get_channels(team_id)[source]

Returns a list of channels of a specified team

Parameters:

team_id – the team_id of the channel to be retrieved.

Return type:

list[Channel]

get_my_chats(limit=None, batch=None)[source]

Returns a list of chats that I am in :param int limit: number of chats to retrieve :param int batch: number of chats to be in each data set :rtype: list[ChatMessage] or Pagination of Chat

get_my_presence()[source]

Returns my availability and activity

Return type:

Presence

get_my_teams()[source]

Returns a list of teams that I am in

Return type:

list[Team]

get_user_presence(user_id=None, email=None)[source]

Returns specific user availability and activity

Return type:

Presence

set_my_presence(session_id, availability: Availability, activity: Activity, expiration_duration)[source]

Sets my presence status

Parameters:
  • session_id – the session/capplication id.

  • availability – the availability.

  • activity – the activity.

  • activity – the expiration_duration when status will be unset.

Return type:

Presence

set_my_user_preferred_presence(availability: PreferredAvailability, activity: PreferredActivity, expiration_duration)[source]

Sets my user preferred presence status

Parameters:
  • availability – the availability.

  • activity – the activity.

  • activity – the expiration_duration when status will be unset.

Return type:

Presence