Office365-rest-python-client

Latest version: v2.5.14

Safety actively analyzes 688568 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 6 of 9

2.3.6

Changelog

General

- a preliminary support for `communications `API has been introduced
- optimizing PyPI package in terms of excluding packages from production (e.g. `tests`)



SharePoint API specific
- upload large files improvements in terms of optimizing of memory consumption (377) beliaev-maksim
- new examples for SharePoint section (293) beliaev-maksim
- Document Set improvements and bug fixes 379
- settings Taxonomy field values fixes 380

OneDrive API specific
- fixes for addressing drive items 374
- improvements in terms of supporting and new nav types and methods for better API coverage, for example:


Example 1: address folder by path, where `archive/2018` is a folder path:

python
folder_item = client.me.drive.root.get_by_path("archive/2018").get().execute_query() type: DriveItem



Teams API specific
- improvements in terms of supporting and new nav types and methods for better API coverage

Examples: list all teams


python
client = GraphClient(acquire_token_by_client_credentials)
teams = client.teams.get_all(["displayName"]).execute_query()
for team in teams: type: Team
print(team.display_name)

2.3.5

Changelog

- general: compatibility with Python 2.7 (related: 326 & 275)
- OneDrive API: improvements and fixes for addressing drive items 276
- Graph client: improvements in terms of error handling for batch request, dependencies updated: `msal` 1.12.0
- SharePoint API: fix for `ListItem.update` method (related 365)
- SharePoint API: better support for addressing resources by resource path
- SharePoint API: batch request improvements, i.e. support for specifying maximum of items to be executed per bulk operations, default is 100 (related: 349)

2.3.4

Changelog

- SharePoint API: improved support for a file and folders addressing [details](https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/supporting-and-in-file-and-folder-with-the-resourcepath-api)

- SharePoint API: support for saving taxonomy columns 353



Example: save a single-valued taxonomy field value

python
ctx = ClientContext(site_url).with_credentials(credentials)

tasks_list = ctx.web.lists.get_by_title("Tasks")
tax_field_value = TaxonomyFieldValue("{term-label}", "{term-guid}")
item_to_create = tasks_list.add_item({
"Title": "New task",
"{tex-column-name}": tax_field_value,
}).execute_query()




Example: save a multi-valued taxonomy field value

python
ctx = ClientContext(site_url).with_credentials(credentials)

tasks_list = ctx.web.lists.get_by_title("Tasks")
tax_field_value = TaxonomyFieldValue("{term-label}", "{term-guid}")
tax_field_values = TaxonomyFieldValueCollection([tax_field_value])
item_to_create = tasks_list.add_item({
"Title": "New task",
"{tex-column-name}": tax_field_values,
}).execute_query()

2.3.3

Changelog

- 339: Introduced browser mode to imitate browser when obtaining the authentication cookies by nsmcan
- API improvements for Fluent interface
- SharePoint Batching API improvements for error handling

2.3.2

Changelog

- 320: escape XML characters in STS request by andreas-j-hauser
- 310: Revert `ClientObject.get_property()` semantics by kraptor
- SharePoint API improvements: 303 (addressing versions of ListItem), `hubsite` namespace, File/Folder copy/move operations
- Graph client: initial support for batching
- improved support for [Calendar API](https://docs.microsoft.com/en-us/graph/api/resources/calendar?view=graph-rest-1.0)


Support for [batching](https://docs.microsoft.com/en-us/graph/json-batching) for Graph client

python

def acquire_token_client_credentials():

authority_url = 'https://login.microsoftonline.com/{tenant}'
app = msal.ConfidentialClientApplication(
authority=authority_url,
client_id='{client-id}',
client_credential='{client-secret}'
)
result = app.acquire_token_for_client(scopes=["https://graph.microsoft.com/.default"])
return result

client = GraphClient(acquire_token_client_credentials)

current_user = self.client.users['{user-principal-name}'].get() 1.1: construct query to retrieve user details
my_drive = self.client.users['{user-principal-name}'].drive.get() 1.2: construct query to retrieve user's drive
client.execute_batch() 2: submit a query to the server

2.3.1

Changelog

Summary:

- improved support for SharePoint API (`fields`, `tenants` namespaces)
- bug fixes: 303 , 302 and 265


Improved support for SharePoint API

Here are a few examples which demonstrate how to create field and set values for a different field types:

Create a multi lookup field:


lookup_field = list.fields.add_lookup_field(title=lookup_field_name,
lookup_list_id=lookup_list.properties['Id'],
lookup_field_name='Title',
allow_multiple_values=True).execute_query()



Set a multi lookup field value


field_value = FieldMultiLookupValue()
field_value.add(FieldLookupValue(lookup_id))
updated = item_to_update.set_property(lookup_field_name, field_value).update().execute_query()


The list of methods (`fields` namespace):

- `FieldCollection.add_url_field(title)`
- `FieldCollection.add_lookup_field(title, lookup_list_id, lookup_field_name, allow_multiple_values)`
- `FieldCollection.add_choice_field(title, values, multiple_values)`
- `FieldCollection.create_taxonomy_field(name, ssp_id, term_set_id, anchor_id,field_id, text_field_id, web_id, list_id)`


The list of methods (`tenant` namespace):

- `Tenant.get_site_health_status(site_url)`

Page 6 of 9

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.