code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def syncissues_folder(self): """Shortcut to get Sync Issues Folder instance The folder that contains synchronization logs created by Outlook. :rtype: mailbox.Folder """ return self.folder_constructor( parent=self, name="Sync Issues", f...
Shortcut to get Sync Issues Folder instance The folder that contains synchronization logs created by Outlook. :rtype: mailbox.Folder
syncissues_folder
python
O365/python-o365
O365/mailbox.py
https://github.com/O365/python-o365/blob/master/O365/mailbox.py
Apache-2.0
def save_as_eml(self, attachment, to_path=None): """Saves this message as and EML to the file system :param MessageAttachment attachment: the MessageAttachment to store as eml. :param Path or str to_path: the path where to store this file """ mime_content = self.get_mime_content(...
Saves this message as and EML to the file system :param MessageAttachment attachment: the MessageAttachment to store as eml. :param Path or str to_path: the path where to store this file
save_as_eml
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def _get_mime_url(self, attachment: MessageAttachment) -> str: """ Returns the url used to get the MIME contents of this attachment""" if ( not attachment or not isinstance(attachment, MessageAttachment) or attachment.attachment_id is None or attachment.at...
Returns the url used to get the MIME contents of this attachment
_get_mime_url
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def get_mime_content(self, attachment: MessageAttachment): """Returns the MIME contents of this attachment""" url = self._get_mime_url(attachment) response = self._parent.con.get(url) if not response: return None return response.content
Returns the MIME contents of this attachment
get_mime_content
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def get_eml_as_object(self, attachment: MessageAttachment): """ Returns a Message object out an eml attached message """ url = self._get_mime_url(attachment) # modify the url to retrieve the eml message contents item_attachment_keyword = self.protocol.keyword_data_store.get("item_attac...
Returns a Message object out an eml attached message
get_eml_as_object
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def __init__(self, parent, flag_data): """An flag on a message Not available on Outlook Rest Api v2 (only in beta) :param parent: parent of this :type parent: Message :param dict flag_data: flag data from cloud """ super().__init__(protocol=parent.protocol, main_...
An flag on a message Not available on Outlook Rest Api v2 (only in beta) :param parent: parent of this :type parent: Message :param dict flag_data: flag data from cloud
__init__
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def set_flagged(self, *, start_date=None, due_date=None): """Sets this message as flagged :param start_date: the start datetime of the followUp :param due_date: the due datetime of the followUp """ self.__status = Flag.Flagged start_date = start_date or dt.datetime.now() ...
Sets this message as flagged :param start_date: the start datetime of the followUp :param due_date: the due datetime of the followUp
set_flagged
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def set_completed(self, *, completition_date=None): """Sets this message flag as completed :param completition_date: the datetime this followUp was completed """ self.__status = Flag.Complete completition_date = completition_date or dt.datetime.now() if completition_date....
Sets this message flag as completed :param completition_date: the datetime this followUp was completed
set_completed
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def delete_flag(self): """Sets this message as un flagged""" self.__status = Flag.NotFlagged self.__start = None self.__due_date = None self.__completed = None self._track_changes()
Sets this message as un flagged
delete_flag
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def to_api_data(self): """Returns this data as a dict to be sent to the server""" data = {self._cc("flagStatus"): self._cc(self.__status.value)} if self.__status is Flag.Flagged: data[self._cc("startDateTime")] = ( self._build_date_time_time_zone(self.__start) ...
Returns this data as a dict to be sent to the server
to_api_data
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def __init__(self, *, parent=None, con=None, **kwargs): """Makes a new message wrapper for sending and receiving messages. :param parent: parent folder/account to create the message in :type parent: mailbox.Folder or Account :param Connection con: connection to use if no parent specifie...
Makes a new message wrapper for sending and receiving messages. :param parent: parent folder/account to create the message in :type parent: mailbox.Folder or Account :param Connection con: connection to use if no parent specified :param Protocol protocol: protocol to use if no parent sp...
__init__
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def has_attachments(self): """Check if the message contains attachments :type: bool """ if self.__has_attachments is False and self.body_type.upper() == "HTML": # test for inline attachments (Azure responds with hasAttachments=False when there are only inline attachments): ...
Check if the message contains attachments :type: bool
has_attachments
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def sender(self, value): """sender is a property to force to be always a Recipient class""" if isinstance(value, Recipient): if value._parent is None: value._parent = self value._field = "from" self.__sender = value elif isinstance(value, s...
sender is a property to force to be always a Recipient class
sender
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def add_category(self, category): """Adds a category to this message current categories list""" if isinstance(category, Category): self.__categories.append(category.name) else: self.__categories.append(category) self._track_changes.add("categories")
Adds a category to this message current categories list
add_category
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def to_api_data(self, restrict_keys=None): """ Returns a dict representation of this message prepared to be sent to the cloud :param restrict_keys: a set of keys to restrict the returned data to :type restrict_keys: dict or set :return: converted to cloud based keys ...
Returns a dict representation of this message prepared to be sent to the cloud :param restrict_keys: a set of keys to restrict the returned data to :type restrict_keys: dict or set :return: converted to cloud based keys :rtype: dict
to_api_data
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def send(self, save_to_sent_folder=True): """ Sends this message :param bool save_to_sent_folder: whether or not to save it to sent folder :return: Success / Failure :rtype: bool """ if self.object_id and not self.__is_draft: return RuntimeError('No...
Sends this message :param bool save_to_sent_folder: whether or not to save it to sent folder :return: Success / Failure :rtype: bool
send
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def reply(self, to_all=True): """ Creates a new message that is a reply to this message :param bool to_all: whether or not to replies to all the recipients instead to just the sender :return: new message :rtype: Message """ if not self.object_id or self.__is_dr...
Creates a new message that is a reply to this message :param bool to_all: whether or not to replies to all the recipients instead to just the sender :return: new message :rtype: Message
reply
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def forward(self): """ Creates a new message that is a forward this message :return: new message :rtype: Message """ if not self.object_id or self.__is_draft: raise RuntimeError("Can't forward this message") url = self.build_url( self._endpoints...
Creates a new message that is a forward this message :return: new message :rtype: Message
forward
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def delete(self): """ Deletes a stored message :return: Success / Failure :rtype: bool """ if self.object_id is None: raise RuntimeError('Attempting to delete an unsaved Message') url = self.build_url( self._endpoints.get('get_message').format(id...
Deletes a stored message :return: Success / Failure :rtype: bool
delete
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def mark_as_read(self): """ Marks this message as read in the cloud :return: Success / Failure :rtype: bool """ if self.object_id is None or self.__is_draft: raise RuntimeError('Attempting to mark as read an unsaved Message') data = {self._cc('isRead'): True...
Marks this message as read in the cloud :return: Success / Failure :rtype: bool
mark_as_read
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def mark_as_unread(self): """ Marks this message as unread in the cloud :return: Success / Failure :rtype: bool """ if self.object_id is None or self.__is_draft: raise RuntimeError('Attempting to mark as unread an unsaved Message') data = {self._cc('isRead')...
Marks this message as unread in the cloud :return: Success / Failure :rtype: bool
mark_as_unread
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def move(self, folder): """ Move the message to a given folder :param folder: Folder object or Folder id or Well-known name to move this message to :type folder: str or mailbox.Folder :return: Success / Failure :rtype: bool """ if self.object_id is None:...
Move the message to a given folder :param folder: Folder object or Folder id or Well-known name to move this message to :type folder: str or mailbox.Folder :return: Success / Failure :rtype: bool
move
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def copy(self, folder): """ Copy the message to a given folder :param folder: Folder object or Folder id or Well-known name to copy this message to :type folder: str or mailbox.Folder :returns: the copied message :rtype: Message """ if self.object_id is ...
Copy the message to a given folder :param folder: Folder object or Folder id or Well-known name to copy this message to :type folder: str or mailbox.Folder :returns: the copied message :rtype: Message
copy
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def save_message(self): """Saves changes to a message. If the message is a new or saved draft it will call 'save_draft' otherwise this will save only properties of a message that are draft-independent such as: - is_read - category - flag :return: Suc...
Saves changes to a message. If the message is a new or saved draft it will call 'save_draft' otherwise this will save only properties of a message that are draft-independent such as: - is_read - category - flag :return: Success / Failure :rtype: bool...
save_message
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def save_draft(self, target_folder=OutlookWellKnowFolderNames.DRAFTS): """ Save this message as a draft on the cloud :param target_folder: name of the drafts folder :return: Success / Failure :rtype: bool """ if self.object_id: # update message. Attachments ...
Save this message as a draft on the cloud :param target_folder: name of the drafts folder :return: Success / Failure :rtype: bool
save_draft
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def get_body_text(self): """ Parse the body html and returns the body text using bs4 :return: body as text :rtype: str """ if self.body_type.upper() != 'HTML': return self.body try: soup = bs(self.body, 'html.parser') except RuntimeError:...
Parse the body html and returns the body text using bs4 :return: body as text :rtype: str
get_body_text
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def get_body_soup(self): """ Returns the beautifulsoup4 of the html body :return: BeautifulSoup object of body :rtype: BeautifulSoup """ if self.body_type.upper() != 'HTML': return None else: return bs(self.body, 'html.parser')
Returns the beautifulsoup4 of the html body :return: BeautifulSoup object of body :rtype: BeautifulSoup
get_body_soup
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def get_event(self): """ If this is a EventMessage it should return the related Event""" if not self.is_event_message: return None # select a dummy field (eg. subject) to avoid pull unneccesary data query = self.q().expand('event') url = self.build_url(self._endpoi...
If this is a EventMessage it should return the related Event
get_event
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def get_mime_content(self): """ Returns the MIME contents of this message """ if self.object_id is None: raise RuntimeError('Attempting to get the mime contents of an unsaved message') url = self.build_url(self._endpoints.get('get_mime').format(id=self.object_id)) response ...
Returns the MIME contents of this message
get_mime_content
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def save_as_eml(self, to_path=None): """ Saves this message as and EML to the file system :param Path or str to_path: the path where to store this file """ if to_path is None: to_path = Path('message_eml.eml') else: if not isinstance(to_path, Path): ...
Saves this message as and EML to the file system :param Path or str to_path: the path where to store this file
save_as_eml
python
O365/python-o365
O365/message.py
https://github.com/O365/python-o365/blob/master/O365/message.py
Apache-2.0
def __init__(self, *, parent=None, con=None, **kwargs): """A Microsoft 365 plan details :param parent: parent object :type parent: Task :param Connection con: connection to use if no parent specified :param Protocol protocol: protocol to use if no parent specified (kwar...
A Microsoft 365 plan details :param parent: parent object :type parent: Task :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 ...
__init__
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def update(self, **kwargs): """Updates this task detail :param kwargs: all the properties to be updated. :param dict checklist: the collection of checklist items on the task. .. code-block:: e.g. checklist = { "string GUID": { "isChecked": boo...
Updates this task detail :param kwargs: all the properties to be updated. :param dict checklist: the collection of checklist items on the task. .. code-block:: e.g. checklist = { "string GUID": { "isChecked": bool, "orderHint": string,...
update
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def __init__(self, *, parent=None, con=None, **kwargs): """A Microsoft 365 plan details :param parent: parent object :type parent: Plan :param Connection con: connection to use if no parent specified :param Protocol protocol: protocol to use if no parent specified (kwar...
A Microsoft 365 plan details :param parent: parent object :type parent: Plan :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 ...
__init__
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def update(self, **kwargs): """Updates this plan detail :param kwargs: all the properties to be updated. :param dict shared_with: dict where keys are user_ids and values are boolean (kwargs) :param dict category_descriptions: dict where keys are category1, category2, ..., category25 and...
Updates this plan detail :param kwargs: all the properties to be updated. :param dict shared_with: dict where keys are user_ids and values are boolean (kwargs) :param dict category_descriptions: dict where keys are category1, category2, ..., category25 and values are the label associated with (...
update
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def __init__(self, *, parent=None, con=None, **kwargs): """A Microsoft planner task :param parent: parent object :type parent: Planner or Plan or Bucket :param Connection con: connection to use if no parent specified :param Protocol protocol: protocol to use if no parent specifi...
A Microsoft planner task :param parent: parent object :type parent: Planner or Plan or Bucket :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 res...
__init__
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def get_details(self): """Returns Microsoft 365/AD plan with given id :rtype: PlanDetails """ if not self.object_id: raise RuntimeError("Plan is not initialized correctly. Id is missing...") url = self.build_url( self._endpoints.get("get_details").forma...
Returns Microsoft 365/AD plan with given id :rtype: PlanDetails
get_details
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def update(self, **kwargs): """Updates this task :param kwargs: all the properties to be updated. :return: Success / Failure :rtype: bool """ if not self.object_id: return False url = self.build_url(self._endpoints.get("task").format(id=self.object_i...
Updates this task :param kwargs: all the properties to be updated. :return: Success / Failure :rtype: bool
update
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def delete(self): """Deletes this task :return: Success / Failure :rtype: bool """ if not self.object_id: return False url = self.build_url(self._endpoints.get("task").format(id=self.object_id)) response = self.con.delete(url, headers={"If-Match": ...
Deletes this task :return: Success / Failure :rtype: bool
delete
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def __init__(self, *, parent=None, con=None, **kwargs): """A Microsoft 365 bucket :param parent: parent object :type parent: Planner or Plan :param Connection con: connection to use if no parent specified :param Protocol protocol: protocol to use if no parent specified ...
A Microsoft 365 bucket :param parent: parent object :type parent: Planner or Plan :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 instea...
__init__
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def list_tasks(self): """Returns list of tasks that given plan has :rtype: list[Task] """ if not self.object_id: raise RuntimeError("Bucket is not initialized correctly. Id is missing...") url = self.build_url( self._endpoints.get("list_tasks").format(id...
Returns list of tasks that given plan has :rtype: list[Task]
list_tasks
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def create_task(self, title, assignments=None, **kwargs): """Creates a Task :param str title: the title of the task :param dict assignments: the dict of users to which tasks are to be assigned. .. code-block:: python e.g. assignments = { "ca2a1df2-e36b-49...
Creates a Task :param str title: the title of the task :param dict assignments: the dict of users to which tasks are to be assigned. .. code-block:: python e.g. assignments = { "ca2a1df2-e36b-4987-9f6b-0ea462f4eb47": null, "4e98f8f1-bb03-4015-b8...
create_task
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def update(self, **kwargs): """Updates this bucket :param kwargs: all the properties to be updated. :return: Success / Failure :rtype: bool """ if not self.object_id: return False url = self.build_url(self._endpoints.get("bucket").format(id=self.obje...
Updates this bucket :param kwargs: all the properties to be updated. :return: Success / Failure :rtype: bool
update
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def delete(self): """Deletes this bucket :return: Success / Failure :rtype: bool """ if not self.object_id: return False url = self.build_url(self._endpoints.get("bucket").format(id=self.object_id)) response = self.con.delete(url, headers={"If-Matc...
Deletes this bucket :return: Success / Failure :rtype: bool
delete
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def __init__(self, *, parent=None, con=None, **kwargs): """A Microsoft 365 plan :param parent: parent object :type parent: Planner :param Connection con: connection to use if no parent specified :param Protocol protocol: protocol to use if no parent specified (kwargs) ...
A Microsoft 365 plan :param parent: parent object :type parent: Planner :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 paren...
__init__
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def list_buckets(self): """Returns list of buckets that given plan has :rtype: list[Bucket] """ if not self.object_id: raise RuntimeError("Plan is not initialized correctly. Id is missing...") url = self.build_url( self._endpoints.get("list_buckets").for...
Returns list of buckets that given plan has :rtype: list[Bucket]
list_buckets
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def list_tasks(self): """Returns list of tasks that given plan has :rtype: list[Task] or Pagination of Task """ if not self.object_id: raise RuntimeError("Plan is not initialized correctly. Id is missing...") url = self.build_url( self._endpoints.get("li...
Returns list of tasks that given plan has :rtype: list[Task] or Pagination of Task
list_tasks
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def create_bucket(self, name, order_hint=" !"): """Creates a Bucket :param str name: the name of the bucket :param str order_hint: the order of the bucket. Default is on top. How to use order hints here: https://docs.microsoft.com/en-us/graph/api/resources/planner-order-hint-format?...
Creates a Bucket :param str name: the name of the bucket :param str order_hint: the order of the bucket. Default is on top. How to use order hints here: https://docs.microsoft.com/en-us/graph/api/resources/planner-order-hint-format?view=graph-rest-1.0 :return: newly created bucket ...
create_bucket
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def update(self, **kwargs): """Updates this plan :param kwargs: all the properties to be updated. :return: Success / Failure :rtype: bool """ if not self.object_id: return False url = self.build_url(self._endpoints.get("plan").format(id=self.object_i...
Updates this plan :param kwargs: all the properties to be updated. :return: Success / Failure :rtype: bool
update
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def delete(self): """Deletes this plan :return: Success / Failure :rtype: bool """ if not self.object_id: return False url = self.build_url(self._endpoints.get("plan").format(id=self.object_id)) response = self.con.delete(url, headers={"If-Match": ...
Deletes this plan :return: Success / Failure :rtype: bool
delete
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def __init__(self, *, parent=None, con=None, **kwargs): """A Planner object :param parent: parent object :type parent: Account :param Connection con: connection to use if no parent specified :param Protocol protocol: protocol to use if no parent specified (kwargs) ...
A Planner object :param parent: parent object :type parent: Account :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 re...
__init__
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def get_my_tasks(self, *args): """Returns a list of open planner tasks assigned to me :rtype: tasks """ url = self.build_url(self._endpoints.get("get_my_tasks")) response = self.con.get(url) if not response: return None data = response.json() ...
Returns a list of open planner tasks assigned to me :rtype: tasks
get_my_tasks
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def get_plan_by_id(self, plan_id=None): """Returns Microsoft 365/AD plan with given id :param plan_id: plan id of plan :rtype: Plan """ if not plan_id: raise RuntimeError("Provide the plan_id") url = self.build_url( self._endpoints.get("get_pla...
Returns Microsoft 365/AD plan with given id :param plan_id: plan id of plan :rtype: Plan
get_plan_by_id
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def get_bucket_by_id(self, bucket_id=None): """Returns Microsoft 365/AD plan with given id :param bucket_id: bucket id of buckets :rtype: Bucket """ if not bucket_id: raise RuntimeError("Provide the bucket_id") url = self.build_url( self._endpo...
Returns Microsoft 365/AD plan with given id :param bucket_id: bucket id of buckets :rtype: Bucket
get_bucket_by_id
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def get_task_by_id(self, task_id=None): """Returns Microsoft 365/AD plan with given id :param task_id: task id of tasks :rtype: Task """ if not task_id: raise RuntimeError("Provide the task_id") url = self.build_url( self._endpoints.get("get_ta...
Returns Microsoft 365/AD plan with given id :param task_id: task id of tasks :rtype: Task
get_task_by_id
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def list_user_tasks(self, user_id=None): """Returns Microsoft 365/AD plan with given id :param user_id: user id :rtype: list[Task] """ if not user_id: raise RuntimeError("Provide the user_id") url = self.build_url( self._endpoints.get("list_use...
Returns Microsoft 365/AD plan with given id :param user_id: user id :rtype: list[Task]
list_user_tasks
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def list_group_plans(self, group_id=None): """Returns list of plans that given group has :param group_id: group id :rtype: list[Plan] """ if not group_id: raise RuntimeError("Provide the group_id") url = self.build_url( self._endpoints.get("list_...
Returns list of plans that given group has :param group_id: group id :rtype: list[Plan]
list_group_plans
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def create_plan(self, owner, title="Tasks"): """Creates a Plan :param str owner: the id of the group that will own the plan :param str title: the title of the new plan. Default set to "Tasks" :return: newly created plan :rtype: Plan """ if not owner: ...
Creates a Plan :param str owner: the id of the group that will own the plan :param str title: the title of the new plan. Default set to "Tasks" :return: newly created plan :rtype: Plan
create_plan
python
O365/python-o365
O365/planner.py
https://github.com/O365/python-o365/blob/master/O365/planner.py
Apache-2.0
def __init__(self, *, parent=None, con=None, **kwargs): """ A Sharepoint ListItem within a SharepointList :param parent: parent object :type parent: SharepointList :param Connection con: connection to use if no parent specified :param Protocol protocol: protocol to use if no par...
A Sharepoint ListItem within a SharepointList :param parent: parent object :type parent: SharepointList :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: u...
__init__
python
O365/python-o365
O365/sharepoint.py
https://github.com/O365/python-o365/blob/master/O365/sharepoint.py
Apache-2.0
def update_fields(self, updates): """ Update the value for a field(s) in the listitem :param update: A dict of {'field name': newvalue} """ for field in updates: if self._valid_field(field): self._track_changes.add(field) else: ...
Update the value for a field(s) in the listitem :param update: A dict of {'field name': newvalue}
update_fields
python
O365/python-o365
O365/sharepoint.py
https://github.com/O365/python-o365/blob/master/O365/sharepoint.py
Apache-2.0
def save_updates(self): """Save the updated fields to the cloud""" if not self._track_changes: return True # there's nothing to update url = self.build_url(self._endpoints.get('update_list_item').format(item_id=self.object_id)) update = {field: value for field, value in se...
Save the updated fields to the cloud
save_updates
python
O365/python-o365
O365/sharepoint.py
https://github.com/O365/python-o365/blob/master/O365/sharepoint.py
Apache-2.0
def __init__(self, *, parent=None, con=None, **kwargs): """ A Sharepoint site List :param parent: parent object :type parent: Site :param Connection con: connection to use if no parent specified :param Protocol protocol: protocol to use if no parent specified (kwargs) ...
A Sharepoint site List :param parent: parent object :type parent: Site :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 paren...
__init__
python
O365/python-o365
O365/sharepoint.py
https://github.com/O365/python-o365/blob/master/O365/sharepoint.py
Apache-2.0
def get_item_by_id(self, item_id, expand_fields=None): """Returns a sharepoint list item based on id :param int item_id: item id to search for :param expand_fields: specify user-defined fields to return, True will return all fields :type expand_fields: list or bool :ret...
Returns a sharepoint list item based on id :param int item_id: item id to search for :param expand_fields: specify user-defined fields to return, True will return all fields :type expand_fields: list or bool :return: Sharepoint Item :rtype: SharepointListItem
get_item_by_id
python
O365/python-o365
O365/sharepoint.py
https://github.com/O365/python-o365/blob/master/O365/sharepoint.py
Apache-2.0
def create_list_item(self, new_data): """Create new list item :param new_data: dictionary of {'col_name': col_value} :rtype: SharepointListItem """ url = self.build_url(self._endpoints.get('get_items')) response = self.con.post(url, {'fields': new_data}) if no...
Create new list item :param new_data: dictionary of {'col_name': col_value} :rtype: SharepointListItem
create_list_item
python
O365/python-o365
O365/sharepoint.py
https://github.com/O365/python-o365/blob/master/O365/sharepoint.py
Apache-2.0
def delete_list_item(self, item_id): """ Delete an existing list item :param item_id: Id of the item to be delted """ url = self.build_url(self._endpoints.get('get_item_by_id').format(item_id=item_id)) response = self.con.delete(url) return bool(response)
Delete an existing list item :param item_id: Id of the item to be delted
delete_list_item
python
O365/python-o365
O365/sharepoint.py
https://github.com/O365/python-o365/blob/master/O365/sharepoint.py
Apache-2.0
def __init__(self, *, parent=None, con=None, **kwargs): """ A Sharepoint site List :param parent: parent object :type parent: Sharepoint :param Connection con: connection to use if no parent specified :param Protocol protocol: protocol to use if no parent specified (kwa...
A Sharepoint site List :param parent: parent object :type parent: Sharepoint :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...
__init__
python
O365/python-o365
O365/sharepoint.py
https://github.com/O365/python-o365/blob/master/O365/sharepoint.py
Apache-2.0
def get_subsites(self): """ Returns a list of subsites defined for this site :rtype: list[Site] """ url = self.build_url( self._endpoints.get('get_subsites').format(id=self.object_id)) response = self.con.get(url) if not response: return [] ...
Returns a list of subsites defined for this site :rtype: list[Site]
get_subsites
python
O365/python-o365
O365/sharepoint.py
https://github.com/O365/python-o365/blob/master/O365/sharepoint.py
Apache-2.0
def get_lists(self): """ Returns a collection of lists within this site :rtype: list[SharepointList] """ url = self.build_url(self._endpoints.get('get_lists')) response = self.con.get(url) if not response: return [] data = response.json() r...
Returns a collection of lists within this site :rtype: list[SharepointList]
get_lists
python
O365/python-o365
O365/sharepoint.py
https://github.com/O365/python-o365/blob/master/O365/sharepoint.py
Apache-2.0
def get_list_by_name(self, display_name): """ Returns a sharepoint list based on the display name of the list """ if not display_name: raise ValueError('Must provide a valid list display name') url = self.build_url(self._endpoints.get('get_list_by_name').format(disp...
Returns a sharepoint list based on the display name of the list
get_list_by_name
python
O365/python-o365
O365/sharepoint.py
https://github.com/O365/python-o365/blob/master/O365/sharepoint.py
Apache-2.0
def create_list(self, list_data): """ Creates a SharePoint list. :param list_data: Dict representation of list. :type list_data: Dict :rtype: list[SharepointList] """ url = self.build_url(self._endpoints.get('get_lists')) response = self.con.post(url, data...
Creates a SharePoint list. :param list_data: Dict representation of list. :type list_data: Dict :rtype: list[SharepointList]
create_list
python
O365/python-o365
O365/sharepoint.py
https://github.com/O365/python-o365/blob/master/O365/sharepoint.py
Apache-2.0
def __init__(self, *, parent=None, con=None, **kwargs): """ A Sharepoint site List :param parent: parent object :type parent: Account :param Connection con: connection to use if no parent specified :param Protocol protocol: protocol to use if no parent specified (kwargs...
A Sharepoint site List :param parent: parent object :type parent: Account :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 pa...
__init__
python
O365/python-o365
O365/sharepoint.py
https://github.com/O365/python-o365/blob/master/O365/sharepoint.py
Apache-2.0
def search_site(self, keyword): """ Search a sharepoint host for sites with the provided keyword :param keyword: a keyword to search sites :rtype: list[Site] """ if not keyword: raise ValueError('Must provide a valid keyword') next_link = self.build_url( ...
Search a sharepoint host for sites with the provided keyword :param keyword: a keyword to search sites :rtype: list[Site]
search_site
python
O365/python-o365
O365/sharepoint.py
https://github.com/O365/python-o365/blob/master/O365/sharepoint.py
Apache-2.0
def get_site(self, *args): """ Returns a sharepoint site :param args: It accepts multiple ways of retrieving a site: get_site(host_name): the host_name: host_name ej. 'contoso.sharepoint.com' or 'root' get_site(site_id): the site_id: a comma separated string of (ho...
Returns a sharepoint site :param args: It accepts multiple ways of retrieving a site: get_site(host_name): the host_name: host_name ej. 'contoso.sharepoint.com' or 'root' get_site(site_id): the site_id: a comma separated string of (host_name, site_collection_id, site_id) ...
get_site
python
O365/python-o365
O365/sharepoint.py
https://github.com/O365/python-o365/blob/master/O365/sharepoint.py
Apache-2.0
def __init__(self, *, parent=None, con=None, **kwargs): """Representation of a Microsoft To-Do task CheckList Item. :param parent: parent object :type parent: Task :param Connection con: connection to use if no parent specified :param Protocol protocol: protocol to use if no par...
Representation of a Microsoft To-Do task CheckList Item. :param parent: parent object :type parent: Task :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: u...
__init__
python
O365/python-o365
O365/tasks.py
https://github.com/O365/python-o365/blob/master/O365/tasks.py
Apache-2.0
def __repr__(self): """Representation of the Checklist Item via the Graph api.""" marker = "x" if self.__is_checked else "o" if self.__checked: checked_str = ( f"(checked: {self.__checked.date()} at {self.__checked.time()}) " ) else: ch...
Representation of the Checklist Item via the Graph api.
__repr__
python
O365/python-o365
O365/tasks.py
https://github.com/O365/python-o365/blob/master/O365/tasks.py
Apache-2.0
def to_api_data(self, restrict_keys=None): """Return a dict to communicate with the server. :param restrict_keys: a set of keys to restrict the returned data to :rtype: dict """ cc = self._cc # pylint: disable=invalid-name data = { cc("displayName"): self._...
Return a dict to communicate with the server. :param restrict_keys: a set of keys to restrict the returned data to :rtype: dict
to_api_data
python
O365/python-o365
O365/tasks.py
https://github.com/O365/python-o365/blob/master/O365/tasks.py
Apache-2.0
def delete(self): """Delete a stored checklist item. :return: Success / Failure :rtype: bool """ if self.item_id is None: raise RuntimeError("Attempting to delete an unsaved checklist item") url = self.build_url( self._endpoints.get(CONST_CHECKLI...
Delete a stored checklist item. :return: Success / Failure :rtype: bool
delete
python
O365/python-o365
O365/tasks.py
https://github.com/O365/python-o365/blob/master/O365/tasks.py
Apache-2.0
def save(self): """Create a new checklist item or update an existing one. Does update by checking what values have changed and update them on the server :return: Success / Failure :rtype: bool """ if self.item_id: # update checklist item if not se...
Create a new checklist item or update an existing one. Does update by checking what values have changed and update them on the server :return: Success / Failure :rtype: bool
save
python
O365/python-o365
O365/tasks.py
https://github.com/O365/python-o365/blob/master/O365/tasks.py
Apache-2.0
def __init__(self, *, parent=None, con=None, **kwargs): """Representation of a Microsoft To-Do task. :param parent: parent object :type parent: Folder :param Connection con: connection to use if no parent specified :param Protocol protocol: protocol to use if no parent specified...
Representation of a Microsoft To-Do task. :param parent: parent object :type parent: Folder :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 resou...
__init__
python
O365/python-o365
O365/tasks.py
https://github.com/O365/python-o365/blob/master/O365/tasks.py
Apache-2.0
def __repr__(self): """Representation of the Task via the Graph api.""" marker = "x" if self.__is_completed else "o" if self.__due: due_str = f"(due: {self.__due.date()} at {self.__due.time()}) " else: due_str = "" if self.__completed: compl_s...
Representation of the Task via the Graph api.
__repr__
python
O365/python-o365
O365/tasks.py
https://github.com/O365/python-o365/blob/master/O365/tasks.py
Apache-2.0
def delete(self): """Delete a stored task. :return: Success / Failure :rtype: bool """ if self.task_id is None: raise RuntimeError("Attempting to delete an unsaved task") url = self.build_url( self._endpoints.get(CONST_TASK).format( ...
Delete a stored task. :return: Success / Failure :rtype: bool
delete
python
O365/python-o365
O365/tasks.py
https://github.com/O365/python-o365/blob/master/O365/tasks.py
Apache-2.0
def save(self): """Create a new task or update an existing one. Does update by checking what values have changed and update them on the server :return: Success / Failure :rtype: bool """ if self.task_id: # update task if not self._track_changes: ...
Create a new task or update an existing one. Does update by checking what values have changed and update them on the server :return: Success / Failure :rtype: bool
save
python
O365/python-o365
O365/tasks.py
https://github.com/O365/python-o365/blob/master/O365/tasks.py
Apache-2.0
def get_body_text(self): """Parse the body html and returns the body text using bs4. :return: body text :rtype: str """ if self.body_type != "html": return self.body try: soup = bs(self.body, "html.parser") except RuntimeError: ...
Parse the body html and returns the body text using bs4. :return: body text :rtype: str
get_body_text
python
O365/python-o365
O365/tasks.py
https://github.com/O365/python-o365/blob/master/O365/tasks.py
Apache-2.0
def get_checklist_items(self, query=None, batch=None, order_by=None): """Return list of checklist items of a specified task. :param query: the query string or object to query items :param batch: the batch on to retrieve items. :param order_by: the order clause to apply to returned items...
Return list of checklist items of a specified task. :param query: the query string or object to query items :param batch: the batch on to retrieve items. :param order_by: the order clause to apply to returned items. :rtype: checklistItems
get_checklist_items
python
O365/python-o365
O365/tasks.py
https://github.com/O365/python-o365/blob/master/O365/tasks.py
Apache-2.0
def get_checklist_item(self, param): """Return a Checklist Item instance by it's id. :param param: an item_id or a Query instance :return: Checklist Item for the specified info :rtype: ChecklistItem """ if param is None: return None if isinstance(para...
Return a Checklist Item instance by it's id. :param param: an item_id or a Query instance :return: Checklist Item for the specified info :rtype: ChecklistItem
get_checklist_item
python
O365/python-o365
O365/tasks.py
https://github.com/O365/python-o365/blob/master/O365/tasks.py
Apache-2.0
def new_checklist_item(self, displayname=None): """Create a checklist item within a specified task.""" return self.checklist_item_constructor( parent=self, displayname=displayname, task_id=self.task_id )
Create a checklist item within a specified task.
new_checklist_item
python
O365/python-o365
O365/tasks.py
https://github.com/O365/python-o365/blob/master/O365/tasks.py
Apache-2.0
def __init__(self, *, parent=None, con=None, **kwargs): """Representation of a Microsoft To-Do Folder. :param parent: parent object :type parent: ToDo :param Connection con: connection to use if no parent specified :param Protocol protocol: protocol to use if no parent specified...
Representation of a Microsoft To-Do Folder. :param parent: parent object :type parent: ToDo :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 resou...
__init__
python
O365/python-o365
O365/tasks.py
https://github.com/O365/python-o365/blob/master/O365/tasks.py
Apache-2.0
def __repr__(self): """Representation of the folder via the Graph api.""" suffix = " (default)" if self.is_default else "" return f"Folder: {self.name}{suffix}"
Representation of the folder via the Graph api.
__repr__
python
O365/python-o365
O365/tasks.py
https://github.com/O365/python-o365/blob/master/O365/tasks.py
Apache-2.0
def update(self): """Update this folder. Only name can be changed. :return: Success / Failure :rtype: bool """ if not self.folder_id: return False url = self.build_url( self._endpoints.get(CONST_FOLDER).format(id=self.folder_id) ) ...
Update this folder. Only name can be changed. :return: Success / Failure :rtype: bool
update
python
O365/python-o365
O365/tasks.py
https://github.com/O365/python-o365/blob/master/O365/tasks.py
Apache-2.0
def delete(self): """Delete this folder. :return: Success / Failure :rtype: bool """ if not self.folder_id: return False url = self.build_url( self._endpoints.get(CONST_FOLDER).format(id=self.folder_id) ) response = self.con.dele...
Delete this folder. :return: Success / Failure :rtype: bool
delete
python
O365/python-o365
O365/tasks.py
https://github.com/O365/python-o365/blob/master/O365/tasks.py
Apache-2.0
def get_tasks(self, query=None, batch=None, order_by=None): """Return list of tasks of a specified folder. :param query: the query string or object to query tasks :param batch: the batch on to retrieve tasks. :param order_by: the order clause to apply to returned tasks. :rtype:...
Return list of tasks of a specified folder. :param query: the query string or object to query tasks :param batch: the batch on to retrieve tasks. :param order_by: the order clause to apply to returned tasks. :rtype: tasks
get_tasks
python
O365/python-o365
O365/tasks.py
https://github.com/O365/python-o365/blob/master/O365/tasks.py
Apache-2.0
def get_task(self, param): """Return a Task instance by it's id. :param param: an task_id or a Query instance :return: task for the specified info :rtype: Task """ if param is None: return None if isinstance(param, str): url = self.build_u...
Return a Task instance by it's id. :param param: an task_id or a Query instance :return: task for the specified info :rtype: Task
get_task
python
O365/python-o365
O365/tasks.py
https://github.com/O365/python-o365/blob/master/O365/tasks.py
Apache-2.0
def __init__(self, *, parent=None, con=None, **kwargs): """Initialise the ToDo object. :param parent: parent object :type parent: Account :param Connection con: connection to use if no parent specified :param Protocol protocol: protocol to use if no parent specified (kw...
Initialise the ToDo object. :param parent: parent object :type parent: Account :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 o...
__init__
python
O365/python-o365
O365/tasks.py
https://github.com/O365/python-o365/blob/master/O365/tasks.py
Apache-2.0
def new_folder(self, folder_name): """Create a new folder. :param str folder_name: name of the new folder :return: a new folder instance :rtype: Folder """ if not folder_name: return None url = self.build_url(self._endpoints.get(CONST_ROOT_FOLDERS)) ...
Create a new folder. :param str folder_name: name of the new folder :return: a new folder instance :rtype: Folder
new_folder
python
O365/python-o365
O365/tasks.py
https://github.com/O365/python-o365/blob/master/O365/tasks.py
Apache-2.0
def get_folder(self, folder_id=None, folder_name=None): """Return a folder by it's id or name. :param str folder_id: the folder id to be retrieved. :param str folder_name: the folder name to be retrieved. :return: folder for the given info :rtype: Folder """ if f...
Return a folder by it's id or name. :param str folder_id: the folder id to be retrieved. :param str folder_name: the folder name to be retrieved. :return: folder for the given info :rtype: Folder
get_folder
python
O365/python-o365
O365/tasks.py
https://github.com/O365/python-o365/blob/master/O365/tasks.py
Apache-2.0
def get_default_folder(self): """Return the default folder for the current user. :rtype: Folder """ folders = self.list_folders() for folder in folders: if folder.is_default: return folder
Return the default folder for the current user. :rtype: Folder
get_default_folder
python
O365/python-o365
O365/tasks.py
https://github.com/O365/python-o365/blob/master/O365/tasks.py
Apache-2.0
def __init__(self, *, parent=None, con=None, **kwargs): """ 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 (kwar...
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 ...
__init__
python
O365/python-o365
O365/teams.py
https://github.com/O365/python-o365/blob/master/O365/teams.py
Apache-2.0
def __init__(self, *, parent=None, con=None, **kwargs): """ 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 p...
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...
__init__
python
O365/python-o365
O365/teams.py
https://github.com/O365/python-o365/blob/master/O365/teams.py
Apache-2.0
def __init__(self, **kwargs): """ A Microsoft Teams chat message that is the start of a channel thread """ super().__init__(**kwargs) cloud_data = kwargs.get(self._cloud_data_key, {}) channel_identity = cloud_data.get('channelIdentity') #: The identity of the channel in which th...
A Microsoft Teams chat message that is the start of a channel thread
__init__
python
O365/python-o365
O365/teams.py
https://github.com/O365/python-o365/blob/master/O365/teams.py
Apache-2.0
def get_reply(self, message_id): """ 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 """ url = self.build_url( self._endpoints.get('get_reply').fo...
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
get_reply
python
O365/python-o365
O365/teams.py
https://github.com/O365/python-o365/blob/master/O365/teams.py
Apache-2.0
def send_reply(self, content=None, content_type='text'): """ 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 rende...
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
send_reply
python
O365/python-o365
O365/teams.py
https://github.com/O365/python-o365/blob/master/O365/teams.py
Apache-2.0