Office365-REST-Python-Client 2.5.2__py3-none-any.whl → 2.5.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. {Office365_REST_Python_Client-2.5.2.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/METADATA +4 -4
  2. {Office365_REST_Python_Client-2.5.2.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/RECORD +122 -119
  3. office365/base_item.py +12 -20
  4. office365/communications/presences/presence.py +18 -7
  5. office365/delta_path.py +1 -1
  6. office365/directory/administrative_unit.py +6 -7
  7. office365/directory/applications/application.py +15 -13
  8. office365/directory/audit/signins/signin.py +8 -12
  9. office365/directory/authentication/methods/details.py +8 -6
  10. office365/directory/groups/lifecycle_policy.py +8 -7
  11. office365/directory/identities/provider.py +5 -6
  12. office365/directory/internal/paths/me.py +1 -1
  13. office365/directory/permissions/email_identity.py +7 -0
  14. office365/directory/rolemanagement/role.py +5 -4
  15. office365/directory/rolemanagement/template.py +2 -6
  16. office365/directory/rolemanagement/unified_role_assignment.py +5 -4
  17. office365/directory/rolemanagement/unified_role_definition.py +6 -4
  18. office365/directory/serviceprincipals/service_principal.py +11 -6
  19. office365/directory/users/user.py +8 -11
  20. office365/entity.py +2 -2
  21. office365/entity_collection.py +11 -4
  22. office365/intune/devices/enrollment/configuration.py +6 -4
  23. office365/intune/devices/managed.py +9 -12
  24. office365/onedrive/analytics/item_activity_stat.py +4 -3
  25. office365/onedrive/columns/definition.py +9 -9
  26. office365/onedrive/documentsets/version.py +1 -3
  27. office365/onedrive/driveitems/driveItem.py +30 -29
  28. office365/onedrive/internal/paths/children.py +2 -2
  29. office365/onedrive/internal/paths/root.py +1 -1
  30. office365/onedrive/internal/paths/shared.py +1 -1
  31. office365/onedrive/internal/paths/site.py +3 -3
  32. office365/onedrive/internal/paths/url.py +2 -2
  33. office365/onedrive/listitems/list_item.py +2 -0
  34. office365/onedrive/lists/list.py +7 -4
  35. office365/onedrive/permissions/collection.py +26 -6
  36. office365/onedrive/sharepoint.py +1 -0
  37. office365/onedrive/shares/collection.py +2 -5
  38. office365/onedrive/shares/drive_item.py +3 -0
  39. office365/onedrive/termstore/groups/collection.py +3 -8
  40. office365/onedrive/termstore/groups/group.py +8 -0
  41. office365/onedrive/termstore/sets/collection.py +2 -6
  42. office365/onedrive/termstore/sets/name.py +5 -0
  43. office365/onedrive/termstore/sets/set.py +7 -0
  44. office365/onedrive/termstore/store.py +10 -13
  45. office365/onedrive/versions/drive_item.py +3 -1
  46. office365/onedrive/workbooks/ranges/range.py +9 -13
  47. office365/onedrive/workbooks/ranges/view.py +1 -0
  48. office365/onedrive/workbooks/tables/table.py +1 -3
  49. office365/onedrive/workbooks/worksheets/worksheet.py +5 -3
  50. office365/onenote/pages/collection.py +3 -2
  51. office365/onenote/resources/resource.py +5 -4
  52. office365/onenote/sectiongroups/section_group.py +10 -7
  53. office365/outlook/calendar/calendar.py +1 -1
  54. office365/outlook/calendar/schedule/information.py +0 -1
  55. office365/outlook/contacts/contact.py +3 -9
  56. office365/outlook/contacts/folder.py +3 -0
  57. office365/outlook/mail/messages/message.py +25 -18
  58. office365/outlook/mail/recipient.py +3 -1
  59. office365/runtime/auth/authentication_context.py +2 -2
  60. office365/runtime/auth/providers/acs_token_provider.py +7 -9
  61. office365/runtime/client_object.py +3 -11
  62. office365/runtime/client_object_collection.py +22 -20
  63. office365/runtime/client_result.py +1 -3
  64. office365/runtime/client_value_collection.py +2 -6
  65. office365/runtime/odata/query_options.py +1 -3
  66. office365/runtime/odata/type.py +2 -0
  67. office365/runtime/paths/appid.py +1 -1
  68. office365/runtime/{odata/url_builder.py → paths/builder.py} +24 -9
  69. office365/runtime/paths/item.py +1 -1
  70. office365/runtime/paths/resource_path.py +12 -16
  71. office365/runtime/paths/service_operation.py +8 -7
  72. office365/runtime/paths/v3/__init__.py +0 -0
  73. office365/runtime/paths/{key.py → v3/entity.py} +5 -5
  74. office365/runtime/paths/v4/__init__.py +0 -0
  75. office365/runtime/paths/{entity.py → v4/entity.py} +13 -11
  76. office365/sharepoint/contenttypes/content_type.py +6 -0
  77. office365/sharepoint/documentmanagement/document_set.py +4 -6
  78. office365/sharepoint/entity_collection.py +9 -0
  79. office365/sharepoint/features/feature.py +6 -8
  80. office365/sharepoint/files/checked_out_file.py +4 -2
  81. office365/sharepoint/files/checked_out_file_collection.py +1 -1
  82. office365/sharepoint/files/collection.py +35 -3
  83. office365/sharepoint/files/file.py +35 -11
  84. office365/sharepoint/files/versions/collection.py +4 -0
  85. office365/sharepoint/files/versions/event.py +6 -3
  86. office365/sharepoint/files/versions/version.py +6 -4
  87. office365/sharepoint/folders/collection.py +2 -2
  88. office365/sharepoint/folders/folder.py +5 -11
  89. office365/sharepoint/internal/paths/static_operation.py +9 -0
  90. office365/sharepoint/internal/paths/web.py +20 -0
  91. office365/sharepoint/listitems/collection.py +4 -0
  92. office365/sharepoint/listitems/listitem.py +19 -30
  93. office365/sharepoint/lists/list.py +44 -60
  94. office365/sharepoint/portal/groups/service.py +12 -16
  95. office365/sharepoint/portal/groups/site_manager.py +0 -1
  96. office365/sharepoint/publishing/pages/metadata.py +7 -2
  97. office365/sharepoint/publishing/pages/metadata_collection.py +0 -1
  98. office365/sharepoint/publishing/pages/page.py +3 -6
  99. office365/sharepoint/publishing/pages/reposts/repost.py +5 -9
  100. office365/sharepoint/recyclebin/item.py +11 -9
  101. office365/sharepoint/sharing/links/share_response.py +3 -0
  102. office365/sharepoint/sharing/result.py +18 -41
  103. office365/sharepoint/sites/site.py +46 -68
  104. office365/sharepoint/taxonomy/item.py +4 -2
  105. office365/sharepoint/taxonomy/stores/store.py +2 -6
  106. office365/sharepoint/tenant/administration/internal/permission_grant.py +7 -0
  107. office365/sharepoint/tenant/administration/sites/properties.py +55 -44
  108. office365/sharepoint/tenant/administration/tenant.py +25 -40
  109. office365/sharepoint/usercustomactions/collection.py +0 -1
  110. office365/sharepoint/webs/collection.py +8 -0
  111. office365/sharepoint/webs/template_collection.py +2 -4
  112. office365/sharepoint/webs/web.py +27 -24
  113. office365/teams/apps/app.py +1 -0
  114. office365/teams/collection.py +12 -16
  115. office365/teams/members/conversation_collection.py +1 -3
  116. office365/teams/operations/async_operation.py +3 -5
  117. office365/teams/schedule/groups/group.py +3 -0
  118. office365/teams/team.py +1 -1
  119. office365/todo/attachments/base.py +7 -9
  120. office365/runtime/odata/path_builder.py +0 -23
  121. office365/sharepoint/internal/key_value.py +0 -28
  122. {Office365_REST_Python_Client-2.5.2.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/LICENSE +0 -0
  123. {Office365_REST_Python_Client-2.5.2.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/WHEEL +0 -0
  124. {Office365_REST_Python_Client-2.5.2.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,8 @@
1
1
  import time
2
2
  from typing import AnyStr, Optional
3
3
 
4
+ from typing_extensions import Self
5
+
4
6
  from office365.runtime.client_result import ClientResult
5
7
  from office365.runtime.client_value_collection import ClientValueCollection
6
8
  from office365.runtime.paths.resource_path import ResourcePath
@@ -9,6 +11,7 @@ from office365.sharepoint.entity import Entity
9
11
  from office365.sharepoint.entity_collection import EntityCollection
10
12
  from office365.sharepoint.gtp.request_options import ChatGptRequestOptions
11
13
  from office365.sharepoint.listitems.collection import ListItemCollection
14
+ from office365.sharepoint.listitems.listitem import ListItem
12
15
  from office365.sharepoint.lists.render_data_parameters import RenderListDataParameters
13
16
  from office365.sharepoint.lists.render_override_parameters import (
14
17
  RenderListDataOverrideParameters,
@@ -310,14 +313,11 @@ class Tenant(Entity):
310
313
  self.context.add_query(qry)
311
314
  return return_type
312
315
 
313
- def get_site_status(self, url):
314
- """
315
- :param str url:
316
- """
317
- result = self.aggregated_site_collections_list.items.filter(
318
- "SiteUrl eq '{0}'".format(url)
316
+ def get_site(self, site_url):
317
+ # type: (str) -> ListItem
318
+ return self._aggregated_site_collections_list.items.single(
319
+ "SiteUrl eq '{0}'".format(site_url.rstrip("/"))
319
320
  ).get()
320
- return result
321
321
 
322
322
  def get_sites_by_state(self, states=None):
323
323
  """
@@ -325,7 +325,7 @@ class Tenant(Entity):
325
325
  """
326
326
  return_type = ListItemCollection(
327
327
  self.context,
328
- ResourcePath("items", self.aggregated_site_collections_list.resource_path),
328
+ ResourcePath("items", self._aggregated_site_collections_list.resource_path),
329
329
  )
330
330
  payload = {"states": states}
331
331
  qry = ServiceOperationQuery(
@@ -424,11 +424,8 @@ class Tenant(Entity):
424
424
  return self
425
425
 
426
426
  def register_hub_site(self, site_url):
427
- """
428
- Registers an existing site as a hub site.
429
-
430
- :param str site_url:
431
- """
427
+ # type: (str) -> HubSiteProperties
428
+ """Registers an existing site as a hub site."""
432
429
  return_type = HubSiteProperties(self.context)
433
430
  params = {"siteUrl": site_url}
434
431
  qry = ServiceOperationQuery(
@@ -438,11 +435,8 @@ class Tenant(Entity):
438
435
  return return_type
439
436
 
440
437
  def unregister_hub_site(self, site_url):
441
- """
442
- Unregisters a hub site so that it is no longer a hub site.
443
-
444
- :param str site_url: Site Url
445
- """
438
+ # type: (str) -> Self
439
+ """Unregisters a hub site so that it is no longer a hub site."""
446
440
  payload = {"siteUrl": site_url}
447
441
  qry = ServiceOperationQuery(
448
442
  self, "UnregisterHubSite", None, payload, None, None
@@ -526,7 +520,6 @@ class Tenant(Entity):
526
520
 
527
521
  def restore_deleted_site(self, site_url):
528
522
  """Restores deleted site with the specified URL
529
-
530
523
  :param str site_url: A string representing the URL of the site.
531
524
  """
532
525
  return_type = SpoOperation(self.context)
@@ -543,6 +536,7 @@ class Tenant(Entity):
543
536
  :param bool include_detail: A Boolean value that indicates whether to include all of the SPSite properties.
544
537
  """
545
538
  return_type = SiteProperties(self.context)
539
+ return_type.set_property("Url", url, False)
546
540
  self.sites.add_child(return_type)
547
541
  payload = {"url": url, "includeDetail": include_detail}
548
542
  qry = ServiceOperationQuery(
@@ -574,12 +568,8 @@ class Tenant(Entity):
574
568
  return return_type
575
569
 
576
570
  def connect_site_to_hub_site_by_id(self, site_url, hub_site_id):
577
- """
578
-
579
- :param str site_url:
580
- :param str hub_site_id:
581
- :return:
582
- """
571
+ # type: (str, str) -> Self
572
+ """Connects Site to Hub Site"""
583
573
  params = {"siteUrl": site_url, "hubSiteId": hub_site_id}
584
574
  qry = ServiceOperationQuery(
585
575
  self, "ConnectSiteToHubSiteById", None, params, None, None
@@ -588,9 +578,8 @@ class Tenant(Entity):
588
578
  return self
589
579
 
590
580
  def send_email(self, site_url):
591
- """
592
- :type site_url: str
593
- """
581
+ # type: (str) -> ClientResult[bool]
582
+ """ """
594
583
  return_type = ClientResult(self.context, bool())
595
584
  payload = {"siteUrl": site_url}
596
585
  qry = ServiceOperationQuery(self, "SendEmail", None, payload, None, return_type)
@@ -599,10 +588,8 @@ class Tenant(Entity):
599
588
 
600
589
  @property
601
590
  def ai_builder_enabled(self):
602
- """
603
- Gets the value if the AIBuilder settings should be shown in the tenant
604
- :rtype: bool or None
605
- """
591
+ # type: () -> Optional[str]
592
+ """Gets the value if the AIBuilder settings should be shown in the tenant"""
606
593
  return self.properties.get("AIBuilderEnabled", None)
607
594
 
608
595
  @property
@@ -613,26 +600,26 @@ class Tenant(Entity):
613
600
  )
614
601
 
615
602
  @property
616
- def aggregated_site_collections_list(self):
603
+ def _aggregated_site_collections_list(self):
617
604
  return self.context.web.lists.get_by_title(
618
605
  "DO_NOT_DELETE_SPLIST_TENANTADMIN_AGGREGATED_SITECOLLECTIONS"
619
606
  )
620
607
 
621
608
  @property
622
609
  def allow_comments_text_on_email_enabled(self):
610
+ # type: () -> Optional[bool]
623
611
  """
624
612
  When enabled, the email notification that a user receives when is mentioned,
625
- includes the surrounding document context
626
- :rtype: bool or None
613
+ includes the surrounding document context
627
614
  """
628
615
  return self.properties.get("AllowCommentsTextOnEmailEnabled", None)
629
616
 
630
617
  @property
631
618
  def allow_everyone_except_external_users_claim_in_private_site(self):
619
+ # type: () -> Optional[bool]
632
620
  """
633
621
  Gets the value if EveryoneExceptExternalUsers claim is allowed or not in people picker in a private group site.
634
622
  False value means it is blocked
635
- :rtype: bool or None
636
623
  """
637
624
  return self.properties.get(
638
625
  "AllowEveryoneExceptExternalUsersClaimInPrivateSite", None
@@ -640,10 +627,10 @@ class Tenant(Entity):
640
627
 
641
628
  @property
642
629
  def allow_editing(self):
630
+ # type: () -> Optional[bool]
643
631
  """
644
632
  Prevents users from editing Office files in the browser and copying and pasting Office file contents
645
633
  out of the browser window.
646
- :rtype: bool or None
647
634
  """
648
635
  return self.properties.get("AllowEditing", None)
649
636
 
@@ -655,9 +642,7 @@ class Tenant(Entity):
655
642
  @property
656
643
  def root_site_url(self):
657
644
  # type: () -> Optional[str]
658
- """
659
- The tenant's root site url
660
- """
645
+ """The tenant's root site url"""
661
646
  return self.properties.get("RootSiteUrl", None)
662
647
 
663
648
  @property
@@ -13,7 +13,6 @@ class UserCustomActionCollection(EntityCollection[UserCustomAction]):
13
13
  def clear(self):
14
14
  """
15
15
  Deletes all custom actions in the collection.
16
-
17
16
  Exceptions:
18
17
  - 2130575305 Microsoft.SharePoint.SPException Custom action was modified on the server in a way that
19
18
  prevents changes from being committed, as determined by the protocol server.
@@ -1,5 +1,6 @@
1
1
  from office365.runtime.queries.service_operation import ServiceOperationQuery
2
2
  from office365.sharepoint.entity_collection import EntityCollection
3
+ from office365.sharepoint.internal.paths.web import WebPath
3
4
  from office365.sharepoint.webs.web import Web
4
5
 
5
6
 
@@ -25,6 +26,13 @@ class WebCollection(EntityCollection[Web]):
25
26
  self.context.add_query(qry)
26
27
  return return_type
27
28
 
29
+ def create_typed_object(self, initial_properties=None, resource_path=None):
30
+ if resource_path is None:
31
+ resource_path = WebPath(self.resource_path)
32
+ return super(EntityCollection, self).create_typed_object(
33
+ initial_properties, resource_path
34
+ )
35
+
28
36
  @property
29
37
  def resource_url(self):
30
38
  val = super(WebCollection, self).resource_url
@@ -12,10 +12,8 @@ class WebTemplateCollection(EntityCollection[WebTemplate]):
12
12
  )
13
13
 
14
14
  def get_by_name(self, name):
15
- """Returns the SP.WebTemplate (section 3.2.5.151) specified by its name.<162>
16
-
17
- :param str name: The name of the SP.WebTemplate that is returned.
18
-
15
+ """Returns the SP.WebTemplate (section 3.2.5.151) specified by its name.
16
+ :param str name: The name of the WebTemplate that is returned.
19
17
  """
20
18
  return WebTemplate(
21
19
  self.context,
@@ -41,6 +41,7 @@ from office365.sharepoint.files.file import File
41
41
  from office365.sharepoint.flows.synchronization_result import FlowSynchronizationResult
42
42
  from office365.sharepoint.folders.collection import FolderCollection
43
43
  from office365.sharepoint.folders.folder import Folder
44
+ from office365.sharepoint.internal.paths.web import WebPath
44
45
  from office365.sharepoint.listitems.listitem import ListItem
45
46
  from office365.sharepoint.lists.collection import ListCollection
46
47
  from office365.sharepoint.lists.creation_information import ListCreationInformation
@@ -123,10 +124,13 @@ class Web(SecurableObject):
123
124
  :type context: office365.sharepoint.client_context.ClientContext
124
125
  """
125
126
  if resource_path is None:
126
- resource_path = ResourcePath("Web")
127
+ resource_path = WebPath("Web")
127
128
  super(Web, self).__init__(context, resource_path)
128
129
  self._web_url = None
129
130
 
131
+ def __str__(self):
132
+ return self.title
133
+
130
134
  def add_list(self, title, template_type=ListTemplateType.GenericList):
131
135
  """
132
136
  Creates a new list and adds it to the web.
@@ -576,7 +580,7 @@ class Web(SecurableObject):
576
580
  :type webs: office365.sharepoint.webs.collection.WebCollection
577
581
  :type all_webs: office365.sharepoint.webs.collection.WebCollection
578
582
  """
579
- for cur_web in webs: # type: Web
583
+ for cur_web in webs:
580
584
  all_webs.add_child(cur_web)
581
585
 
582
586
  def _webs_loaded(web):
@@ -1098,7 +1102,6 @@ class Web(SecurableObject):
1098
1102
  def get_file_by_guest_url(self, guest_url):
1099
1103
  """
1100
1104
  Returns the file object from the guest access URL.
1101
-
1102
1105
  :param str guest_url: The guest access URL to get the file with.
1103
1106
  """
1104
1107
  return_type = File(self.context)
@@ -1201,7 +1204,7 @@ class Web(SecurableObject):
1201
1204
 
1202
1205
  :param str guest_url: The tokenized sharing link URL for the folder.
1203
1206
  """
1204
- return_type = Folder(self.context)
1207
+ return_type = Folder(self.context, parent_collection=self.folders)
1205
1208
  payload = {"guestUrl": guest_url}
1206
1209
  qry = ServiceOperationQuery(
1207
1210
  self, "GetFolderByGuestUrl", None, payload, None, return_type
@@ -1225,7 +1228,7 @@ class Web(SecurableObject):
1225
1228
  :param bool ensure_access: Indicates if the request to the tokenized sharing link grants perpetual access to
1226
1229
  the calling user.
1227
1230
  """
1228
- return_type = Folder(self.context)
1231
+ return_type = Folder(self.context, parent_collection=self.folders)
1229
1232
  payload = {
1230
1233
  "guestUrl": guest_url,
1231
1234
  "requestSettings": SharingLinkAccessRequest(ensure_access, password),
@@ -1282,9 +1285,10 @@ class Web(SecurableObject):
1282
1285
  """
1283
1286
  return_type = SharingResult(self.context)
1284
1287
 
1285
- def _picker_value_resolved(resp, picker_result, group):
1288
+ def _share(picker_result, group):
1289
+ # type: (ClientResult[str], Group) -> None
1286
1290
  picker_input = "[{0}]".format(picker_result.value)
1287
- role_value = "group:{groupId}".format(groupId=group.properties["Id"])
1291
+ role_value = "group:{groupId}".format(groupId=group.id)
1288
1292
  Web.share_object(
1289
1293
  self.context,
1290
1294
  self.url,
@@ -1299,26 +1303,26 @@ class Web(SecurableObject):
1299
1303
  return_type=return_type,
1300
1304
  )
1301
1305
 
1302
- def _grp_resolved(group):
1303
- picker_result = (
1304
- ClientPeoplePickerWebServiceInterface.client_people_picker_resolve_user(
1305
- self.context, user_principal_name
1306
- )
1307
- )
1308
- self.context.after_execute(
1309
- _picker_value_resolved, True, picker_result, group
1310
- )
1311
-
1312
1306
  def _web_resolved():
1313
1307
  groups = {
1314
1308
  ExternalSharingSiteOption.View: self.associated_visitor_group,
1315
1309
  ExternalSharingSiteOption.Edit: self.associated_member_group,
1316
1310
  ExternalSharingSiteOption.Owner: self.associated_owner_group,
1317
- }
1318
- selected_group = groups[share_option]
1319
- self.context.load(selected_group, after_loaded=_grp_resolved)
1311
+ } # type: dict[ExternalSharingSiteOption, Group]
1312
+
1313
+ ClientPeoplePickerWebServiceInterface.client_people_picker_resolve_user(
1314
+ self.context, user_principal_name
1315
+ ).after_execute(_share, groups[share_option])
1320
1316
 
1321
- self.ensure_property("Url", _web_resolved)
1317
+ self.ensure_properties(
1318
+ [
1319
+ "Url",
1320
+ "AssociatedVisitorGroup",
1321
+ "AssociatedMemberGroup",
1322
+ "AssociatedOwnerGroup",
1323
+ ],
1324
+ _web_resolved,
1325
+ )
1322
1326
  return return_type
1323
1327
 
1324
1328
  def unshare(self):
@@ -2380,9 +2384,7 @@ class Web(SecurableObject):
2380
2384
 
2381
2385
  @property
2382
2386
  def server_relative_path(self):
2383
- """
2384
- Gets the server-relative Path of the Web.
2385
- """
2387
+ """Gets the server-relative Path of the Web."""
2386
2388
  return self.properties.get("ServerRelativePath", SPResPath())
2387
2389
 
2388
2390
  @property
@@ -2450,6 +2452,7 @@ class Web(SecurableObject):
2450
2452
  super(Web, self).set_property(name, value, persist_changes)
2451
2453
  if name == "Url":
2452
2454
  self._web_url = value
2455
+ self._resource_path.patch(value)
2453
2456
  return self
2454
2457
 
2455
2458
  @property
@@ -9,6 +9,7 @@ class TeamsApp(Entity):
9
9
 
10
10
  @property
11
11
  def app_definitions(self):
12
+ # type: () -> EntityCollection[TeamsAppDefinition]
12
13
  """The details for each version of the app."""
13
14
  return self.properties.get(
14
15
  "appDefinitions",
@@ -1,10 +1,10 @@
1
1
  from typing import Callable
2
2
 
3
+ import requests
3
4
  from typing_extensions import Self
4
5
 
5
- from office365.directory.groups.group import Group
6
6
  from office365.entity_collection import EntityCollection
7
- from office365.runtime.odata.path_builder import ODataPathBuilder
7
+ from office365.runtime.paths.builder import ODataPathBuilder
8
8
  from office365.runtime.paths.resource_path import ResourcePath
9
9
  from office365.runtime.queries.create_entity import CreateEntityQuery
10
10
  from office365.teams.operations.async_operation import TeamsAsyncOperation
@@ -44,26 +44,22 @@ class TeamCollection(EntityCollection[Team]):
44
44
  return_type = Team(self.context)
45
45
  self.add_child(return_type)
46
46
 
47
- payload = {
48
- "displayName": display_name,
49
- "description": description,
50
- "template@odata.bind": "https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
51
- }
52
- qry = CreateEntityQuery(self, payload, return_type)
53
- self.context.add_query(qry)
54
-
55
47
  def _process_response(resp):
56
- """
57
- :type resp: requests.Response
58
- """
48
+ # type: (requests.Response) -> None
59
49
  content_loc = resp.headers.get("Content-Location", None)
60
- team_path = ODataPathBuilder.parse(content_loc)
50
+ team_path = ODataPathBuilder.parse_url(content_loc)
61
51
  return_type.set_property("id", team_path.segment, False)
62
52
 
63
53
  loc = resp.headers.get("Location", None)
64
- operation_path = ODataPathBuilder.parse(loc)
54
+ operation_path = ODataPathBuilder.parse_url(loc)
65
55
  operation = TeamsAsyncOperation(self.context, operation_path)
66
56
  return_type.operations.add_child(operation)
67
57
 
68
- self.context.after_execute(_process_response)
58
+ payload = {
59
+ "displayName": display_name,
60
+ "description": description,
61
+ "template@odata.bind": "https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
62
+ }
63
+ qry = CreateEntityQuery(self, payload, return_type)
64
+ self.context.add_query(qry).after_execute(_process_response)
69
65
  return return_type
@@ -2,7 +2,7 @@ from office365.entity_collection import EntityCollection
2
2
  from office365.teams.members.conversation import ConversationMember
3
3
 
4
4
 
5
- class ConversationMemberCollection(EntityCollection):
5
+ class ConversationMemberCollection(EntityCollection[ConversationMember]):
6
6
  def __init__(self, context, resource_path=None):
7
7
  super(ConversationMemberCollection, self).__init__(
8
8
  context, ConversationMember, resource_path
@@ -18,8 +18,6 @@ class ConversationMemberCollection(EntityCollection):
18
18
  Each member must be assigned a role of owner or guest. Guest tenant members must be assigned the guest role
19
19
  :param list[str] roles: The roles for that user.
20
20
  :param datetime.datetime visible_history_start_datetime:
21
-
22
- :rtype: ConversationMember
23
21
  """
24
22
  return_type = super(ConversationMemberCollection, self).add(roles=roles)
25
23
  from office365.directory.users.user import User
@@ -68,16 +68,14 @@ class TeamsAsyncOperation(Entity):
68
68
 
69
69
  @property
70
70
  def target_resource_location(self):
71
+ # type: () -> Optional[str]
71
72
  """The location of the object that's created or modified as result of this async operation.
72
73
  This URL should be treated as an opaque value and not parsed into its component paths.
73
- :rtype: str or None
74
74
  """
75
75
  return self.properties.get("targetResourceLocation", None)
76
76
 
77
77
  @property
78
78
  def status(self):
79
- """
80
- Operation status.
81
- :rtype: str
82
- """
79
+ # type: () -> Optional[str]
80
+ """Operation status."""
83
81
  return self.properties.get("status", None)
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.runtime.types.collections import StringCollection
2
4
  from office365.teams.schedule.change_tracked_entity import ChangeTrackedEntity
3
5
 
@@ -7,6 +9,7 @@ class SchedulingGroup(ChangeTrackedEntity):
7
9
 
8
10
  @property
9
11
  def is_active(self):
12
+ # type: () -> Optional[bool]
10
13
  """Indicates whether the schedulingGroup can be used when creating new entities or updating existing ones"""
11
14
  return self.properties.get("isActive", None)
12
15
 
office365/teams/team.py CHANGED
@@ -321,6 +321,6 @@ class Team(Entity):
321
321
  def set_property(self, name, value, persist_changes=True):
322
322
  super(Team, self).set_property(name, value, persist_changes)
323
323
  # fallback: determine whether resource path is resolved
324
- if name == "id" and self._resource_path.key == "team":
324
+ if name == "id" and self._resource_path.segment == "team":
325
325
  self._resource_path = ResourcePath(value, ResourcePath("teams"))
326
326
  return self
@@ -1,4 +1,5 @@
1
1
  import datetime
2
+ from typing import Optional
2
3
 
3
4
  from office365.entity import Entity
4
5
 
@@ -9,14 +10,13 @@ class AttachmentBase(Entity):
9
10
 
10
11
  @property
11
12
  def content_type(self):
12
- """
13
- The MIME type.
14
- :rtype: str or None
15
- """
13
+ # type: () -> Optional[str]
14
+ """The MIME type."""
16
15
  return self.properties.get("contentType", None)
17
16
 
18
17
  @property
19
18
  def last_modified_datetime(self):
19
+ # type: () -> Optional[datetime.datetime]
20
20
  """
21
21
  The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time.
22
22
  """
@@ -24,16 +24,14 @@ class AttachmentBase(Entity):
24
24
 
25
25
  @property
26
26
  def name(self):
27
+ # type: () -> Optional[str]
27
28
  """
28
29
  The display name of the attachment. This does not need to be the actual file name.
29
- :rtype: str or None
30
30
  """
31
31
  return self.properties.get("name", None)
32
32
 
33
33
  @property
34
34
  def size(self):
35
- """
36
- The length of the attachment in bytes.
37
- :rtype: int or None
38
- """
35
+ # type: () -> Optional[int]
36
+ """The length of the attachment in bytes."""
39
37
  return self.properties.get("size", None)
@@ -1,23 +0,0 @@
1
- import json
2
- import re
3
-
4
- from office365.runtime.client_value import ClientValue
5
- from office365.runtime.compat import is_string_type
6
- from office365.runtime.paths.resource_path import ResourcePath
7
-
8
-
9
- class ODataPathBuilder(object):
10
- @staticmethod
11
- def parse(path_str):
12
- """
13
- Parses path from a string
14
-
15
- :param str path_str:
16
- """
17
- segments = [n for n in re.split(r"[('')]|/", path_str) if n]
18
- if not segments:
19
- raise TypeError("Invalid path")
20
- path = None
21
- for segment in segments:
22
- path = ResourcePath(segment, path)
23
- return path
@@ -1,28 +0,0 @@
1
- from office365.runtime.client_value import ClientValue
2
- from office365.runtime.client_value_collection import ClientValueCollection
3
-
4
-
5
- class KeyValue(ClientValue):
6
- """Represents a key value pair."""
7
-
8
- def __init__(self, key=None, value=None, value_type=None):
9
- """
10
- :param str key: The value of the key in the key value pair.
11
- :param str value: The string representation of the value in the key value pair.
12
- :param str value_type: The EDM type name of the value in the key value pair.
13
- """
14
- self.Key = key
15
- self.Value = value
16
- self.ValueType = value_type
17
-
18
- @property
19
- def entity_type_name(self):
20
- return "SP.KeyValue"
21
-
22
-
23
- class KeyValueCollection(ClientValueCollection):
24
- def __init__(self, initial_values=None):
25
- """
26
- :type initial_values: list[KeyValue] or None
27
- """
28
- super(KeyValueCollection, self).__init__(KeyValue, initial_values)