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 __init__(self, *, parent=None, con=None, **kwargs):
""" Create a contact folder component
:param parent: parent folder/account for this folder
:type parent: BaseContactFolder or Account
:param Connection con: connection to use if no parent specified
:param Protocol protocol:... | Create a contact folder component
:param parent: parent folder/account for this folder
:type parent: BaseContactFolder or Account
:param Connection con: connection to use if no parent specified
:param Protocol protocol: protocol to use if no parent specified
(kwargs)
:... | __init__ | python | O365/python-o365 | O365/address_book.py | https://github.com/O365/python-o365/blob/master/O365/address_book.py | Apache-2.0 |
def get_contact_by_email(self, email):
""" Returns a Contact by it's email
:param email: email to get contact for
:return: Contact for specified email
:rtype: Contact
"""
if not email:
return None
query = self.q().any(collection='email_addresses', at... | Returns a Contact by it's email
:param email: email to get contact for
:return: Contact for specified email
:rtype: Contact
| get_contact_by_email | python | O365/python-o365 | O365/address_book.py | https://github.com/O365/python-o365/blob/master/O365/address_book.py | Apache-2.0 |
def get_folder(self, folder_id=None, folder_name=None):
""" Returns a Contact Folder by it's id or child folders by name
:param folder_id: the folder_id to be retrieved.
Can be any folder Id (child or not)
:param folder_name: the folder name to be retrieved.
Must be a child of... | Returns a Contact Folder by it's id or child folders by name
:param folder_id: the folder_id to be retrieved.
Can be any folder Id (child or not)
:param folder_name: the folder name to be retrieved.
Must be a child of this folder
:return: a single contact folder
:rtyp... | get_folder | python | O365/python-o365 | O365/address_book.py | https://github.com/O365/python-o365/blob/master/O365/address_book.py | Apache-2.0 |
def create_child_folder(self, folder_name):
""" Creates a new child folder
:param str folder_name: name of the new folder to create
:return: newly created folder
:rtype: ContactFolder or None
"""
if not folder_name:
return None
if self.root:
... | Creates a new child folder
:param str folder_name: name of the new folder to create
:return: newly created folder
:rtype: ContactFolder or None
| create_child_folder | python | O365/python-o365 | O365/address_book.py | https://github.com/O365/python-o365/blob/master/O365/address_book.py | Apache-2.0 |
def update_folder_name(self, name):
""" Change this folder name
:param str name: new name to change to
:return: Updated or Not
:rtype: bool
"""
if self.root:
return False
if not name:
return False
url = self.build_url(
... | Change this folder name
:param str name: new name to change to
:return: Updated or Not
:rtype: bool
| update_folder_name | python | O365/python-o365 | O365/address_book.py | https://github.com/O365/python-o365/blob/master/O365/address_book.py | Apache-2.0 |
def move_folder(self, to_folder):
""" Change this folder name
:param to_folder: folder_id/ContactFolder to move into
:type to_folder: str or ContactFolder
:return: Moved or Not
:rtype: bool
"""
if self.root:
return False
if not to_folder:
... | Change this folder name
:param to_folder: folder_id/ContactFolder to move into
:type to_folder: str or ContactFolder
:return: Moved or Not
:rtype: bool
| move_folder | python | O365/python-o365 | O365/address_book.py | https://github.com/O365/python-o365/blob/master/O365/address_book.py | Apache-2.0 |
def delete(self):
""" Deletes this folder
:return: Deleted or Not
:rtype: bool
"""
if self.root or not self.folder_id:
return False
url = self.build_url(
self._endpoints.get('get_folder').format(id=self.folder_id))
response = self.con.d... | Deletes this folder
:return: Deleted or Not
:rtype: bool
| delete | python | O365/python-o365 | O365/address_book.py | https://github.com/O365/python-o365/blob/master/O365/address_book.py | Apache-2.0 |
def new_contact(self):
""" Creates a new contact to be saved into it's parent folder
:return: newly created contact
:rtype: Contact
"""
contact = self.contact_constructor(parent=self)
if not self.root:
contact.__folder_id = self.folder_id
return conta... | Creates a new contact to be saved into it's parent folder
:return: newly created contact
:rtype: Contact
| new_contact | python | O365/python-o365 | O365/address_book.py | https://github.com/O365/python-o365/blob/master/O365/address_book.py | Apache-2.0 |
def new_message(self, recipient_type=RecipientType.TO, *, query=None):
""" This method returns a new draft Message instance with all the
contacts first email as a recipient
:param RecipientType recipient_type: section to add recipient into
:param query: applies a OData filter to the req... | This method returns a new draft Message instance with all the
contacts first email as a recipient
:param RecipientType recipient_type: section to add recipient into
:param query: applies a OData filter to the request
:type query: Query or str
:return: newly created message
... | new_message | python | O365/python-o365 | O365/address_book.py | https://github.com/O365/python-o365/blob/master/O365/address_book.py | Apache-2.0 |
def __init__(self, event, recurrence=None):
""" A representation of an event recurrence properties
:param Event event: event object
:param dict recurrence: recurrence information
"""
super().__init__(protocol=event.protocol,
main_resource=event.main_reso... | A representation of an event recurrence properties
:param Event event: event object
:param dict recurrence: recurrence information
| __init__ | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def to_api_data(self):
""" Returns a dict to communicate with the server
:rtype: dict
"""
data = {}
# recurrence pattern
if self.__interval and isinstance(self.__interval, int):
recurrence_pattern = data[self._cc('pattern')] = {}
recurrence_patter... | Returns a dict to communicate with the server
:rtype: dict
| to_api_data | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def set_range(self, start=None, end=None, occurrences=None):
""" Set the range of recurrence
:param date start: Start date of repetition
:param date end: End date of repetition
:param int occurrences: no of occurrences
"""
if start is None:
if self.__start_da... | Set the range of recurrence
:param date start: Start date of repetition
:param date end: End date of repetition
:param int occurrences: no of occurrences
| set_range | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def set_daily(self, interval, **kwargs):
""" Set to repeat every x no. of days
:param int interval: no. of days to repeat at
:keyword date start: Start date of repetition (kwargs)
:keyword date end: End date of repetition (kwargs)
:keyword int occurrences: no of occurrences (kwa... | Set to repeat every x no. of days
:param int interval: no. of days to repeat at
:keyword date start: Start date of repetition (kwargs)
:keyword date end: End date of repetition (kwargs)
:keyword int occurrences: no of occurrences (kwargs)
| set_daily | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def set_weekly(self, interval, *, days_of_week, first_day_of_week,
**kwargs):
""" Set to repeat every week on specified days for every x no. of days
:param int interval: no. of days to repeat at
:param str first_day_of_week: starting day for a week
:param list[str] da... | Set to repeat every week on specified days for every x no. of days
:param int interval: no. of days to repeat at
:param str first_day_of_week: starting day for a week
:param list[str] days_of_week: list of days of the week to repeat
:keyword date start: Start date of repetition (kwargs... | set_weekly | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def set_monthly(self, interval, *, day_of_month=None, days_of_week=None,
index=None, **kwargs):
""" Set to repeat every month on specified days for every x no. of days
:param int interval: no. of days to repeat at
:param int day_of_month: repeat day of a month
:param... | Set to repeat every month on specified days for every x no. of days
:param int interval: no. of days to repeat at
:param int day_of_month: repeat day of a month
:param list[str] days_of_week: list of days of the week to repeat
:param index: index
:keyword date start: Start date... | set_monthly | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def set_yearly(self, interval, month, *, day_of_month=None,
days_of_week=None, index=None, **kwargs):
""" Set to repeat every month on specified days for every x no. of days
:param int interval: no. of days to repeat at
:param int month: month to repeat
:param int day... | Set to repeat every month on specified days for every x no. of days
:param int interval: no. of days to repeat at
:param int month: month to repeat
:param int day_of_month: repeat day of a month
:param list[str] days_of_week: list of days of the week to repeat
:param index: ind... | set_yearly | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def __init__(self, parent, response_status):
""" An event response status (status, time)
:param parent: parent of this
:type parent: Attendees or Event
:param dict response_status: status info frm cloud
"""
super().__init__(protocol=parent.protocol,
... | An event response status (status, time)
:param parent: parent of this
:type parent: Attendees or Event
:param dict response_status: status info frm cloud
| __init__ | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def __init__(self, address, *, name=None, attendee_type=None,
response_status=None, event=None):
""" Create a event attendee
:param str address: email address of the attendee
:param str name: name of the attendee
:param AttendeeType attendee_type: requirement of attende... | Create a event attendee
:param str address: email address of the attendee
:param str name: name of the attendee
:param AttendeeType attendee_type: requirement of attendee
:param Response response_status: response status requirement
:param Event event: event for which to assign ... | __init__ | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def __init__(self, event, attendees=None):
""" Create a collection of attendees
:param Event event: event for which to assign the attendees
:param attendees: list of attendees to add
:type attendees: str or tuple(str, str) or Attendee or list[str] or
list[tuple(str,str)] or lis... | Create a collection of attendees
:param Event event: event for which to assign the attendees
:param attendees: list of attendees to add
:type attendees: str or tuple(str, str) or Attendee or list[str] or
list[tuple(str,str)] or list[Attendee]
| __init__ | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def add(self, attendees):
""" Add attendees to the parent event
:param attendees: list of attendees to add
:type attendees: str or tuple(str, str) or Attendee or list[str] or
list[tuple(str,str)] or list[Attendee]
"""
if attendees:
if isinstance(attendees, s... | Add attendees to the parent event
:param attendees: list of attendees to add
:type attendees: str or tuple(str, str) or Attendee or list[str] or
list[tuple(str,str)] or list[Attendee]
| add | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def remove(self, attendees):
""" Remove the provided attendees from the event
:param attendees: list of attendees to add
:type attendees: str or tuple(str, str) or Attendee or list[str] or
list[tuple(str,str)] or list[Attendee]
"""
if isinstance(attendees, (list, tuple)... | Remove the provided attendees from the event
:param attendees: list of attendees to add
:type attendees: str or tuple(str, str) or Attendee or list[str] or
list[tuple(str,str)] or list[Attendee]
| remove | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def __init__(self, *, parent=None, con=None, **kwargs):
""" Create a calendar event representation
:param parent: parent for this operation
:type parent: Calendar or Schedule or ApiComponent
:param Connection con: connection to use if no parent specified
:param Protocol protocol... | Create a calendar event representation
:param parent: parent for this operation
:type parent: Calendar or Schedule or ApiComponent
:param Connection con: connection to use if no parent specified
:param Protocol protocol: protocol to use if no parent specified
(kwargs)
... | __init__ | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def to_api_data(self, restrict_keys=None):
""" Returns 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 # alias
if self.__location:
if isinstance(self.__location, dict):... | Returns 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/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def delete(self):
""" Deletes a stored event
:return: Success / Failure
:rtype: bool
"""
if self.object_id is None:
raise RuntimeError('Attempting to delete an unsaved event')
url = self.build_url(self._endpoints.get('event').format(id=self.object_id))
... | Deletes a stored event
:return: Success / Failure
:rtype: bool
| delete | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def save(self):
""" Create a new event or update an existing one by checking what
values have changed and update them on the server
:return: Success / Failure
:rtype: bool
"""
if self.object_id:
# update event
if not self._track_changes:
... | Create a new event or update an existing one by checking what
values have changed and update them on the server
:return: Success / Failure
:rtype: bool
| save | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def accept_event(self, comment=None, *, send_response=True,
tentatively=False):
""" Accept the event
:param comment: comment to add
:param send_response: whether or not to send response back
:param tentatively: whether acceptance is tentative
:return: Succes... | Accept the event
:param comment: comment to add
:param send_response: whether or not to send response back
:param tentatively: whether acceptance is tentative
:return: Success / Failure
:rtype: bool
| accept_event | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def decline_event(self, comment=None, *, send_response=True):
""" Decline the event
:param str comment: comment to add
:param bool send_response: whether or not to send response back
:return: Success / Failure
:rtype: bool
"""
if not self.object_id:
r... | Decline the event
:param str comment: comment to add
:param bool send_response: whether or not to send response back
:return: Success / Failure
:rtype: bool
| decline_event | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def cancel_event(self, comment=None, *, send_response=True):
""" Cancel the event
:param str comment: comment to add
:param bool send_response: whether or not to send response back
:return: Success / Failure
:rtype: bool
"""
if not self.object_id:
rai... | Cancel the event
:param str comment: comment to add
:param bool send_response: whether or not to send response back
:return: Success / Failure
:rtype: bool
| cancel_event | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.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/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def get_body_soup(self):
""" Returns the beautifulsoup4 of the html body
:return: Html 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: Html body
:rtype: BeautifulSoup
| get_body_soup | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def __init__(self, *, parent=None, con=None, **kwargs):
""" Create a Calendar Representation
:param parent: parent for this operation
:type parent: Schedule
:param Connection con: connection to use if no parent specified
:param Protocol protocol: protocol to use if no parent spe... | Create a Calendar Representation
:param parent: parent for this operation
:type parent: Schedule
: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/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def update(self):
""" Updates this calendar. Only name and color can be changed.
:return: Success / Failure
:rtype: bool
"""
if not self.calendar_id:
return False
url = self.build_url(self._endpoints.get('calendar').format(id=self.calendar_id))
dat... | Updates this calendar. Only name and color can be changed.
:return: Success / Failure
:rtype: bool
| update | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def delete(self):
""" Deletes this calendar
:return: Success / Failure
:rtype: bool
"""
if not self.calendar_id:
return False
url = self.build_url(
self._endpoints.get('calendar').format(id=self.calendar_id))
response = self.con.delete(... | Deletes this calendar
:return: Success / Failure
:rtype: bool
| delete | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def get_event(self, param):
""" Returns an Event instance by it's id
:param param: an event_id or a Query instance
:return: event for the specified info
:rtype: Event
"""
if param is None:
return None
if isinstance(param, str):
url = self... | Returns an Event instance by it's id
:param param: an event_id or a Query instance
:return: event for the specified info
:rtype: Event
| get_event | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def __init__(self, *, parent=None, con=None, **kwargs):
""" Create a wrapper around calendars and events
:param parent: parent for this operation
:type parent: Account
:param Connection con: connection to use if no parent specified
:param Protocol protocol: protocol to use if no... | Create a wrapper around calendars and events
:param parent: parent for this operation
: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_resourc... | __init__ | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def new_calendar(self, calendar_name):
""" Creates a new calendar
:param str calendar_name: name of the new calendar
:return: a new Calendar instance
:rtype: Calendar
"""
if not calendar_name:
return None
url = self.build_url(self._endpoints.get('roo... | Creates a new calendar
:param str calendar_name: name of the new calendar
:return: a new Calendar instance
:rtype: Calendar
| new_calendar | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def get_calendar(self, calendar_id=None, calendar_name=None, query=None):
"""Returns a calendar by it's id or name
:param str calendar_id: the calendar id to be retrieved.
:param str calendar_name: the calendar name to be retrieved.
:param query: applies a OData filter to the request
... | Returns a calendar by it's id or name
:param str calendar_id: the calendar id to be retrieved.
:param str calendar_name: the calendar name to be retrieved.
:param query: applies a OData filter to the request
:type query: Query
:return: calendar for the given info
:rtype:... | get_calendar | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def get_default_calendar(self):
""" Returns the default calendar for the current user
:rtype: Calendar
"""
url = self.build_url(self._endpoints.get('default_calendar'))
response = self.con.get(url)
if not response:
return None
data = response.json(... | Returns the default calendar for the current user
:rtype: Calendar
| get_default_calendar | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def get_availability(self, schedules, start, end, interval=60):
"""
Returns the free/busy availability for a set of users in a given time frame
:param list schedules: a list of strings (email addresses)
:param datetime start: the start time frame to look for available space
:para... |
Returns the free/busy availability for a set of users in a given time frame
:param list schedules: a list of strings (email addresses)
:param datetime start: the start time frame to look for available space
:param datetime end: the end time frame to look for available space
:par... | get_availability | python | O365/python-o365 | O365/calendar.py | https://github.com/O365/python-o365/blob/master/O365/calendar.py | Apache-2.0 |
def get(cls, color):
"""
Gets a color by name or value.
Raises ValueError if not found whithin the collection of colors.
"""
try:
return cls(color.capitalize()) # 'preset0' to 'Preset0'
except ValueError:
pass
try:
return cls[c... |
Gets a color by name or value.
Raises ValueError if not found whithin the collection of colors.
| get | python | O365/python-o365 | O365/category.py | https://github.com/O365/python-o365/blob/master/O365/category.py | Apache-2.0 |
def __init__(self, *, parent=None, con=None, **kwargs):
"""Represents a category by which a user can group Outlook items such as messages and events.
It can be used in conjunction with Event, Message, Contact and Post.
:param parent: parent object
:type parent: Account
:param Co... | Represents a category by which a user can group Outlook items such as messages and events.
It can be used in conjunction with Event, Message, Contact and Post.
:param parent: parent object
:type parent: Account
:param Connection con: connection to use if no parent specified
:par... | __init__ | python | O365/python-o365 | O365/category.py | https://github.com/O365/python-o365/blob/master/O365/category.py | Apache-2.0 |
def update_color(self, color):
"""
Updates this Category color
:param None or str or CategoryColor color: the category color
"""
url = self.build_url(self._endpoints.get('update').format(id=self.object_id))
if color is not None and not isinstance(color, CategoryColor):
... |
Updates this Category color
:param None or str or CategoryColor color: the category color
| update_color | python | O365/python-o365 | O365/category.py | https://github.com/O365/python-o365/blob/master/O365/category.py | Apache-2.0 |
def __init__(self, *, parent=None, con=None, **kwargs):
""" Object to retrive categories
: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
(... | Object to retrive categories
: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... | __init__ | python | O365/python-o365 | O365/category.py | https://github.com/O365/python-o365/blob/master/O365/category.py | Apache-2.0 |
def create_category(self, name, color='auto'):
"""
Creates a category.
If the color is not provided it will be choosed from the pool of unused colors.
:param str name: The name of this outlook category. Must be unique.
:param str or CategoryColor color: optional color. If not pr... |
Creates a category.
If the color is not provided it will be choosed from the pool of unused colors.
:param str name: The name of this outlook category. Must be unique.
:param str or CategoryColor color: optional color. If not provided will be assigned automatically.
:return: bo... | create_category | python | O365/python-o365 | O365/category.py | https://github.com/O365/python-o365/blob/master/O365/category.py | Apache-2.0 |
def __init__(
self,
*,
protocol_url: Optional[str] = None,
api_version: Optional[str] = None,
default_resource: Optional[str] = None,
casing_function: Optional[Callable] = None,
protocol_scope_prefix: Optional[str] = None,
timezone: Union[Optional[str], Op... | Create a new protocol object
:param protocol_url: the base url used to communicate with the
server
:param api_version: the api version
:param default_resource: the default resource to use when there is
nothing explicitly specified during the requests
:param casing_func... | __init__ | python | O365/python-o365 | O365/connection.py | https://github.com/O365/python-o365/blob/master/O365/connection.py | Apache-2.0 |
def _update_timezone(self, timezone: Union[str, ZoneInfo]) -> None:
"""Sets the timezone. This is not done in the setter as you can't call super from a overriden setter"""
if isinstance(timezone, str):
# convert string to ZoneInfo
try:
timezone = ZoneInfo(timezone... | Sets the timezone. This is not done in the setter as you can't call super from a overriden setter | _update_timezone | python | O365/python-o365 | O365/connection.py | https://github.com/O365/python-o365/blob/master/O365/connection.py | Apache-2.0 |
def get_scopes_for(
self, user_provided_scopes: Optional[Union[list, str, tuple]]
) -> list:
"""Returns a list of scopes needed for each of the
scope_helpers provided, by adding the prefix to them if required
:param user_provided_scopes: a list of scopes or scope helpers
:re... | Returns a list of scopes needed for each of the
scope_helpers provided, by adding the prefix to them if required
:param user_provided_scopes: a list of scopes or scope helpers
:return: scopes with url prefix added
:raises ValueError: if unexpected datatype of scopes are passed
| get_scopes_for | python | O365/python-o365 | O365/connection.py | https://github.com/O365/python-o365/blob/master/O365/connection.py | Apache-2.0 |
def prefix_scope(self, scope: str) -> str:
"""Inserts the protocol scope prefix if required"""
if self.protocol_scope_prefix:
if not scope.startswith(self.protocol_scope_prefix):
return f"{self.protocol_scope_prefix}{scope}"
return scope | Inserts the protocol scope prefix if required | prefix_scope | python | O365/python-o365 | O365/connection.py | https://github.com/O365/python-o365/blob/master/O365/connection.py | Apache-2.0 |
def __init__(self, api_version: str = "v1.0", default_resource: Optional[str] = None, **kwargs):
"""Create a new Microsoft Graph protocol object
_protocol_url = 'https://graph.microsoft.com/'
_oauth_scope_prefix = 'https://graph.microsoft.com/'
:param str api_version: api version to u... | Create a new Microsoft Graph protocol object
_protocol_url = 'https://graph.microsoft.com/'
_oauth_scope_prefix = 'https://graph.microsoft.com/'
:param str api_version: api version to use
:param str default_resource: the default resource to use when there is
nothing explicitl... | __init__ | python | O365/python-o365 | O365/connection.py | https://github.com/O365/python-o365/blob/master/O365/connection.py | Apache-2.0 |
def __init__(
self, api_version: str ="v1.0", default_resource: Optional[str] = None,
environment: Optional[str] = None, **kwargs
):
"""Create a new Microsoft Graph protocol object
_protocol_url = 'https://api.businesscentral.dynamics.com/'
_oauth_scope_prefix = 'https:... | Create a new Microsoft Graph protocol object
_protocol_url = 'https://api.businesscentral.dynamics.com/'
_oauth_scope_prefix = 'https://api.businesscentral.dynamics.com/'
:param str api_version: api version to use
:param str default_resource: the default resource to use when there is
... | __init__ | python | O365/python-o365 | O365/connection.py | https://github.com/O365/python-o365/blob/master/O365/connection.py | Apache-2.0 |
def __init__(
self,
credentials: tuple,
*,
proxy_server: Optional[str] = None,
proxy_port: Optional[int] = 8080,
proxy_username: Optional[str] = None,
proxy_password: Optional[str] = None,
proxy_http_only: bool = False,
requests_delay: int = 200,
... | Creates an API connection object
:param tuple credentials: a tuple of (client_id, client_secret)
Generate client_id and client_secret in https://entra.microsoft.com/
:param str proxy_server: the proxy server
:param int proxy_port: the proxy port, defaults to 8080
:param str pro... | __init__ | python | O365/python-o365 | O365/connection.py | https://github.com/O365/python-o365/blob/master/O365/connection.py | Apache-2.0 |
def _set_username_from_token_backend(
self, *, home_account_id: Optional[str] = None
) -> None:
"""
If token data is present, this will try to set the username. If home_account_id is not provided this will try
to set the username from the first account found on the token_backend.
... |
If token data is present, this will try to set the username. If home_account_id is not provided this will try
to set the username from the first account found on the token_backend.
| _set_username_from_token_backend | python | O365/python-o365 | O365/connection.py | https://github.com/O365/python-o365/blob/master/O365/connection.py | Apache-2.0 |
def username(self) -> Optional[str]:
"""
Returns the username in use
If username is not set this will try to set the username to the first account found
from the token_backend.
"""
if not self._username:
self._set_username_from_token_backend()
return s... |
Returns the username in use
If username is not set this will try to set the username to the first account found
from the token_backend.
| username | python | O365/python-o365 | O365/connection.py | https://github.com/O365/python-o365/blob/master/O365/connection.py | Apache-2.0 |
def set_proxy(
self,
proxy_server: str,
proxy_port: int,
proxy_username: str,
proxy_password: str,
proxy_http_only: bool,
) -> None:
"""Sets a proxy on the Session
:param str proxy_server: the proxy server
:param int proxy_port: the proxy port... | Sets a proxy on the Session
:param str proxy_server: the proxy server
:param int proxy_port: the proxy port, defaults to 8080
:param str proxy_username: the proxy username
:param str proxy_password: the proxy password
:param bool proxy_http_only: if the proxy should only be used... | set_proxy | python | O365/python-o365 | O365/connection.py | https://github.com/O365/python-o365/blob/master/O365/connection.py | Apache-2.0 |
def msal_client(self) -> MsalClientApplication:
"""Returns the msal client or creates it if it's not already done"""
if self._msal_client is None:
if self.auth_flow_type in ("public", "password"):
client = PublicClientApplication(
client_id=self.auth[0],
... | Returns the msal client or creates it if it's not already done | msal_client | python | O365/python-o365 | O365/connection.py | https://github.com/O365/python-o365/blob/master/O365/connection.py | Apache-2.0 |
def get_authorization_url(
self, requested_scopes: List[str], redirect_uri: Optional[str] = None, **kwargs
) -> tuple[str, dict]:
"""Initializes the oauth authorization flow, getting the
authorization url that the user must approve.
:param list[str] requested_scopes: list of scopes ... | Initializes the oauth authorization flow, getting the
authorization url that the user must approve.
:param list[str] requested_scopes: list of scopes to request access for
:param str redirect_uri: redirect url configured in registered app
:param kwargs: allow to pass unused params in co... | get_authorization_url | python | O365/python-o365 | O365/connection.py | https://github.com/O365/python-o365/blob/master/O365/connection.py | Apache-2.0 |
def request_token(
self,
authorization_url: Optional[str],
*,
flow: Optional[dict] = None,
requested_scopes: Optional[List[str]] = None,
store_token: bool = True,
**kwargs,
) -> bool:
"""Authenticates for the specified url and gets the oauth token data... | Authenticates for the specified url and gets the oauth token data. Saves the
token in the backend if store_token is True. This will replace any other tokens stored
for the same username and scopes requested.
If the token data is successfully requested, then this method will try to set the userna... | request_token | python | O365/python-o365 | O365/connection.py | https://github.com/O365/python-o365/blob/master/O365/connection.py | Apache-2.0 |
def load_token_from_backend(self) -> bool:
"""Loads the token from the backend and tries to set the self.username if it's not set"""
if self.token_backend.load_token():
if self._username is None:
account_info = self.token_backend.get_account()
if account_info:... | Loads the token from the backend and tries to set the self.username if it's not set | load_token_from_backend | python | O365/python-o365 | O365/connection.py | https://github.com/O365/python-o365/blob/master/O365/connection.py | Apache-2.0 |
def get_session(self, load_token: bool = False) -> Session:
"""Create a requests Session object with the oauth token attached to it
:param bool load_token: load the token from the token backend and load the access token into the session auth
:return: A ready to use requests session with authent... | Create a requests Session object with the oauth token attached to it
:param bool load_token: load the token from the token backend and load the access token into the session auth
:return: A ready to use requests session with authentication header attached
:rtype: requests.Session
| get_session | python | O365/python-o365 | O365/connection.py | https://github.com/O365/python-o365/blob/master/O365/connection.py | Apache-2.0 |
def update_session_auth_header(self, access_token: Optional[str] = None) -> None:
""" Will update the internal request session auth header with an access token"""
if access_token is None:
# try to get the access_token from the backend
access_token_dict = self.token_backend.get_ac... | Will update the internal request session auth header with an access token | update_session_auth_header | python | O365/python-o365 | O365/connection.py | https://github.com/O365/python-o365/blob/master/O365/connection.py | Apache-2.0 |
def _try_refresh_token(self) -> bool:
"""Internal method to check try to update the refresh token"""
# first we check if we can acquire a new refresh token
token_refreshed = False
if (
self.token_backend.token_is_long_lived(username=self.username)
or self.auth_flo... | Internal method to check try to update the refresh token | _try_refresh_token | python | O365/python-o365 | O365/connection.py | https://github.com/O365/python-o365/blob/master/O365/connection.py | Apache-2.0 |
def refresh_token(self) -> bool:
"""
Refresh the OAuth authorization token.
This will be called automatically when the access token
expires, however, you can manually call this method to
request a new refresh token.
:return bool: Success / Failure
"""
log... |
Refresh the OAuth authorization token.
This will be called automatically when the access token
expires, however, you can manually call this method to
request a new refresh token.
:return bool: Success / Failure
| refresh_token | python | O365/python-o365 | O365/connection.py | https://github.com/O365/python-o365/blob/master/O365/connection.py | Apache-2.0 |
def _check_delay(self) -> None:
"""Checks if a delay is needed between requests and sleeps if True"""
if self._previous_request_at:
dif = (
round(time.time() - self._previous_request_at, 2) * 1000
) # difference in milliseconds
if dif < self.requests_... | Checks if a delay is needed between requests and sleeps if True | _check_delay | python | O365/python-o365 | O365/connection.py | https://github.com/O365/python-o365/blob/master/O365/connection.py | Apache-2.0 |
def _internal_request(
self, session_obj: Session, url: str, method: str, ignore401: bool = False, **kwargs
) -> Response:
"""Internal handling of requests. Handles Exceptions.
:param session_obj: a requests Session instance.
:param str url: url to send request to
:param str... | Internal handling of requests. Handles Exceptions.
:param session_obj: a requests Session instance.
:param str url: url to send request to
:param str method: type of request (get/put/post/patch/delete)
:param bool ignore401: indicates whether to ignore 401 error when it would
... | _internal_request | python | O365/python-o365 | O365/connection.py | https://github.com/O365/python-o365/blob/master/O365/connection.py | Apache-2.0 |
def naive_request(self, url: str, method: str, **kwargs) -> Response:
"""Makes a request to url using an without oauth authorization
session, but through a normal session
:param str url: url to send request to
:param str method: type of request (get/put/post/patch/delete)
:param... | Makes a request to url using an without oauth authorization
session, but through a normal session
:param str url: url to send request to
:param str method: type of request (get/put/post/patch/delete)
:param kwargs: extra params to send to the request api
:return: Response of the... | naive_request | python | O365/python-o365 | O365/connection.py | https://github.com/O365/python-o365/blob/master/O365/connection.py | Apache-2.0 |
def oauth_request(self, url: str, method: str, **kwargs) -> Response:
"""Makes a request to url using an oauth session.
Raises RuntimeError if the session does not have an Authorization header
:param str url: url to send request to
:param str method: type of request (get/put/post/patch/... | Makes a request to url using an oauth session.
Raises RuntimeError if the session does not have an Authorization header
:param str url: url to send request to
:param str method: type of request (get/put/post/patch/delete)
:param kwargs: extra params to send to the request api
:r... | oauth_request | python | O365/python-o365 | O365/connection.py | https://github.com/O365/python-o365/blob/master/O365/connection.py | Apache-2.0 |
def __del__(self) -> None:
"""
Clear the session by closing it
This should be called manually by the user "del account.con"
There is no guarantee that this method will be called by the garbage collection
But this is not an issue because this connections will be automatically clos... |
Clear the session by closing it
This should be called manually by the user "del account.con"
There is no guarantee that this method will be called by the garbage collection
But this is not an issue because this connections will be automatically closed.
| __del__ | python | O365/python-o365 | O365/connection.py | https://github.com/O365/python-o365/blob/master/O365/connection.py | Apache-2.0 |
def oauth_authentication_flow(
client_id: str,
client_secret: str,
scopes: List[str] = None,
protocol: Optional[Protocol] = None,
**kwargs,
) -> bool:
"""A helper method to perform the OAuth2 authentication flow.
Authenticate and get the oauth token
:param str client_id: the client_id
... | A helper method to perform the OAuth2 authentication flow.
Authenticate and get the oauth token
:param str client_id: the client_id
:param str client_secret: the client_secret
:param list[str] scopes: a list of protocol user scopes to be converted
by the protocol or raw scopes
:param Protocol ... | oauth_authentication_flow | python | O365/python-o365 | O365/connection.py | https://github.com/O365/python-o365/blob/master/O365/connection.py | Apache-2.0 |
def new_message(self, recipient=None, *, recipient_type=RecipientType.TO):
""" This method returns a new draft Message instance with this
user email as a recipient
:param Recipient recipient: a Recipient instance where to send this
message. If None the email of this contact will be use... | This method returns a new draft Message instance with this
user email as a recipient
:param Recipient recipient: a Recipient instance where to send this
message. If None the email of this contact will be used
:param RecipientType recipient_type: section to add recipient into
:... | new_message | python | O365/python-o365 | O365/directory.py | https://github.com/O365/python-o365/blob/master/O365/directory.py | Apache-2.0 |
def get_profile_photo(self, size=None):
"""Returns the user profile photo
:param str size: 48x48, 64x64, 96x96, 120x120, 240x240,
360x360, 432x432, 504x504, and 648x648
"""
if size is None:
url = self.build_url(self._endpoints.get('photo'))
else:
... | Returns the user profile photo
:param str size: 48x48, 64x64, 96x96, 120x120, 240x240,
360x360, 432x432, 504x504, and 648x648
| get_profile_photo | python | O365/python-o365 | O365/directory.py | https://github.com/O365/python-o365/blob/master/O365/directory.py | Apache-2.0 |
def update_profile_photo(self, photo):
""" Updates this user profile photo
:param bytes photo: the photo data in bytes
"""
url = self.build_url(self._endpoints.get('photo'))
response = self.con.patch(url, data=photo, headers={'Content-type': 'image/jpeg'})
return bool(r... | Updates this user profile photo
:param bytes photo: the photo data in bytes
| update_profile_photo | python | O365/python-o365 | O365/directory.py | https://github.com/O365/python-o365/blob/master/O365/directory.py | Apache-2.0 |
def __init__(self, *, parent=None, con=None, **kwargs):
""" Represents the Active Directory
: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
... | Represents the Active Directory
: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 inst... | __init__ | python | O365/python-o365 | O365/directory.py | https://github.com/O365/python-o365/blob/master/O365/directory.py | Apache-2.0 |
def get_user(self, user, query=None):
""" Returns a User by it's id or user principal name
:param str user: the user id or user principal name
:return: User for specified email
:rtype: User
"""
url = self.build_url(self._endpoints.get('get_user').format(email=user))
... | Returns a User by it's id or user principal name
:param str user: the user id or user principal name
:return: User for specified email
:rtype: User
| get_user | python | O365/python-o365 | O365/directory.py | https://github.com/O365/python-o365/blob/master/O365/directory.py | Apache-2.0 |
def get_current_user(self, query=None):
""" Returns the current logged-in user"""
if self.main_resource != ME_RESOURCE:
raise ValueError(f"Can't get the current user. The main resource must be set to '{ME_RESOURCE}'")
url = self.build_url('') # target main_resource
return ... | Returns the current logged-in user | get_current_user | python | O365/python-o365 | O365/directory.py | https://github.com/O365/python-o365/blob/master/O365/directory.py | Apache-2.0 |
def get_user_manager(self, user, query=None):
""" Returns a Users' manager by the users id, or user principal name
:param str user: the user id or user principal name
:return: User for specified email
:rtype: User
"""
url = self.build_url(self._endpoints.get('get_user').... | Returns a Users' manager by the users id, or user principal name
:param str user: the user id or user principal name
:return: User for specified email
:rtype: User
| get_user_manager | python | O365/python-o365 | O365/directory.py | https://github.com/O365/python-o365/blob/master/O365/directory.py | Apache-2.0 |
def download(self, to_path: Union[None, str, Path] = None, name: str = None,
chunk_size: Union[str, int] = "auto", convert_to_pdf: bool = False,
output: Optional[BytesIO] = None):
""" Downloads this file to the local drive. Can download the
file in chunks with multiple ... | Downloads this file to the local drive. Can download the
file in chunks with multiple requests to the server.
:param to_path: a path to store the downloaded file
:type to_path: str or Path
:param str name: the name you want the stored file to have.
:param int chunk_size: number... | download | python | O365/python-o365 | O365/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
def __init__(self, *, parent=None, con=None, target=None, **kwargs):
"""
:param parent: parent for this operation i.e. the source of the copied item
:type parent: Drive
:param Connection con: connection to use if no parent specified
:param target: The target drive for the copy o... |
:param parent: parent for this operation i.e. the source of the copied item
:type parent: Drive
:param Connection con: connection to use if no parent specified
:param target: The target drive for the copy operation
:type target: Drive
:param Protocol protocol: protocol ... | __init__ | python | O365/python-o365 | O365/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
def _request_status(self):
""" Checks the api endpoint to check if the async job progress """
if self.item_id:
return True
response = self.con.naive_request(self.monitor_url, method="get")
if not response:
return False
data = response.json()
sel... | Checks the api endpoint to check if the async job progress | _request_status | python | O365/python-o365 | O365/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
def check_status(self, delay=0):
""" Checks the api endpoint in a loop
:param delay: number of seconds to wait between api calls.
Note Connection 'requests_delay' also apply.
:return: tuple of status and percentage complete
:rtype: tuple(str, float)
"""
if not s... | Checks the api endpoint in a loop
:param delay: number of seconds to wait between api calls.
Note Connection 'requests_delay' also apply.
:return: tuple of status and percentage complete
:rtype: tuple(str, float)
| check_status | python | O365/python-o365 | O365/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
def get_item(self):
""" Returns the item copied
:return: Copied Item
:rtype: DriveItem
"""
return self.target.get_item(
self.item_id) if self.item_id is not None else None | Returns the item copied
:return: Copied Item
:rtype: DriveItem
| get_item | python | O365/python-o365 | O365/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
def __init__(self, *, parent=None, con=None, **kwargs):
""" Version of DriveItem
:param parent: parent for this operation
:type parent: DriveItem
:param Connection con: connection to use if no parent specified
:param Protocol protocol: protocol to use if no parent specified
... | Version of DriveItem
:param parent: parent for this operation
:type parent: DriveItem
: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 i... | __init__ | python | O365/python-o365 | O365/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
def restore(self):
""" Restores this DriveItem Version.
You can not restore the current version (last one).
:return: Success / Failure
:rtype: bool
"""
url = self.build_url(
self._endpoints.get('restore').format(id=self.object_id))
response = self.co... | Restores this DriveItem Version.
You can not restore the current version (last one).
:return: Success / Failure
:rtype: bool
| restore | python | O365/python-o365 | O365/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
def download(self, to_path: Union[None, str, Path] = None, name: str = None,
chunk_size: Union[str, int] = 'auto', convert_to_pdf: bool = False,
output: Optional[BytesIO] = None):
""" Downloads this version.
You can not download the current version (last one).
... | Downloads this version.
You can not download the current version (last one).
:return: Success / Failure
:rtype: bool
| download | python | O365/python-o365 | O365/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
def __init__(self, *, parent=None, con=None, **kwargs):
""" Permissions for DriveItem
:param parent: parent for this operation
:type parent: DriveItem
:param Connection con: connection to use if no parent specified
:param Protocol protocol: protocol to use if no parent specified... | Permissions for DriveItem
:param parent: parent for this operation
:type parent: DriveItem
: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/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
def update_roles(self, roles='view'):
""" Updates the roles of this permission
:return: Success / Failure
:rtype: bool
"""
if not self.object_id:
return False
url = self.build_url(self._endpoints.get('permission').format(
driveitem_id=self.drivei... | Updates the roles of this permission
:return: Success / Failure
:rtype: bool
| update_roles | python | O365/python-o365 | O365/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
def delete(self):
""" Deletes this permission. Only permissions that are not
inherited can be deleted.
:return: Success / Failure
:rtype: bool
"""
if not self.object_id:
return False
url = self.build_url(self._endpoints.get('permission').format(
... | Deletes this permission. Only permissions that are not
inherited can be deleted.
:return: Success / Failure
:rtype: bool
| delete | python | O365/python-o365 | O365/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
def __init__(self, *, parent=None, con=None, **kwargs):
""" Create a DriveItem
:param parent: parent for this operation
:type parent: Drive or drive.Folder
:param Connection con: connection to use if no parent specified
:param Protocol protocol: protocol to use if no parent spec... | Create a DriveItem
:param parent: parent for this operation
:type parent: Drive or drive.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 ... | __init__ | python | O365/python-o365 | O365/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
def get_parent(self):
""" the parent of this DriveItem
:return: Parent of this item
:rtype: Drive or drive.Folder
"""
if self._parent and self._parent.object_id == self.parent_id:
return self._parent
else:
if self.parent_id:
return... | the parent of this DriveItem
:return: Parent of this item
:rtype: Drive or drive.Folder
| get_parent | python | O365/python-o365 | O365/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
def get_drive(self):
"""
Returns this item drive
:return: Drive of this item
:rtype: Drive or None
"""
if not self.drive_id:
return None
url = self.build_url('')
response = self.con.get(url)
if not response:
return None
... |
Returns this item drive
:return: Drive of this item
:rtype: Drive or None
| get_drive | python | O365/python-o365 | O365/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
def get_thumbnails(self, size=None):
""" Returns this Item Thumbnails. Thumbnails are not supported on
SharePoint Server 2016.
:param size: request only the specified size: ej: "small",
Custom 300x400 px: "c300x400", Crop: "c300x400_Crop"
:return: Thumbnail Data
:rtype:... | Returns this Item Thumbnails. Thumbnails are not supported on
SharePoint Server 2016.
:param size: request only the specified size: ej: "small",
Custom 300x400 px: "c300x400", Crop: "c300x400_Crop"
:return: Thumbnail Data
:rtype: dict
| get_thumbnails | python | O365/python-o365 | O365/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
def update(self, **kwargs):
""" Updates this item
:param kwargs: all the properties to be updated.
only name and description are allowed at the moment.
:return: Success / Failure
:rtype: bool
"""
if not self.object_id:
return False
url = sel... | Updates this item
:param kwargs: all the properties to be updated.
only name and description are allowed at the moment.
:return: Success / Failure
:rtype: bool
| update | python | O365/python-o365 | O365/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
def delete(self):
""" Moves this item to the Recycle Bin
:return: Success / Failure
:rtype: bool
"""
if not self.object_id:
return False
url = self.build_url(
self._endpoints.get('item').format(id=self.object_id))
response = self.con.de... | Moves this item to the Recycle Bin
:return: Success / Failure
:rtype: bool
| delete | python | O365/python-o365 | O365/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
def move(self, target):
""" Moves this DriveItem to another Folder.
Can't move between different Drives.
:param target: a Folder, Drive item or Item Id string.
If it's a drive the item will be moved to the root folder.
:type target: drive.Folder or DriveItem or str
:ret... | Moves this DriveItem to another Folder.
Can't move between different Drives.
:param target: a Folder, Drive item or Item Id string.
If it's a drive the item will be moved to the root folder.
:type target: drive.Folder or DriveItem or str
:return: Success / Failure
:rty... | move | python | O365/python-o365 | O365/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
def copy(self, target=None, name=None):
"""Asynchronously creates a copy of this DriveItem and all it's
child elements.
:param target: target location to move to.
If it's a drive the item will be moved to the root folder.
If it's None, the target is the parent of the ite... | Asynchronously creates a copy of this DriveItem and all it's
child elements.
:param target: target location to move to.
If it's a drive the item will be moved to the root folder.
If it's None, the target is the parent of the item being copied i.e. item will be copied
... | copy | python | O365/python-o365 | O365/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
def get_versions(self):
""" Returns a list of available versions for this item
:return: list of versions
:rtype: list[DriveItemVersion]
"""
if not self.object_id:
return []
url = self.build_url(
self._endpoints.get('versions').format(id=self.obje... | Returns a list of available versions for this item
:return: list of versions
:rtype: list[DriveItemVersion]
| get_versions | python | O365/python-o365 | O365/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
def get_version(self, version_id):
""" Returns a version for specified id
:return: a version object of specified id
:rtype: DriveItemVersion
"""
if not self.object_id:
return None
url = self.build_url(
self._endpoints.get('version').format(id=sel... | Returns a version for specified id
:return: a version object of specified id
:rtype: DriveItemVersion
| get_version | python | O365/python-o365 | O365/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
def share_with_link(self, share_type='view', share_scope='anonymous', share_password=None, share_expiration_date=None):
""" Creates or returns a link you can share with others
:param str share_type: 'view' to allow only view access,
'edit' to allow editions, and
'embed' to allow the D... | Creates or returns a link you can share with others
:param str share_type: 'view' to allow only view access,
'edit' to allow editions, and
'embed' to allow the DriveItem to be embedded
:param str share_scope: 'anonymous': anyone with the link can access.
'organization' Only ... | share_with_link | python | O365/python-o365 | O365/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
def share_with_invite(self, recipients, require_sign_in=True,
send_email=True, message=None, share_type='view'):
""" Sends an invitation to access or edit this DriveItem
:param recipients: a string or Contact or a list of the former
representing recipients of this inv... | Sends an invitation to access or edit this DriveItem
:param recipients: a string or Contact or a list of the former
representing recipients of this invitation
:type recipients: list[str] or list[Contact] or str or Contact
:param bool require_sign_in: if True the recipients
in... | share_with_invite | python | O365/python-o365 | O365/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
def get_permissions(self):
""" Returns a list of DriveItemPermissions with the
permissions granted for this DriveItem.
:return: List of Permissions
:rtype: list[DriveItemPermission]
"""
if not self.object_id:
return []
url = self.build_url(
... | Returns a list of DriveItemPermissions with the
permissions granted for this DriveItem.
:return: List of Permissions
:rtype: list[DriveItemPermission]
| get_permissions | python | O365/python-o365 | O365/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
def create_child_folder(self, name, description=None):
""" Creates a Child Folder
:param str name: the name of the new child folder
:param str description: the description of the new child folder
:return: newly created folder
:rtype: drive.Folder
"""
if not self... | Creates a Child Folder
:param str name: the name of the new child folder
:param str description: the description of the new child folder
:return: newly created folder
:rtype: drive.Folder
| create_child_folder | python | O365/python-o365 | O365/drive.py | https://github.com/O365/python-o365/blob/master/O365/drive.py | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.