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,5 +1,6 @@
1
+ import os
1
2
  from datetime import datetime
2
- from typing import Optional
3
+ from typing import AnyStr, Optional
3
4
 
4
5
  from office365.runtime.client_result import ClientResult
5
6
  from office365.runtime.client_value_collection import ClientValueCollection
@@ -7,6 +8,7 @@ from office365.runtime.paths.resource_path import ResourcePath
7
8
  from office365.runtime.paths.service_operation import ServiceOperationPath
8
9
  from office365.runtime.queries.service_operation import ServiceOperationQuery
9
10
  from office365.sharepoint.changes.collection import ChangeCollection
11
+ from office365.sharepoint.changes.log_item_query import ChangeLogItemQuery
10
12
  from office365.sharepoint.changes.query import ChangeQuery
11
13
  from office365.sharepoint.changes.token import ChangeToken
12
14
  from office365.sharepoint.contenttypes.collection import ContentTypeCollection
@@ -133,9 +135,7 @@ class List(SecurableObject):
133
135
  return return_type
134
136
 
135
137
  def get_metadata_navigation_settings(self):
136
- """
137
- Retrieves the configured metadata navigation settings for the list.
138
- """
138
+ """Retrieves the configured metadata navigation settings for the list."""
139
139
  from office365.sharepoint.navigation.metadata_settings import (
140
140
  MetadataNavigationSettings,
141
141
  )
@@ -153,12 +153,10 @@ class List(SecurableObject):
153
153
  return return_type
154
154
 
155
155
  def get_sharing_settings(self):
156
- """
157
- Retrieves a sharing settings for a List
158
- """
156
+ """Retrieves a sharing settings for a List"""
159
157
  return_type = ObjectSharingSettings(self.context)
160
158
 
161
- def _list_loaded():
159
+ def _get_sharing_settings():
162
160
  from office365.sharepoint.webs.web import Web
163
161
 
164
162
  list_abs_path = SPResPath.create_absolute(
@@ -168,7 +166,7 @@ class List(SecurableObject):
168
166
  self.context, str(list_abs_path), return_type=return_type
169
167
  )
170
168
 
171
- self.ensure_property("RootFolder", _list_loaded)
169
+ self.ensure_property("RootFolder", _get_sharing_settings)
172
170
  return return_type
173
171
 
174
172
  def get_site_script(self, options=None):
@@ -190,9 +188,7 @@ class List(SecurableObject):
190
188
  return return_type
191
189
 
192
190
  def get_all_rules(self):
193
- """
194
- Retrieves rules of a List
195
- """
191
+ """Retrieves rules of a List"""
196
192
  return_type = ClientResult(self.context, ClientValueCollection(SPListRule))
197
193
  qry = ServiceOperationQuery(self, "GetAllRules", None, None, None, return_type)
198
194
  self.context.add_query(qry)
@@ -390,11 +386,10 @@ class List(SecurableObject):
390
386
  return return_type
391
387
 
392
388
  def get_list_item_changes_since_token(self, query):
389
+ # type: (ChangeLogItemQuery) -> ClientResult[AnyStr]
393
390
  """
394
391
  Returns the changes made to the list since the date and time specified in the change token defined
395
392
  by the query input parameter.
396
-
397
- :type query: office365.sharepoint.changes.log_item_query.ChangeLogItemQuery
398
393
  """
399
394
  return_type = ClientResult(self.context, bytes())
400
395
  payload = {"query": query}
@@ -437,7 +432,6 @@ class List(SecurableObject):
437
432
  :param str description: A string that contains the description for the list template.
438
433
  :param str name: A string that contains the title for the list template.
439
434
  :param str file_name: A string that contains the file name for the list template with an .stp extension.
440
- :return:
441
435
  """
442
436
  payload = {
443
437
  "strFileName": file_name,
@@ -460,11 +454,10 @@ class List(SecurableObject):
460
454
  )
461
455
 
462
456
  def get_web_dav_url(self, source_url):
457
+ # type: (str) -> ClientResult[str]
463
458
  """
464
459
  Gets the trusted URL for opening the folder in Explorer view.
465
-
466
460
  :param str source_url: The URL of the current folder the user is in.
467
- :return: ClientResult
468
461
  """
469
462
 
470
463
  return_type = ClientResult(self.context, str())
@@ -476,10 +469,8 @@ class List(SecurableObject):
476
469
  return return_type
477
470
 
478
471
  def get_items(self, caml_query=None):
479
- """Returns a collection of items from the list based on the specified query.
480
-
481
- :type caml_query: CamlQuery
482
- """
472
+ # type: (CamlQuery) -> ListItemCollection
473
+ """Returns a collection of items from the list based on the specified query."""
483
474
  if not caml_query:
484
475
  caml_query = CamlQuery.create_all_items_query()
485
476
  return_type = ListItemCollection(self.context, self.items.resource_path)
@@ -585,14 +576,29 @@ class List(SecurableObject):
585
576
  return return_type
586
577
 
587
578
  def get_item_by_id(self, item_id):
588
- """Returns the list item with the specified list item identifier.
589
- :type item_id: int
590
- """
579
+ # type: (int) -> ListItem
580
+ """Returns the list item with the specified list item identifier."""
591
581
  return ListItem(
592
582
  self.context,
593
583
  ServiceOperationPath("getItemById", [item_id], self.resource_path),
594
584
  )
595
585
 
586
+ def get_item_by_url(self, url):
587
+ # type: (str) -> ListItem
588
+ """Returns the list item with the specified site or server relative url."""
589
+ return_type = ListItem(self.context)
590
+ self.items.add_child(return_type)
591
+
592
+ def _after_loaded(item):
593
+ [return_type.set_property(k, v, False) for k, v in item.properties.items()]
594
+
595
+ def _get_item_by_url():
596
+ path = os.path.join(self.root_folder.serverRelativeUrl, url)
597
+ self.items.get_by_url(path).after_execute(_after_loaded, execute_first=True)
598
+
599
+ self.ensure_property("RootFolder", _get_item_by_url)
600
+ return return_type
601
+
596
602
  def get_view(self, view_id):
597
603
  """Returns the list view with the specified view identifier.
598
604
  :type view_id: str
@@ -629,10 +635,9 @@ class List(SecurableObject):
629
635
  return return_type
630
636
 
631
637
  def reserve_list_item_id(self):
632
- """
633
- Reserves the returned list item identifier for the idempotent creation of a list item.
634
- """
635
- return_type = ClientResult(self.context, int()) # type: ClientResult[int]
638
+ # type: () -> ClientResult[int]
639
+ """Reserves the returned list item identifier for the idempotent creation of a list item."""
640
+ return_type = ClientResult(self.context, int())
636
641
  qry = ServiceOperationQuery(
637
642
  self, "ReserveListItemId", None, None, None, return_type
638
643
  )
@@ -672,8 +677,7 @@ class List(SecurableObject):
672
677
  @property
673
678
  def id(self):
674
679
  # type: () -> Optional[str]
675
- """
676
- Gets a value that specifies the list identifier."""
680
+ """Gets a value that specifies the list identifier."""
677
681
  return self.properties.get("Id", None)
678
682
 
679
683
  @property
@@ -691,25 +695,19 @@ class List(SecurableObject):
691
695
  @property
692
696
  def allow_content_types(self):
693
697
  # type: () -> Optional[bool]
694
- """
695
- Specifies whether the list supports content types.
696
- """
698
+ """Specifies whether the list supports content types."""
697
699
  return self.properties.get("AllowContentTypes", None)
698
700
 
699
701
  @property
700
702
  def allow_deletion(self):
701
703
  # type: () -> Optional[bool]
702
- """
703
- Specifies whether the list could be deleted.
704
- """
704
+ """Specifies whether the list could be deleted."""
705
705
  return self.properties.get("AllowDeletion", None)
706
706
 
707
707
  @property
708
708
  def base_template(self):
709
709
  # type: () -> Optional[int]
710
- """
711
- Specifies the list server template of the list.
712
- """
710
+ """Specifies the list server template of the list."""
713
711
  return self.properties.get("BaseTemplate", None)
714
712
 
715
713
  @property
@@ -740,16 +738,12 @@ class List(SecurableObject):
740
738
  @property
741
739
  def default_display_form_url(self):
742
740
  # type: () -> Optional[str]
743
- """
744
- Specifies the location of the default display form for the list.
745
- """
741
+ """Specifies the location of the default display form for the list."""
746
742
  return self.properties.get("DefaultDisplayFormUrl", None)
747
743
 
748
744
  @property
749
745
  def default_view_path(self):
750
- """
751
- Specifies the server-relative URL of the default view for the list.
752
- """
746
+ """Specifies the server-relative URL of the default view for the list."""
753
747
  return self.properties.get("DefaultViewPath", SPResPath())
754
748
 
755
749
  @property
@@ -803,9 +797,7 @@ class List(SecurableObject):
803
797
  @property
804
798
  def default_edit_form_url(self):
805
799
  # type: () -> Optional[str]
806
- """
807
- Gets a value that specifies the URL of the edit form to use for list items in the list.
808
- """
800
+ """Gets a value that specifies the URL of the edit form to use for list items in the list."""
809
801
  return self.properties.get("DefaultEditFormUrl", None)
810
802
 
811
803
  @property
@@ -871,9 +863,7 @@ class List(SecurableObject):
871
863
  @property
872
864
  def enable_folder_creation(self):
873
865
  # type: () -> Optional[bool]
874
- """
875
- Specifies whether new list folders can be added to the list.
876
- """
866
+ """Specifies whether new list folders can be added to the list."""
877
867
  return self.properties.get("EnableFolderCreation", None)
878
868
 
879
869
  @enable_folder_creation.setter
@@ -884,17 +874,13 @@ class List(SecurableObject):
884
874
  @property
885
875
  def enable_minor_versions(self):
886
876
  # type: () -> Optional[bool]
887
- """
888
- Specifies whether minor versions are enabled for the list.
889
- """
877
+ """Specifies whether minor versions are enabled for the list."""
890
878
  return self.properties.get("EnableMinorVersions", None)
891
879
 
892
880
  @property
893
881
  def enable_moderation(self):
894
882
  # type: () -> Optional[bool]
895
- """
896
- Specifies whether content approval is enabled for the list.
897
- """
883
+ """Specifies whether content approval is enabled for the list."""
898
884
  return self.properties.get("EnableModeration", None)
899
885
 
900
886
  @property
@@ -905,9 +891,7 @@ class List(SecurableObject):
905
891
  @property
906
892
  def enable_versioning(self):
907
893
  # type: () -> Optional[bool]
908
- """
909
- Specifies whether content approval is enabled for the list.
910
- """
894
+ """Specifies whether content approval is enabled for the list."""
911
895
  return self.properties.get("EnableVersioning", None)
912
896
 
913
897
  @property
@@ -1,40 +1,36 @@
1
1
  import random
2
+ from typing import AnyStr
2
3
 
3
4
  from office365.runtime.client_result import ClientResult
4
5
  from office365.runtime.http.http_method import HttpMethod
6
+ from office365.runtime.http.request_options import RequestOptions
5
7
  from office365.runtime.queries.service_operation import ServiceOperationQuery
6
8
  from office365.sharepoint.entity import Entity
7
9
 
8
10
 
9
11
  class GroupService(Entity):
10
- def __init__(self, context, resource_path=None):
11
- super(GroupService, self).__init__(context, resource_path)
12
-
13
- def get_group_image(self, group_id, image_hash=None, image_color=None):
14
- """
15
- :param str group_id:
16
- :param int or None image_hash:
17
- :param str or None image_color:
18
- """
19
- return_type = ClientResult(self.context)
12
+ def get_group_image(
13
+ self, group_id, image_hash=None, image_color=None, return_type=None
14
+ ):
15
+ # type: (str, str, str, ClientResult) -> ClientResult[AnyStr]
16
+ if return_type is None:
17
+ return_type = ClientResult(self.context)
20
18
  if image_hash is None:
21
19
  image_hash = random.getrandbits(64)
22
20
  qry = ServiceOperationQuery(
23
21
  self, "GetGroupImage", None, None, None, return_type
24
22
  )
25
23
 
26
- def _modify_request(request):
27
- """
28
- :type request: office365.runtime.http.request_options.RequestOptions
29
- """
24
+ def _create_request(request):
25
+ # type: (RequestOptions) -> None
30
26
  request.url += "?id='{0}'&hash={1}".format(group_id, image_hash)
31
27
  request.method = HttpMethod.Get
32
28
 
33
- self.context.before_execute(_modify_request)
34
- self.context.add_query(qry)
29
+ self.context.add_query(qry).before_execute(_create_request)
35
30
  return return_type
36
31
 
37
32
  def sync_group_properties(self):
33
+ """ """
38
34
  qry = ServiceOperationQuery(self, "SyncGroupProperties")
39
35
  self.context.add_query(qry)
40
36
  return self
@@ -120,7 +120,6 @@ class GroupSiteManager(ClientObject):
120
120
  ):
121
121
  """
122
122
  Get the teams in Microsoft Teams that the current user is a direct member of.
123
-
124
123
  :type get_logo_data: bool
125
124
  :type force_cache_update: bool
126
125
  """
@@ -15,6 +15,9 @@ if TYPE_CHECKING:
15
15
  class SitePageMetadata(Entity):
16
16
  """Represents the core properties of a Site Page."""
17
17
 
18
+ def __repr__(self):
19
+ return self.file_name or self.absolute_url or self.entity_type_name
20
+
18
21
  @property
19
22
  def absolute_url(self):
20
23
  # type: () -> Optional[str]
@@ -128,9 +131,11 @@ class SitePageMetadata(Entity):
128
131
  return super(SitePageMetadata, self).get_property(name, default_value)
129
132
 
130
133
  def set_property(self, name, value, persist_changes=True):
131
- if self._resource_path is None:
132
- if name == "Id":
134
+ if name == "Id":
135
+ if self._resource_path is None:
133
136
  self._resource_path = self.parent_collection.get_by_id(
134
137
  value
135
138
  ).resource_path
139
+ else:
140
+ self._resource_path.patch(value)
136
141
  return super(SitePageMetadata, self).set_property(name, value, persist_changes)
@@ -12,7 +12,6 @@ class SitePageMetadataCollection(EntityCollection[T]):
12
12
 
13
13
  def get_by_id(self, site_page_id):
14
14
  """Gets the site page with the specified ID.
15
-
16
15
  :param int site_page_id: Specifies the identifier of the site page.
17
16
  """
18
17
  return SitePageMetadata(
@@ -216,16 +216,13 @@ class SitePage(SitePageMetadata):
216
216
  @property
217
217
  def layout_web_parts_content(self):
218
218
  # type: () -> Optional[str]
219
- """
220
- Gets the LayoutWebPartsContent field for the current Site Page.
221
- """
219
+ """Gets the LayoutWebPartsContent field for the current Site Page."""
222
220
  return self.properties.get("LayoutWebpartsContent", None)
223
221
 
224
222
  @layout_web_parts_content.setter
225
223
  def layout_web_parts_content(self, value):
226
- """
227
- Sets the LayoutWebPartsContent field for the current Site Page.
228
- """
224
+ # type: (str) -> None
225
+ """Sets the LayoutWebPartsContent field for the current Site Page."""
229
226
  self.set_property("LayoutWebpartsContent", value)
230
227
 
231
228
  @property
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.sharepoint.publishing.pages.page import SitePage
2
4
 
3
5
 
@@ -7,23 +9,17 @@ class RepostPage(SitePage):
7
9
 
8
10
  @property
9
11
  def is_banner_image_url_external(self):
10
- """
11
- :rtype: bool or None
12
- """
12
+ # type: () -> Optional[bool]
13
13
  return self.properties.get("IsBannerImageUrlExternal", None)
14
14
 
15
15
  @property
16
16
  def original_source_item_id(self):
17
- """
18
- :rtype: str or None
19
- """
17
+ # type: () -> Optional[str]
20
18
  return self.properties.get("OriginalSourceItemId", None)
21
19
 
22
20
  @property
23
21
  def original_source_url(self):
24
- """
25
- :rtype: str or None
26
- """
22
+ # type: () -> Optional[str]
27
23
  return self.properties.get("OriginalSourceUrl", None)
28
24
 
29
25
  @property
@@ -1,5 +1,8 @@
1
+ from typing import Optional
2
+
1
3
  from office365.runtime.paths.resource_path import ResourcePath
2
4
  from office365.runtime.paths.service_operation import ServiceOperationPath
5
+ from office365.runtime.paths.v3.entity import EntityPath
3
6
  from office365.runtime.queries.service_operation import ServiceOperationQuery
4
7
  from office365.sharepoint.entity import Entity
5
8
  from office365.sharepoint.principal.users.user import User
@@ -30,17 +33,13 @@ class RecycleBinItem(Entity):
30
33
 
31
34
  @property
32
35
  def size(self):
33
- """Gets a value that specifies the size of the Recycle Bin item in bytes.
34
-
35
- :rtype: long or None
36
- """
36
+ # type: () -> Optional[int]
37
+ """Gets a value that specifies the size of the Recycle Bin item in bytes."""
37
38
  return self.properties.get("Size", None)
38
39
 
39
40
  @property
40
41
  def author(self):
41
- """
42
- Gets a value that specifies the user who created the Recycle Bin item.
43
- """
42
+ """Gets a value that specifies the user who created the Recycle Bin item."""
44
43
  return self.properties.get(
45
44
  "Author", User(self.context, ResourcePath("Author", self.resource_path))
46
45
  )
@@ -61,8 +60,11 @@ class RecycleBinItem(Entity):
61
60
  def set_property(self, name, value, persist_changes=True):
62
61
  super(RecycleBinItem, self).set_property(name, value, persist_changes)
63
62
  # fallback: create a new resource path
64
- if self._resource_path is None:
65
- if name == "Id" and self._parent_collection is not None:
63
+
64
+ if name == "Id":
65
+ if self._resource_path is None:
66
66
  self._resource_path = ServiceOperationPath(
67
67
  "GetById", [value], self._parent_collection.resource_path
68
68
  )
69
+ else:
70
+ self._resource_path.patch(value)
@@ -13,6 +13,9 @@ class ShareLinkResponse(ClientValue):
13
13
  """
14
14
  self.sharingLinkInfo = sharing_link_info
15
15
 
16
+ def __str__(self):
17
+ return self.sharingLinkInfo.Url
18
+
16
19
  @property
17
20
  def entity_type_name(self):
18
21
  return "SP.Sharing.ShareLinkResponse"
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.runtime.client_value_collection import ClientValueCollection
2
4
  from office365.runtime.paths.resource_path import ResourcePath
3
5
  from office365.sharepoint.entity import Entity
@@ -13,63 +15,48 @@ class SharingResult(Entity):
13
15
 
14
16
  @property
15
17
  def url(self):
16
- """Gets the URL of the securable object being shared.
17
-
18
- :rtype: str or None
19
- """
18
+ # type: () -> Optional[str]
19
+ """Gets the URL of the securable object being shared."""
20
20
  return self.properties.get("Url", None)
21
21
 
22
22
  @property
23
23
  def error_message(self):
24
- """Gets an error message about the failure if sharing was unsuccessful.
25
-
26
- :rtype: str or None
27
- """
24
+ # type: () -> Optional[str]
25
+ """Gets an error message about the failure if sharing was unsuccessful."""
28
26
  return self.properties.get("ErrorMessage", None)
29
27
 
30
28
  @property
31
29
  def name(self):
32
- """
33
- Gets the name of the securable object being shared.
34
-
35
- :rtype: str or None
36
- """
30
+ # type: () -> Optional[str]
31
+ """Gets the name of the securable object being shared."""
37
32
  return self.properties.get("Name", None)
38
33
 
39
34
  @property
40
35
  def icon_url(self):
41
- """
42
- Gets a URL to an icon that represents the securable object, if one exists.
43
-
44
- :rtype: str or None
45
- """
36
+ # type: () -> Optional[str]
37
+ """Gets a URL to an icon that represents the securable object, if one exists."""
46
38
  return self.properties.get("IconUrl", None)
47
39
 
48
40
  @property
49
41
  def status_code(self):
42
+ # type: () -> Optional[int]
50
43
  """
51
44
  Gets the enumeration value which summarizes the result of the sharing operation.
52
-
53
- :rtype: int or None
54
45
  """
55
46
  return self.properties.get("StatusCode", None)
56
47
 
57
48
  @property
58
49
  def permissions_page_relative_url(self):
59
- """
60
- Gets the relative URL of the page that shows permissions.
61
-
62
- :rtype: str or None
63
- """
50
+ # type: () -> Optional[str]
51
+ """Gets the relative URL of the page that shows permissions."""
64
52
  return self.properties.get("PermissionsPageRelativeUrl", None)
65
53
 
66
54
  @property
67
55
  def invited_users(self):
56
+ # type: () -> ClientValueCollection[SPInvitationCreationResult]
68
57
  """
69
58
  Gets a list of SPInvitationCreationResult (section 3.2.5.325) objects representing the external users being
70
59
  invited to have access.
71
-
72
- :rtype: ClientValueCollection
73
60
  """
74
61
  return self.properties.get(
75
62
  "InvitedUsers", ClientValueCollection(SPInvitationCreationResult)
@@ -77,20 +64,13 @@ class SharingResult(Entity):
77
64
 
78
65
  @property
79
66
  def uniquely_permissioned_users(self):
80
- """
81
-
82
- :rtype: ClientValueCollection
83
- """
67
+ # type: () -> ClientValueCollection[UserSharingResult]
84
68
  return self.properties.get(
85
69
  "UniquelyPermissionedUsers", ClientValueCollection(UserSharingResult)
86
70
  )
87
71
 
88
72
  @property
89
73
  def groups_shared_with(self):
90
- """
91
-
92
- :rtype: ClientValueCollection
93
- """
94
74
  return self.properties.get(
95
75
  "GroupsSharedWith",
96
76
  GroupCollection(
@@ -100,11 +80,8 @@ class SharingResult(Entity):
100
80
 
101
81
  @property
102
82
  def users_added_to_group(self):
103
- """
104
- Gets the list of users being added to the SharePoint permissions group.
105
-
106
- :rtype: ClientValueCollection
107
- """
83
+ # type: () -> ClientValueCollection[UserSharingResult]
84
+ """Gets the list of users being added to the SharePoint permissions group."""
108
85
  return self.properties.get(
109
86
  "UsersAddedToGroup", ClientValueCollection(UserSharingResult)
110
87
  )
@@ -124,5 +101,5 @@ class SharingResult(Entity):
124
101
  if self._resource_path is None:
125
102
  if name == "Name":
126
103
  pass
127
- # self._resource_path = ResourcePath(value, self._parent_collection.resource_path)
104
+ # self._resource_path = ResourcePath(value, self.parent_collection.resource_path)
128
105
  return self