Skip to content

Commit 8c7090d

Browse files
committed
Teams API: schedule namespace updates
1 parent bfb0587 commit 8c7090d

32 files changed

+180
-88
lines changed
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import base64
2-
from examples import acquire_token_by_username_password
32
from office365.graph_client import GraphClient
3+
from tests.graph_case import acquire_token_by_username_password
44

5-
6-
with open(r"path\to\file\test.pdf", "rb") as f:
5+
with open(r"../../data/Sample.pdf", "rb") as f:
76
content = base64.b64encode(f.read()).decode()
87
client = GraphClient(acquire_token_by_username_password)
98
client.me.messages.add(
109
subject="Meet for lunch?",
1110
body="The new cafeteria is open.",
1211
to_recipients=["fannyd@contoso.onmicrosoft.com"]
13-
).add_file_attachment("attachment.txt", content_type="application/pdf", base64_content=content).execute_query()
12+
).add_file_attachment("Sample.pdf", content_type="application/pdf", base64_content=content).execute_query()

examples/outlook/messages/list_all.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
# The example is adapted from https://learn.microsoft.com/en-us/graph/api/user-list-messages
55
"""
66

7-
from examples import acquire_token_by_username_password
87
from office365.graph_client import GraphClient
98
from office365.outlook.mail.messages.message import Message
10-
9+
from tests.graph_case import acquire_token_by_username_password
1110

1211
client = GraphClient(acquire_token_by_username_password)
1312
messages = client.me.messages.get().execute_query()
Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,25 @@
11
"""
2-
Upload large attachment to Outlook message
2+
Demonstrates how to upload large attachment to Outlook message
3+
4+
https://learn.microsoft.com/en-us/graph/api/attachment-createuploadsession?view=graph-rest-1.0
35
"""
46

57
from examples import acquire_token_by_username_password
68
from office365.graph_client import GraphClient
79

810
client = GraphClient(acquire_token_by_username_password)
911

10-
# local_path = "../../tests/data/Sample.txt"
1112
local_path = "../../../tests/data/big_buck_bunny.mp4"
1213

1314

1415
def print_progress(range_pos):
1516
print("{0} bytes uploaded".format(range_pos))
1617

1718

18-
def run_example_1():
19-
draft_message = client.me.messages.add(
20-
subject="Meet for lunch?",
21-
body="The new cafeteria is open.",
22-
to_recipients=["fannyd@contoso.onmicrosoft.com"]
23-
).execute_query()
24-
draft_message.upload_attachment(local_path, print_progress).send().execute_query()
25-
26-
27-
def run_example_2():
28-
client.me.messages.add(
29-
subject="Meet for lunch?",
30-
body="The new cafeteria is open.",
31-
to_recipients=["fannyd@contoso.onmicrosoft.com"]
32-
).upload_attachment(local_path, print_progress).execute_query()
33-
19+
message = client.me.messages.add(
20+
subject="Meet for lunch?",
21+
body="The new cafeteria is open.",
22+
to_recipients=["fannyd@contoso.onmicrosoft.com"]
23+
).upload_attachment(local_path, print_progress).execute_query()
24+
message.send().execute_query()
3425

35-
# run_example_1()
36-
run_example_2()

generator/metadata/MicrosoftGraph.xml

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,11 @@
439439
<Member Name="rejectMfaByFederatedIdp" Value="2"/>
440440
<Member Name="unknownFutureValue" Value="3"/>
441441
</EnumType>
442+
<EnumType Name="layoutTemplateType">
443+
<Member Name="default" Value="0"/>
444+
<Member Name="verticalSplit" Value="1"/>
445+
<Member Name="unknownFutureValue" Value="10"/>
446+
</EnumType>
442447
<EnumType Name="onPremisesDirectorySynchronizationDeletionPreventionType">
443448
<Member Name="disabled" Value="0"/>
444449
<Member Name="enabledForCount" Value="1"/>
@@ -6552,6 +6557,19 @@
65526557
<Property Name="suspended" Type="Edm.Int32"/>
65536558
<Property Name="warning" Type="Edm.Int32"/>
65546559
</ComplexType>
6560+
<ComplexType Name="loginPageLayoutConfiguration">
6561+
<Property Name="isFooterShown" Type="Edm.Boolean"/>
6562+
<Property Name="isHeaderShown" Type="Edm.Boolean"/>
6563+
<Property Name="layoutTemplateType" Type="graph.layoutTemplateType"/>
6564+
</ComplexType>
6565+
<ComplexType Name="loginPageTextVisibilitySettings">
6566+
<Property Name="hideAccountResetCredentials" Type="Edm.Boolean"/>
6567+
<Property Name="hideCannotAccessYourAccount" Type="Edm.Boolean"/>
6568+
<Property Name="hideForgotMyPassword" Type="Edm.Boolean"/>
6569+
<Property Name="hidePrivacyAndCookies" Type="Edm.Boolean"/>
6570+
<Property Name="hideResetItNow" Type="Edm.Boolean"/>
6571+
<Property Name="hideTermsOfUse" Type="Edm.Boolean"/>
6572+
</ComplexType>
65556573
<ComplexType Name="onPremisesAccidentalDeletionPrevention">
65566574
<Property Name="alertThreshold" Type="Edm.Int32"/>
65576575
<Property Name="synchronizationPreventionType" Type="graph.onPremisesDirectorySynchronizationDeletionPreventionType"/>
@@ -6911,8 +6929,28 @@
69116929
<Property Name="bannerLogo" Type="Edm.Stream"/>
69126930
<Property Name="bannerLogoRelativeUrl" Type="Edm.String"/>
69136931
<Property Name="cdnList" Type="Collection(Edm.String)"/>
6932+
<Property Name="customAccountResetCredentialsUrl" Type="Edm.String"/>
6933+
<Property Name="customCannotAccessYourAccountText" Type="Edm.String"/>
6934+
<Property Name="customCannotAccessYourAccountUrl" Type="Edm.String"/>
6935+
<Property Name="customCSS" Type="Edm.Stream"/>
6936+
<Property Name="customCSSRelativeUrl" Type="Edm.String"/>
6937+
<Property Name="customForgotMyPasswordText" Type="Edm.String"/>
6938+
<Property Name="customPrivacyAndCookiesText" Type="Edm.String"/>
6939+
<Property Name="customPrivacyAndCookiesUrl" Type="Edm.String"/>
6940+
<Property Name="customResetItNowText" Type="Edm.String"/>
6941+
<Property Name="customTermsOfUseText" Type="Edm.String"/>
6942+
<Property Name="customTermsOfUseUrl" Type="Edm.String"/>
6943+
<Property Name="favicon" Type="Edm.Stream"/>
6944+
<Property Name="faviconRelativeUrl" Type="Edm.String"/>
6945+
<Property Name="headerBackgroundColor" Type="Edm.String"/>
6946+
<Property Name="headerLogo" Type="Edm.Stream"/>
6947+
<Property Name="headerLogoRelativeUrl" Type="Edm.String"/>
6948+
<Property Name="loginPageLayoutConfiguration" Type="graph.loginPageLayoutConfiguration"/>
6949+
<Property Name="loginPageTextVisibilitySettings" Type="graph.loginPageTextVisibilitySettings"/>
69146950
<Property Name="signInPageText" Type="Edm.String"/>
69156951
<Property Name="squareLogo" Type="Edm.Stream"/>
6952+
<Property Name="squareLogoDark" Type="Edm.Stream"/>
6953+
<Property Name="squareLogoDarkRelativeUrl" Type="Edm.String"/>
69166954
<Property Name="squareLogoRelativeUrl" Type="Edm.String"/>
69176955
<Property Name="usernameHintText" Type="Edm.String"/>
69186956
</EntityType>
@@ -19472,7 +19510,6 @@
1947219510
<Singleton Name="compliance" Type="microsoft.graph.compliance"/>
1947319511
<Singleton Name="security" Type="microsoft.graph.security"/>
1947419512
<Singleton Name="identity" Type="microsoft.graph.identityContainer"/>
19475-
<Singleton Name="branding" Type="microsoft.graph.organizationalBranding"/>
1947619513
<Singleton Name="directory" Type="microsoft.graph.directory">
1947719514
<NavigationPropertyBinding Path="administrativeUnits/members" Target="directoryObjects"/>
1947819515
</Singleton>
@@ -32294,6 +32331,7 @@
3229432331
<Member Name="appGovernancePolicy" Value="1048576"/>
3229532332
<Member Name="appGovernanceDetection" Value="2097152"/>
3229632333
<Member Name="unknownFutureValue" Value="4194303"/>
32334+
<Member Name="microsoftDefenderForCloud" Value="4194304"/>
3229732335
</EnumType>
3229832336
<EnumType Name="detectionStatus">
3229932337
<Member Name="detected" Value="0"/>
@@ -32351,12 +32389,20 @@
3235132389
<Member Name="noThreatsFound" Value="3"/>
3235232390
<Member Name="unknownFutureValue" Value="4"/>
3235332391
</EnumType>
32392+
<EnumType Name="googleCloudLocationType">
32393+
<Member Name="unknown" Value="0"/>
32394+
<Member Name="regional" Value="1"/>
32395+
<Member Name="zonal" Value="2"/>
32396+
<Member Name="global" Value="3"/>
32397+
<Member Name="unknownFutureValue" Value="31"/>
32398+
</EnumType>
3235432399
<EnumType Name="incidentStatus">
3235532400
<Member Name="active" Value="1"/>
3235632401
<Member Name="resolved" Value="2"/>
3235732402
<Member Name="inProgress" Value="4"/>
3235832403
<Member Name="redirected" Value="64"/>
3235932404
<Member Name="unknownFutureValue" Value="127"/>
32405+
<Member Name="awaitingAction" Value="128"/>
3236032406
</EnumType>
3236132407
<EnumType Name="onboardingStatus">
3236232408
<Member Name="insufficientInfo" Value="0"/>
@@ -32376,6 +32422,7 @@
3237632422
<Member Name="microsoftAppGovernance" Value="64"/>
3237732423
<Member Name="dataLossPrevention" Value="128"/>
3237832424
<Member Name="unknownFutureValue" Value="255"/>
32425+
<Member Name="microsoftDefenderForCloud" Value="256"/>
3237932426
</EnumType>
3238032427
<EnumType Name="vmCloudProvider">
3238132428
<Member Name="unknown" Value="0"/>
@@ -32614,12 +32661,19 @@
3261432661
</ComplexType>
3261532662
<ComplexType Name="alertEvidence">
3261632663
<Property Name="createdDateTime" Type="Edm.DateTimeOffset" Nullable="false"/>
32664+
<Property Name="detailedRoles" Type="Collection(Edm.String)"/>
3261732665
<Property Name="remediationStatus" Type="microsoft.graph.security.evidenceRemediationStatus" Nullable="false"/>
3261832666
<Property Name="remediationStatusDetails" Type="Edm.String"/>
3261932667
<Property Name="roles" Type="Collection(microsoft.graph.security.evidenceRole)" Nullable="false"/>
3262032668
<Property Name="tags" Type="Collection(Edm.String)"/>
3262132669
<Property Name="verdict" Type="microsoft.graph.security.evidenceVerdict" Nullable="false"/>
3262232670
</ComplexType>
32671+
<ComplexType Name="amazonResourceEvidence" BaseType="microsoft.graph.security.alertEvidence">
32672+
<Property Name="amazonAccountId" Type="Edm.String"/>
32673+
<Property Name="amazonResourceId" Type="Edm.String"/>
32674+
<Property Name="resourceName" Type="Edm.String"/>
32675+
<Property Name="resourceType" Type="Edm.String"/>
32676+
</ComplexType>
3262332677
<ComplexType Name="analyzedMessageEvidence" BaseType="microsoft.graph.security.alertEvidence">
3262432678
<Property Name="antiSpamDirection" Type="Edm.String"/>
3262532679
<Property Name="attachmentsCount" Type="Edm.Int64"/>
@@ -32645,6 +32699,11 @@
3264532699
<Property Name="domainName" Type="Edm.String"/>
3264632700
<Property Name="emailAddress" Type="Edm.String"/>
3264732701
</ComplexType>
32702+
<ComplexType Name="azureResourceEvidence" BaseType="microsoft.graph.security.alertEvidence">
32703+
<Property Name="resourceId" Type="Edm.String"/>
32704+
<Property Name="resourceName" Type="Edm.String"/>
32705+
<Property Name="resourceType" Type="Edm.String"/>
32706+
</ComplexType>
3264832707
<ComplexType Name="cloudApplicationEvidence" BaseType="microsoft.graph.security.alertEvidence">
3264932708
<Property Name="appId" Type="Edm.Int64"/>
3265032709
<Property Name="displayName" Type="Edm.String"/>
@@ -32658,6 +32717,7 @@
3265832717
<Property Name="deviceDnsName" Type="Edm.String"/>
3265932718
<Property Name="firstSeenDateTime" Type="Edm.DateTimeOffset"/>
3266032719
<Property Name="healthStatus" Type="microsoft.graph.security.deviceHealthStatus"/>
32720+
<Property Name="ipInterfaces" Type="Collection(Edm.String)"/>
3266132721
<Property Name="loggedOnUsers" Type="Collection(microsoft.graph.security.loggedOnUser)"/>
3266232722
<Property Name="mdeDeviceId" Type="Edm.String"/>
3266332723
<Property Name="onboardingStatus" Type="microsoft.graph.security.onboardingStatus"/>
@@ -32694,6 +32754,14 @@
3269432754
<Property Name="fileDetails" Type="microsoft.graph.security.fileDetails"/>
3269532755
<Property Name="mdeDeviceId" Type="Edm.String"/>
3269632756
</ComplexType>
32757+
<ComplexType Name="googleCloudResourceEvidence" BaseType="microsoft.graph.security.alertEvidence">
32758+
<Property Name="location" Type="Edm.String"/>
32759+
<Property Name="locationType" Type="microsoft.graph.security.googleCloudLocationType"/>
32760+
<Property Name="projectId" Type="Edm.String"/>
32761+
<Property Name="projectNumber" Type="Edm.Int64"/>
32762+
<Property Name="resourceName" Type="Edm.String"/>
32763+
<Property Name="resourceType" Type="Edm.String"/>
32764+
</ComplexType>
3269732765
<ComplexType Name="huntingQueryResults">
3269832766
<Property Name="results" Type="Collection(microsoft.graph.security.huntingRowResult)"/>
3269932767
<Property Name="schema" Type="Collection(microsoft.graph.security.singlePropertySchema)"/>
@@ -32751,6 +32819,7 @@
3275132819
<Property Name="registryKey" Type="Edm.String"/>
3275232820
</ComplexType>
3275332821
<ComplexType Name="registryValueEvidence" BaseType="microsoft.graph.security.alertEvidence">
32822+
<Property Name="mdeDeviceId" Type="Edm.String"/>
3275432823
<Property Name="registryHive" Type="Edm.String"/>
3275532824
<Property Name="registryKey" Type="Edm.String"/>
3275632825
<Property Name="registryValue" Type="Edm.String"/>

office365/directory/users/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from office365.entity import Entity
22
from office365.runtime.paths.resource_path import ResourcePath
3-
from office365.teams.shifts.preferences import ShiftPreferences
3+
from office365.teams.schedule.shifts.preferences import ShiftPreferences
44

55

66
class UserSettings(Entity):

office365/outlook/mail/messages/message.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ def upload_attachment(self, file_path, chunk_uploaded=None):
9090
if file_size > max_upload_chunk:
9191
def _message_loaded():
9292
self.attachments.resumable_upload(file_path, max_upload_chunk, chunk_uploaded)
93-
9493
self.ensure_property("id", _message_loaded)
9594
else:
9695
with open(file_path, 'rb') as file_object:
@@ -136,7 +135,7 @@ def create_reply(self, comment=None):
136135
"""
137136
return_type = Message(self.context)
138137
payload = {
139-
"comment" : comment
138+
"comment": comment
140139
}
141140
qry = ServiceOperationQuery(self, "createReply", None, payload, None, return_type)
142141
self.context.add_query(qry)
@@ -196,9 +195,10 @@ def has_attachments(self):
196195
def attachments(self):
197196
"""The fileAttachment and itemAttachment attachments for the message.
198197
"""
199-
return self.get_property('attachments',
200-
AttachmentCollection(self.context, ResourcePath("attachments", self.resource_path)),
201-
True)
198+
self._persist_changes('attachments')
199+
return self.properties.setdefault('attachments',
200+
AttachmentCollection(self.context,
201+
ResourcePath("attachments", self.resource_path)))
202202

203203
@property
204204
def extensions(self):
@@ -241,17 +241,20 @@ def subject(self, value):
241241
@property
242242
def to_recipients(self):
243243
"""The To: recipients for the message."""
244-
return self.get_property('toRecipients', ClientValueCollection(Recipient), True)
244+
self._persist_changes('toRecipients')
245+
return self.properties.setdefault('toRecipients', ClientValueCollection(Recipient))
245246

246247
@property
247248
def bcc_recipients(self):
248249
"""The BCC: recipients for the message."""
249-
return self.get_property('bccRecipients', ClientValueCollection(Recipient), True)
250+
self._persist_changes('bccRecipients')
251+
return self.properties.setdefault('bccRecipients', ClientValueCollection(Recipient))
250252

251253
@property
252254
def cc_recipients(self):
253255
"""The CC: recipients for the message."""
254-
return self.get_property('ccRecipients', ClientValueCollection(Recipient), True)
256+
self._persist_changes('ccRecipients')
257+
return self.properties.setdefault('ccRecipients', ClientValueCollection(Recipient))
255258

256259
@property
257260
def sender(self):
@@ -266,14 +269,13 @@ def parent_folder_id(self):
266269
"""The unique identifier for the message's parent mailFolder."""
267270
return self.get_property('parentFolderId', None)
268271

269-
def get_property(self, name, default_value=None, track_changes=False):
272+
def get_property(self, name, default_value=None):
270273
if default_value is None:
271274
property_type_mapping = {
272-
"toRecipients": self.to_recipients
275+
"toRecipients": self.to_recipients,
276+
"bccRecipients": self.bcc_recipients,
277+
"ccRecipients": self.cc_recipients
273278
}
274279
default_value = property_type_mapping.get(name, None)
275280

276-
value = super(Message, self).get_property(name, default_value)
277-
if track_changes:
278-
self.track_changes(name, value)
279-
return value
281+
return super(Message, self).get_property(name, default_value)

office365/runtime/client_object.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,12 @@ def remove_from_parent_collection(self):
101101
self._parent_collection.remove_child(self)
102102
return self
103103

104-
def track_changes(self, name, value):
104+
def _persist_changes(self, name):
105+
"""
106+
:param str name: A property name
107+
"""
105108
if name not in self._ser_property_names:
106109
self._ser_property_names.append(name)
107-
self._properties[name] = value
108110
return self
109111

110112
def get_property(self, name, default_value=None):

office365/teams/chats/chat.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
from office365.entity_collection import EntityCollection
33
from office365.runtime.paths.resource_path import ResourcePath
44
from office365.teams.apps.installation import TeamsAppInstallation
5-
from office365.teams.members.conversation import ConversationMember
65
from office365.teams.chats.message import ChatMessage
6+
from office365.teams.members.conversation_collection import ConversationMemberCollection
77
from office365.teams.operations.async_operation import TeamsAsyncOperation
88
from office365.teams.tabs.tab import TeamsTab
99

@@ -19,22 +19,18 @@ def topic(self):
1919
@property
2020
def installed_apps(self):
2121
"""A collection of all the apps in the chat. Nullable.
22-
23-
:rtype: EntityCollection
2422
"""
25-
return self.get_property('installedApps',
26-
EntityCollection(self.context, TeamsAppInstallation,
27-
ResourcePath("installedApps", self.resource_path)))
23+
return self.properties.get('installedApps',
24+
EntityCollection(self.context, TeamsAppInstallation,
25+
ResourcePath("installedApps", self.resource_path)))
2826

2927
@property
3028
def members(self):
3129
"""A collection of membership records associated with the chat.
32-
33-
:rtype: EntityCollection
3430
"""
35-
return self.properties.get('members',
36-
EntityCollection(self.context, ConversationMember,
37-
ResourcePath("members", self.resource_path)))
31+
return self.properties.setdefault('members',
32+
ConversationMemberCollection(self.context,
33+
ResourcePath("members", self.resource_path)))
3834

3935
@property
4036
def messages(self):

0 commit comments

Comments
 (0)