Sharepoint

class O365.sharepoint.Sharepoint(*, parent=None, con=None, **kwargs)[source]

Bases: O365.utils.utils.ApiComponent

A Sharepoint parent class to group functionality

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

A Sharepoint site List

Parameters
  • parent (Account) – parent object

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

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

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

get_root_site()[source]

Returns the root site

Return type

Site

get_site(*args)[source]

Returns a sharepoint site

Parameters

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(host_name, path_to_site): host_name ej. ‘contoso. sharepoint.com’, path_to_site: a url path (with a leading slash)

get_site(host_name, site_collection_id, site_id): host_name ej. ‘contoso.sharepoint.com’

Return type

Site

search_site(keyword)[source]

Search a sharepoint host for sites with the provided keyword

Parameters

keyword – a keyword to search sites

Return type

list[Site]

site_constructor

alias of Site

class O365.sharepoint.SharepointList(*, parent=None, con=None, **kwargs)[source]

Bases: O365.utils.utils.ApiComponent

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

A Sharepoint site List

Parameters
  • parent (Site) – parent object

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

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

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

create_list_item(new_data)[source]

Create new list item

Parameters

new_data – dictionary of {‘col_name’: col_value}

Return type

SharepointListItem

delete_list_item(item_id)[source]

Delete an existing list item

Parameters

item_id – Id of the item to be delted

get_item_by_id(item_id)[source]

Returns a sharepoint list item based on id

get_items(limit=None, *, query=None, order_by=None, batch=None)[source]

Returns a collection of Sharepoint Items :param int limit: max no. of items to get. Over 999 uses batch. :param query: applies a filter to the request. :type query: Query or str :param order_by: orders the result set based on this condition :type order_by: Query or str :param int batch: batch size, retrieves items in

batches allowing to retrieve more items than the limit.

Returns

list of Sharepoint Items

Return type

list[SharepointListItem] or Pagination

get_list_columns()[source]

Returns the sharepoint list columns

list_column_constructor

alias of SharepointListColumn

list_item_constructor

alias of SharepointListItem

class O365.sharepoint.SharepointListColumn(*, parent=None, con=None, **kwargs)[source]

Bases: O365.utils.utils.ApiComponent

A Sharepoint List column within a SharepointList

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

Object initialization

Parameters
  • protocol (Protocol) – A protocol class or instance to be used with this connection

  • main_resource (str) – main_resource to be used in these API communications

class O365.sharepoint.SharepointListItem(*, parent=None, con=None, **kwargs)[source]

Bases: O365.utils.utils.ApiComponent

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

A Sharepoint ListItem within a SharepointList

Parameters
  • parent (SharepointList) – parent object

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

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

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

delete()[source]
save_updates()[source]

Save the updated fields to the cloud

update_fields(updates)[source]

Update the value for a field(s) in the listitem

Parameters

update – A dict of {‘field name’: newvalue}

class O365.sharepoint.Site(*, parent=None, con=None, **kwargs)[source]

Bases: O365.utils.utils.ApiComponent

A Sharepoint Site

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

A Sharepoint site List

Parameters
  • parent (Sharepoint) – parent object

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

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

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

create_list(list_data)[source]

Creates a SharePoint list. :param list_data: Dict representation of list. :type list_data: Dict :rtype: list[SharepointList]

get_default_document_library(request_drive=False)[source]

Returns the default document library of this site (Drive instance)

Parameters

request_drive – True will make an api call to retrieve the drive data

Return type

Drive

get_document_library(drive_id)[source]

Returns a Document Library (a Drive instance)

Parameters

drive_id – the drive_id to be retrieved.

Return type

Drive

get_list_by_name(display_name)[source]

Returns a sharepoint list based on the display name of the list

get_lists()[source]

Returns a collection of lists within this site

Return type

list[SharepointList]

get_subsites()[source]

Returns a list of subsites defined for this site

Return type

list[Site]

list_constructor

alias of SharepointList

list_document_libraries()[source]

Returns a collection of document libraries for this site (a collection of Drive instances) :return: list of items in this folder :rtype: list[Drive] or Pagination