Skip to content

Commit

Permalink
2.5.8 release
Browse files Browse the repository at this point in the history
  • Loading branch information
vgrem committed Apr 14, 2024
1 parent de6254c commit 377b429
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 15 deletions.
13 changes: 13 additions & 0 deletions examples/sharepoint/userprofile/get_properties.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"""
Gets user properties for the specified user
"""
from pprint import pprint

from office365.sharepoint.client_context import ClientContext
from tests import test_client_credentials, test_site_url, test_user_principal_name

client = ClientContext(test_site_url).with_credentials(test_client_credentials)
user = client.site.root_web.site_users.get_by_email(test_user_principal_name)

result = client.people_manager.get_properties_for(user).execute_query()
pprint(result.user_profile_properties)
6 changes: 3 additions & 3 deletions office365/sharepoint/userprofiles/people_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ def _user_resolved(account_name):
_ensure_user(user_or_name, _user_resolved)
return return_type

def get_properties_for(self, user_or_name):
def get_properties_for(self, account):
"""
Gets user properties for the specified user.
:param str or User user_or_name: Specifies the User object or its login name.
:param str or User account: Specifies the User object or its login name.
"""
return_type = PersonProperties(self.context)

Expand All @@ -180,7 +180,7 @@ def _get_properties_for_inner(account_name):
)
self.context.add_query(qry)

_ensure_user(user_or_name, _get_properties_for_inner)
_ensure_user(account, _get_properties_for_inner)
return return_type

def get_default_document_library(
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

setup(
name="Office365-REST-Python-Client",
version="2.5.7",
version="2.5.8",
author="Vadim Gremyachev",
author_email="vvgrem@gmail.com",
maintainer="Konrad Gądek, Domenico Di Nicola",
Expand Down
24 changes: 13 additions & 11 deletions tests/outlook/test_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,28 @@ def test2_create_draft_message(self):
self.assertIsNotNone(draft_message.id)
self.__class__.target_message = draft_message

def test3_send_message(self):
message = self.__class__.target_message
message.to_recipients.add(Recipient.from_email(test_user_principal_name))
message.to_recipients.add(Recipient.from_email(test_user_principal_name_alt))
message.body = "The new cafeteria is open."
message.update().send().execute_query()

# def test4_create_reply(self):
# message = self.__class__.target_message.create_reply().execute_query()
# self.assertIsNotNone(message.resource_path)

# def test4_forward_message(self):
# self.__class__.target_message.forward([test_user_principal_name_alt]).execute_query()

def test_5_get_my_messages(self):
def test5_get_my_messages(self):
messages = self.client.me.messages.top(1).get().execute_query()
self.assertLessEqual(1, len(messages))
self.assertIsNotNone(messages[0].resource_path)

def test_6_update_message(self):
def test6_update_message(self):
message_to_update = self.__class__.target_message
message_to_update.body = "The new cafeteria is close."
message_to_update.update().execute_query()

def test_7_delete_message(self):
def test7_delete_message(self):
message_to_delete = self.__class__.target_message
message_to_delete.delete_object().execute_query()

def test_8_create_draft_message_with_attachments(self):
def test8_create_draft_message_with_attachments(self):
content = base64.b64encode(
io.BytesIO(b"This is some file content").read()
).decode()
Expand All @@ -63,3 +56,12 @@ def test_8_create_draft_message_with_attachments(self):
== 2
)
draft.delete_object().execute_query()

def test9_send_message(self):
message = self.client.me.messages.add(
subject="Meet for lunch?", body="The new cafeteria is open."
)
message.to_recipients.add(Recipient.from_email(test_user_principal_name))
message.to_recipients.add(Recipient.from_email(test_user_principal_name_alt))
message.body = "The new cafeteria is open."
message.update().send().execute_query()

0 comments on commit 377b429

Please sign in to comment.