Releases: vgrem/Office365-REST-Python-Client
v 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:
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
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)
v 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)
v 2.3.4
Changelog
-
SharePoint API: improved support for a file and folders addressing details
-
SharePoint API: support for saving taxonomy columns #353
Example: save a single-valued taxonomy field value
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
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()
v 2.3.3
v 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
Support for batching for Graph client
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
v 2.3.1
Changelog
Summary:
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)
v 2.3.0 (with patches)
Changelog
requests_ntlm
is included as an optional dependencyREADME.md
broken links resolved
v 2.3.0
Changelog
- improvements for SAML-based claims authentication, kudos to @wreiner for the implementation and @nsmcan for the proposal #297, #272
- support for # and % in SharePoint Online and OneDrive for Business by @kraptor #300
- support for optional arguments for
FileCollection.create_upload_session
method by @beliaev-maksim #289 - migration from
adal
library tomsal
as a mandatory dependency #296 - improved support for
sharepoint
namespace, new types and methods (Tenant
,ViewField
,ContentType
classes) - migration from Outlook API v1.0 to Microsoft Graph. Note:
OutlookClient
is decommissioned and no longer available
v 2.2.2
Changelog
- Migration from Azure Active Directory Authentication Library (ADAL) to use the Microsoft Authentication Library (MSAL) library as a mandatory dependency
- Bug fixes: #278 - escape special characters in xml
- SharePoint API: support for creating fields from schema xml, methods:
FieldCollection.create_field_as_xml
,FieldCollection.create_taxonomy_field
v 2.2.1
Changelog
- Improved support for SharePoint API Batch requests
Here is the comparison of two approaches, in the first example update operation is submitted to server per every list item, while in the second one multiple list item update operations are submitted via a since (batch) request:
list_tasks = ctx.web.lists.get_by_title("Tasks")
items = list_tasks.items.get().execute_query() #
for task_id, item in enumerate(items):
task_prefix = str(randint(0, 10000))
item.set_property("Title", f"Task {task_prefix}")
item.update()
ctx.execute_query() # <- update operation is submitted to server per every list item
list_tasks = ctx.web.lists.get_by_title("Tasks")
items = list_tasks.items.get().execute_query()
for task_id, item in enumerate(items):
task_prefix = str(randint(0, 10000))
item.set_property("Title", f"Task {task_prefix}")
item.update()
ctx.execute_batch() # <- construct a single (batch) for all list items and submit to server
- API improvements for Fluent interface, for example, instead:
list = client.web.lists.get_by_title(list_title)
list.delete_object()
client.execute_query()
list delete operation could be constructed and submitted to a server in a more compact manner:
client.web.lists.get_by_title(list_title).delete_object().execute_query()
-
SharePoint API
Changes
namespace improvements (#259), here is the list of operations:Site.get_changes
Web.get_changes
List.get_changes
ListItem.get_changes
-
SharePoint API
RecycleBin
entity class and operations