Skip to content

Commit 377b429

Browse files
committed
2.5.8 release
1 parent de6254c commit 377b429

File tree

4 files changed

+30
-15
lines changed

4 files changed

+30
-15
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""
2+
Gets user properties for the specified user
3+
"""
4+
from pprint import pprint
5+
6+
from office365.sharepoint.client_context import ClientContext
7+
from tests import test_client_credentials, test_site_url, test_user_principal_name
8+
9+
client = ClientContext(test_site_url).with_credentials(test_client_credentials)
10+
user = client.site.root_web.site_users.get_by_email(test_user_principal_name)
11+
12+
result = client.people_manager.get_properties_for(user).execute_query()
13+
pprint(result.user_profile_properties)

office365/sharepoint/userprofiles/people_manager.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,10 @@ def _user_resolved(account_name):
165165
_ensure_user(user_or_name, _user_resolved)
166166
return return_type
167167

168-
def get_properties_for(self, user_or_name):
168+
def get_properties_for(self, account):
169169
"""
170170
Gets user properties for the specified user.
171-
:param str or User user_or_name: Specifies the User object or its login name.
171+
:param str or User account: Specifies the User object or its login name.
172172
"""
173173
return_type = PersonProperties(self.context)
174174

@@ -180,7 +180,7 @@ def _get_properties_for_inner(account_name):
180180
)
181181
self.context.add_query(qry)
182182

183-
_ensure_user(user_or_name, _get_properties_for_inner)
183+
_ensure_user(account, _get_properties_for_inner)
184184
return return_type
185185

186186
def get_default_document_library(

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
setup(
1212
name="Office365-REST-Python-Client",
13-
version="2.5.7",
13+
version="2.5.8",
1414
author="Vadim Gremyachev",
1515
author_email="vvgrem@gmail.com",
1616
maintainer="Konrad Gądek, Domenico Di Nicola",

tests/outlook/test_messages.py

+13-11
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,28 @@ def test2_create_draft_message(self):
1717
self.assertIsNotNone(draft_message.id)
1818
self.__class__.target_message = draft_message
1919

20-
def test3_send_message(self):
21-
message = self.__class__.target_message
22-
message.to_recipients.add(Recipient.from_email(test_user_principal_name))
23-
message.to_recipients.add(Recipient.from_email(test_user_principal_name_alt))
24-
message.body = "The new cafeteria is open."
25-
message.update().send().execute_query()
26-
2720
# def test4_create_reply(self):
2821
# message = self.__class__.target_message.create_reply().execute_query()
2922
# self.assertIsNotNone(message.resource_path)
3023

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

34-
def test_5_get_my_messages(self):
27+
def test5_get_my_messages(self):
3528
messages = self.client.me.messages.top(1).get().execute_query()
3629
self.assertLessEqual(1, len(messages))
3730
self.assertIsNotNone(messages[0].resource_path)
3831

39-
def test_6_update_message(self):
32+
def test6_update_message(self):
4033
message_to_update = self.__class__.target_message
4134
message_to_update.body = "The new cafeteria is close."
4235
message_to_update.update().execute_query()
4336

44-
def test_7_delete_message(self):
37+
def test7_delete_message(self):
4538
message_to_delete = self.__class__.target_message
4639
message_to_delete.delete_object().execute_query()
4740

48-
def test_8_create_draft_message_with_attachments(self):
41+
def test8_create_draft_message_with_attachments(self):
4942
content = base64.b64encode(
5043
io.BytesIO(b"This is some file content").read()
5144
).decode()
@@ -63,3 +56,12 @@ def test_8_create_draft_message_with_attachments(self):
6356
== 2
6457
)
6558
draft.delete_object().execute_query()
59+
60+
def test9_send_message(self):
61+
message = self.client.me.messages.add(
62+
subject="Meet for lunch?", body="The new cafeteria is open."
63+
)
64+
message.to_recipients.add(Recipient.from_email(test_user_principal_name))
65+
message.to_recipients.add(Recipient.from_email(test_user_principal_name_alt))
66+
message.body = "The new cafeteria is open."
67+
message.update().send().execute_query()

0 commit comments

Comments
 (0)