Skip to content

Releases: vgrem/Office365-REST-Python-Client

v 2.5.8

14 Apr 15:58
Compare
Choose a tag to compare

Changelog

  • SharePoint resources addressing enhancements
  • introduced methods for granting and revoking delegated & application permissions

Example 1: grant an app role to a client service principal

client = GraphClient.with_token_interactive(
    tenant_name_or_id, app_client_id, admin_principal_name
)

resource = client.service_principals.get_by_name("Microsoft Graph")
app = client.applications.get_by_app_id(app_client_id)
resource.grant_application(app, "MailboxSettings.Read").execute_query()

Example 2: grant a delegated permission to the client service principal on behalf of a user

client = GraphClient.with_token_interactive(
    tenant_name_or_id, app_client_id, admin_principal_name
)

resource = client.service_principals.get_by_name("Microsoft Graph")
app_role = "User.Read.All"
user = client.users.get_by_principal_name(test_user_principal_name)
resource.grant_delegated(app_client_id, user, app_role).execute_query()

v 2.5.7

01 Apr 10:44
Compare
Choose a tag to compare

Changelog

  • #836: support for passing a passphrase in ClientContext.with_client_certificate method

Example:

cert_credentials = {
    "tenant": tenant_name,
    "client_id": client_id,
    "thumbprint": cert_thumbprint,
    "cert_path": "selfsignkeyenc.pem",
    "passphrase": "Password",
}
ctx = ClientContext(site_url).with_client_certificate(**cert_credentials)
current_web = ctx.web.get().execute_query()

v 2.5.6

29 Feb 20:23
Compare
Choose a tag to compare

Changelog

  • #693: support for folder coloring methods in SharePoint API

Example: create a folder with a color

ctx = ClientContext(site_url).with_credentials(user_credentials)
root_folder = ctx.web.default_document_library().root_folder
folder = root_folder.folders.add(
    "archive", color_hex=FolderColors.DarkGreen
).execute_query()

v 2.5.5

21 Jan 19:27
Compare
Choose a tag to compare

Changelog

  • #745: better support for Range in OneDrive API

Example: get Range

client = GraphClient.with_username_and_password(
    tenant_name, client_id, username, password
)
drive_item = client.me.drive.root.get_by_path("Financial Report.xlsx")
worksheets = drive_item.workbook.worksheets.get().execute_query()
if len(worksheets) == 0:
    sys.exit("No worksheets found")

worksheet_range = worksheets["Sheet1"].range(address="A1:B3").execute_query()

v 2.5.4

24 Dec 14:25
Compare
Choose a tag to compare

Changelog

  • #794 SharePoint authentication support with GCC High Environments by @DEADSCOP
  • #802 fix listing folders insted of listing files by @Yusuf-ASM
  • #801 fix for addressing shared drive items

v 2.5.3

06 Dec 20:40
Compare
Choose a tag to compare

Changelog

  • #791 fix: do not reuse same instance for recipient by @byenilmez
  • #787 support for file_name parameter in File.copyto and File.copyto_using_path methods
  • #781: fix for ImportError: cannot import name 'TypedDict' from 'typing' on Python 3.7
  • #764: fix for parent_folder and parent_collection empty when retrieving file using ctx.web.get_file_by_server_relative_url
  • #735 fix for 401 Client Error: Unauthorised for url on site property update

v 2.5.2

04 Nov 19:57
Compare
Choose a tag to compare

Changelog

v 2.5.1

16 Oct 04:58
Compare
Choose a tag to compare

Changelog

  • #757: Conditionally import ParamSpec from typing_extensions by @thaiphv

v 2.5.0

15 Oct 18:06
Compare
Choose a tag to compare

Changelog

  • #740: fix for Folder.copy_to_using_path method
  • #743: introduce black for code formatting and fix flake8 by @kellerza
  • #746 & #747 typing improvements (support for mypy and pyright type checkers) by @kellerza
  • #744: Fix ResourcePath collection by @kellerza
  • #748: File.download_session method fix
  • introduced GraphClient.with_client_secret and GraphClient.with_username_and_password methods to initialize the client, refer below examples

Example: initializes a GraphClient client using user namename and password flow:

from office365.graph_client import GraphClient

client = GraphClient.with_username_and_password(
    "contoso.onmicrosoft.com", client_id, username, password
)

Example: initializes a GraphClient with client secret:

from office365.graph_client import GraphClient
client = GraphClient.with_client_secret("contoso.onmicrosoft.com", client_id, client_secret)

v 2.4.4

03 Sep 17:20
Compare
Choose a tag to compare

Changelog

  • #723: fixes FieldCollection.add_dependent_lookup_field by @pclasen-eb
  • #722: fixes 404 error with Web.get_file_by_server_relative_path method