Office365-REST-Python-Client 2.5.4__py3-none-any.whl → 2.5.6__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 (225) hide show
  1. {Office365_REST_Python_Client-2.5.4.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/METADATA +2 -2
  2. {Office365_REST_Python_Client-2.5.4.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/RECORD +224 -204
  3. office365/booking/business/business.py +5 -3
  4. office365/booking/virtualevents/__init__.py +0 -0
  5. office365/booking/virtualevents/root.py +5 -0
  6. office365/communications/calls/participant.py +4 -5
  7. office365/directory/applications/application.py +3 -3
  8. office365/directory/applications/roles/assignment_collection.py +1 -1
  9. office365/directory/applications/roles/collection.py +2 -2
  10. office365/directory/authentication/method_configuration.py +9 -0
  11. office365/directory/authentication/method_mode_detail.py +8 -0
  12. office365/directory/authentication/method_target.py +5 -0
  13. office365/directory/authentication/strength_root.py +5 -0
  14. office365/directory/certificates/auth_configuration.py +1 -3
  15. office365/directory/extensions/extended_property.py +4 -4
  16. office365/directory/extensions/open_type.py +4 -4
  17. office365/directory/groups/group.py +2 -6
  18. office365/directory/identities/conditional_access_root.py +10 -1
  19. office365/directory/identities/container.py +3 -9
  20. office365/directory/identities/providers/base.py +7 -5
  21. office365/directory/identities/providers/builtin_identity.py +3 -2
  22. office365/directory/identities/providers/saml_or_wsfed.py +4 -5
  23. office365/directory/identities/providers/social_identity.py +5 -3
  24. office365/directory/identities/userflows/b2x/user_flow.py +6 -5
  25. office365/directory/identities/userflows/language_configuration.py +10 -7
  26. office365/directory/identitygovernance/governance.py +14 -3
  27. office365/directory/identitygovernance/privilegedaccess/__init__.py +0 -0
  28. office365/directory/identitygovernance/privilegedaccess/root.py +5 -0
  29. office365/directory/key_credential.py +3 -0
  30. office365/directory/licenses/assignment_state.py +26 -2
  31. office365/directory/licenses/details.py +8 -6
  32. office365/directory/licenses/subscribed_sku.py +8 -10
  33. office365/directory/object_collection.py +40 -25
  34. office365/directory/password_credential.py +3 -0
  35. office365/directory/permissions/default_user_role.py +5 -0
  36. office365/directory/permissions/grants/condition_set.py +4 -2
  37. office365/directory/permissions/grants/oauth2.py +7 -10
  38. office365/directory/policies/authorization.py +50 -3
  39. office365/directory/policies/permission_grant.py +2 -0
  40. office365/directory/profile_photo.py +6 -6
  41. office365/directory/protection/riskyusers/risky_user.py +4 -4
  42. office365/directory/rolemanagement/resource_action.py +10 -0
  43. office365/directory/rolemanagement/role_permission.py +10 -0
  44. office365/directory/security/alerts/alert.py +5 -7
  45. office365/directory/security/attacksimulations/landing_page.py +5 -0
  46. office365/directory/security/attacksimulations/operation.py +5 -0
  47. office365/directory/security/attacksimulations/report.py +8 -1
  48. office365/directory/security/attacksimulations/root.py +33 -0
  49. office365/directory/security/attacksimulations/users/__init__.py +0 -0
  50. office365/directory/security/attacksimulations/users/details.py +5 -0
  51. office365/directory/security/hunting_query_results.py +5 -0
  52. office365/directory/security/incidents/incident.py +8 -13
  53. office365/directory/security/security.py +20 -3
  54. office365/directory/serviceprincipals/service_principal.py +3 -4
  55. office365/directory/synchronization/synchronization.py +2 -0
  56. office365/directory/users/activities/history_item.py +3 -2
  57. office365/directory/users/user.py +37 -10
  58. office365/entity_collection.py +3 -2
  59. office365/graph_client.py +58 -30
  60. office365/intune/audit/event.py +1 -3
  61. office365/intune/audit/event_collection.py +1 -1
  62. office365/intune/devices/alternative_security_id.py +4 -0
  63. office365/intune/devices/collection.py +57 -0
  64. office365/intune/devices/device.py +38 -10
  65. office365/intune/devices/management/management.py +12 -0
  66. office365/intune/organizations/organization.py +1 -0
  67. office365/onedrive/analytics/item_activity_stat.py +9 -0
  68. office365/onedrive/analytics/item_analytics.py +1 -0
  69. office365/onedrive/contenttypes/content_type.py +4 -12
  70. office365/onedrive/driveitems/driveItem.py +9 -10
  71. office365/onedrive/files/hashes.py +5 -0
  72. office365/onedrive/lists/collection.py +2 -2
  73. office365/onedrive/operations/long_running.py +6 -6
  74. office365/onedrive/operations/rich_long_running.py +4 -3
  75. office365/onedrive/permissions/collection.py +1 -14
  76. office365/onedrive/sharepoint_settings.py +6 -6
  77. office365/onedrive/sites/sites_with_root.py +1 -3
  78. office365/onedrive/termstore/store.py +2 -4
  79. office365/onedrive/termstore/terms/collection.py +1 -2
  80. office365/onedrive/workbooks/comments/comment.py +7 -6
  81. office365/onedrive/workbooks/filter.py +9 -0
  82. office365/onedrive/workbooks/filter_criteria.py +5 -0
  83. office365/onedrive/workbooks/functions/functions.py +6 -3
  84. office365/onedrive/workbooks/functions/result.py +2 -0
  85. office365/onedrive/workbooks/operations/workbook.py +7 -10
  86. office365/onedrive/workbooks/tables/pivot_table.py +9 -9
  87. office365/onedrive/workbooks/worksheets/collection.py +0 -6
  88. office365/onedrive/workbooks/worksheets/protection.py +2 -0
  89. office365/onedrive/workbooks/worksheets/worksheet.py +30 -2
  90. office365/onenote/notebooks/collection.py +0 -1
  91. office365/outlook/calendar/events/event.py +24 -46
  92. office365/outlook/calendar/permissions/permission.py +7 -7
  93. office365/outlook/calendar/place.py +5 -3
  94. office365/outlook/mail/attachments/collection.py +6 -1
  95. office365/outlook/mail/attachments/file.py +9 -16
  96. office365/outlook/mail/messages/message.py +1 -1
  97. office365/planner/user.py +3 -7
  98. office365/reports/root.py +50 -4
  99. office365/runtime/auth/providers/acs_token_provider.py +10 -7
  100. office365/runtime/auth/sts_profile.py +0 -1
  101. office365/runtime/client_object.py +21 -17
  102. office365/runtime/client_object_collection.py +9 -24
  103. office365/runtime/client_request_exception.py +1 -3
  104. office365/runtime/client_result.py +11 -14
  105. office365/runtime/client_runtime_context.py +20 -32
  106. office365/runtime/odata/json_format.py +4 -7
  107. office365/runtime/odata/request.py +3 -3
  108. office365/runtime/odata/v3/batch_request.py +17 -31
  109. office365/runtime/odata/v4/batch_request.py +13 -21
  110. office365/runtime/queries/batch.py +5 -11
  111. office365/runtime/queries/function.py +5 -6
  112. office365/runtime/types/event_handler.py +1 -1
  113. office365/search/entity.py +3 -2
  114. office365/sharepoint/activities/facets/delete.py +1 -1
  115. office365/sharepoint/activities/tracked_item_service.py +2 -3
  116. office365/sharepoint/administration/web_application.py +8 -7
  117. office365/sharepoint/alerts/alert.py +8 -12
  118. office365/sharepoint/audit/audit.py +3 -2
  119. office365/sharepoint/changes/alert.py +4 -3
  120. office365/sharepoint/changes/collection.py +7 -10
  121. office365/sharepoint/changes/content_type.py +4 -4
  122. office365/sharepoint/changes/field.py +4 -5
  123. office365/sharepoint/changes/item.py +34 -7
  124. office365/sharepoint/changes/list.py +4 -4
  125. office365/sharepoint/changes/user.py +5 -6
  126. office365/sharepoint/client_context.py +20 -20
  127. office365/sharepoint/clientsidecomponent/component_context_info.py +4 -3
  128. office365/sharepoint/contentcenter/machinelearning/enabled.py +4 -3
  129. office365/sharepoint/contentcenter/machinelearning/hub.py +6 -6
  130. office365/sharepoint/contentcenter/machinelearning/models/collection.py +1 -1
  131. office365/sharepoint/contenttypes/fieldlinks/collection.py +4 -6
  132. office365/sharepoint/contenttypes/fieldlinks/field_link.py +14 -22
  133. office365/sharepoint/entity.py +12 -5
  134. office365/sharepoint/entity_collection.py +1 -3
  135. office365/sharepoint/eventreceivers/definition.py +8 -12
  136. office365/sharepoint/features/collection.py +3 -6
  137. office365/sharepoint/features/definitions/definition.py +6 -3
  138. office365/sharepoint/fields/calculated.py +8 -14
  139. office365/sharepoint/fields/collection.py +42 -10
  140. office365/sharepoint/fields/computed.py +4 -5
  141. office365/sharepoint/fields/currency.py +7 -11
  142. office365/sharepoint/fields/date_time.py +4 -8
  143. office365/sharepoint/fields/field.py +6 -16
  144. office365/sharepoint/fields/lookup.py +11 -9
  145. office365/sharepoint/fields/multi_choice.py +8 -12
  146. office365/sharepoint/fields/multi_line_text.py +10 -14
  147. office365/sharepoint/fields/number.py +13 -26
  148. office365/sharepoint/fields/rating_scale.py +6 -10
  149. office365/sharepoint/fields/related_field.py +10 -17
  150. office365/sharepoint/fields/url.py +4 -5
  151. office365/sharepoint/fields/user.py +10 -9
  152. office365/sharepoint/files/checked_out_file.py +4 -3
  153. office365/sharepoint/files/collection.py +17 -15
  154. office365/sharepoint/files/file.py +33 -27
  155. office365/sharepoint/folders/collection.py +22 -5
  156. office365/sharepoint/folders/coloring.py +11 -9
  157. office365/sharepoint/folders/coloring_information.py +38 -0
  158. office365/sharepoint/folders/folder.py +26 -30
  159. office365/sharepoint/likes/liked_by_information.py +7 -10
  160. office365/sharepoint/likes/user_entity.py +6 -8
  161. office365/sharepoint/listitems/form_update_value.py +17 -1
  162. office365/sharepoint/listitems/listitem.py +9 -11
  163. office365/sharepoint/lists/bloom_filter.py +5 -7
  164. office365/sharepoint/lists/creatables_info.py +5 -6
  165. office365/sharepoint/lists/list.py +25 -10
  166. office365/sharepoint/lists/template.py +7 -4
  167. office365/sharepoint/lists/template_collection.py +2 -4
  168. office365/sharepoint/marketplace/app_metadata.py +14 -23
  169. office365/sharepoint/marketplace/sitecollection/appcatalog/allowed_item.py +6 -8
  170. office365/sharepoint/navigation/node.py +5 -8
  171. office365/sharepoint/permissions/irm/effective_settings.py +6 -8
  172. office365/sharepoint/permissions/irm/file_settings.py +8 -6
  173. office365/sharepoint/permissions/irm/settings.py +25 -43
  174. office365/sharepoint/portal/groups/site_manager.py +6 -7
  175. office365/sharepoint/portal/sites/manager.py +4 -3
  176. office365/sharepoint/publishing/embed_data_v1.py +8 -15
  177. office365/sharepoint/publishing/pages/campaign_publication.py +4 -3
  178. office365/sharepoint/publishing/primary_city_time.py +8 -9
  179. office365/sharepoint/publishing/video/service_discoverer.py +4 -3
  180. office365/sharepoint/pushnotifications/subscriber.py +11 -15
  181. office365/sharepoint/sharing/object_sharing_settings.py +24 -46
  182. office365/sharepoint/sharing/permission_information.py +5 -5
  183. office365/sharepoint/sharing/result.py +1 -0
  184. office365/sharepoint/sitedesigns/run.py +4 -3
  185. office365/sharepoint/sites/site.py +7 -16
  186. office365/sharepoint/taxonomy/field.py +32 -21
  187. office365/sharepoint/taxonomy/groups/group.py +12 -1
  188. office365/sharepoint/taxonomy/sets/set.py +6 -0
  189. office365/sharepoint/taxonomy/stores/store.py +4 -2
  190. office365/sharepoint/teams/channel.py +6 -6
  191. office365/sharepoint/tenant/administration/endpoints.py +4 -3
  192. office365/sharepoint/tenant/administration/hubsites/properties.py +4 -5
  193. office365/sharepoint/tenant/administration/sites/properties.py +0 -1
  194. office365/sharepoint/tenant/administration/spo_operation.py +4 -4
  195. office365/sharepoint/tenant/administration/tenant.py +1 -0
  196. office365/sharepoint/tenant/insights/report.py +11 -0
  197. office365/sharepoint/tenant/insights/report_manager.py +5 -0
  198. office365/sharepoint/tenant/insights/report_metadata.py +5 -0
  199. office365/sharepoint/tenant/settings.py +4 -3
  200. office365/sharepoint/translation/sync_translator.py +3 -2
  201. office365/sharepoint/ui/applicationpages/peoplepicker/entity_information.py +4 -4
  202. office365/sharepoint/usercustomactions/action.py +12 -20
  203. office365/sharepoint/userprofiles/followed_content.py +6 -10
  204. office365/sharepoint/userprofiles/people_manager.py +0 -1
  205. office365/sharepoint/userprofiles/person_properties.py +14 -30
  206. office365/sharepoint/userprofiles/personal_cache.py +4 -3
  207. office365/sharepoint/userprofiles/properties_for_user.py +4 -5
  208. office365/sharepoint/userprofiles/sharedwithme/document.py +12 -21
  209. office365/sharepoint/utilities/move_copy_util.py +19 -19
  210. office365/sharepoint/utilities/upload_status.py +7 -10
  211. office365/sharepoint/views/field_collection.py +9 -14
  212. office365/sharepoint/views/view.py +43 -64
  213. office365/sharepoint/webhooks/subscription.py +11 -19
  214. office365/sharepoint/webparts/webpart.py +3 -1
  215. office365/sharepoint/webs/modernize_homepage_result.py +4 -3
  216. office365/sharepoint/webs/regional_settings.py +9 -17
  217. office365/sharepoint/webs/template.py +18 -18
  218. office365/sharepoint/webs/theme_info.py +6 -6
  219. office365/sharepoint/webs/web.py +16 -23
  220. office365/teams/members/aad_user_conversation.py +4 -4
  221. office365/teams/operations/async_operation.py +5 -7
  222. office365/runtime/paths/item.py +0 -8
  223. {Office365_REST_Python_Client-2.5.4.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/LICENSE +0 -0
  224. {Office365_REST_Python_Client-2.5.4.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/WHEEL +0 -0
  225. {Office365_REST_Python_Client-2.5.4.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,10 @@
1
+ import os
2
+
1
3
  from office365.runtime.paths.service_operation import ServiceOperationPath
2
4
  from office365.runtime.paths.v3.entity import EntityPath
3
5
  from office365.runtime.queries.service_operation import ServiceOperationQuery
4
6
  from office365.sharepoint.entity_collection import EntityCollection
7
+ from office365.sharepoint.folders.coloring_information import FolderColoringInformation
5
8
  from office365.sharepoint.folders.folder import Folder
6
9
  from office365.sharepoint.types.resource_path import ResourcePath as SPResPath
7
10
 
@@ -42,14 +45,28 @@ class FolderCollection(EntityCollection[Folder]):
42
45
  folder = folder.add(name)
43
46
  return folder
44
47
 
45
- def add(self, name):
48
+ def add(self, name, color_hex=None):
46
49
  """Adds the folder that is located at the specified URL to the collection.
47
- :param str name: Specifies the Name of the folder.
50
+ :param str name: Specifies the Name or Path of the folder.
51
+ :param str color_hex: Specifies the color of the folder.
48
52
  """
49
53
  return_type = Folder(self.context, EntityPath(name, self.resource_path))
50
- self.add_child(return_type)
51
- qry = ServiceOperationQuery(self, "Add", [name], None, None, return_type)
52
- self.context.add_query(qry)
54
+ if color_hex:
55
+
56
+ def _add_coloring():
57
+ path = os.path.join(
58
+ self.parent.properties.get("ServerRelativeUrl"), name
59
+ )
60
+ coloring_info = FolderColoringInformation(color_hex=color_hex)
61
+ self.context.folder_coloring.create_folder(
62
+ path, coloring_info, return_type=return_type
63
+ )
64
+
65
+ self.parent.ensure_property("ServerRelativeUrl", _add_coloring)
66
+ else:
67
+ self.add_child(return_type)
68
+ qry = ServiceOperationQuery(self, "Add", [name], None, None, return_type)
69
+ self.context.add_query(qry)
53
70
  return return_type
54
71
 
55
72
  def get_by_url(self, url):
@@ -1,6 +1,10 @@
1
+ from typing_extensions import Self
2
+
1
3
  from office365.runtime.queries.service_operation import ServiceOperationQuery
2
4
  from office365.sharepoint.entity import Entity
5
+ from office365.sharepoint.folders.coloring_information import FolderColoringInformation
3
6
  from office365.sharepoint.folders.folder import Folder
7
+ from office365.sharepoint.types.resource_path import ResourcePath as SPResPath
4
8
 
5
9
 
6
10
  class FolderColoring(Entity):
@@ -9,22 +13,19 @@ class FolderColoring(Entity):
9
13
  def create_folder(
10
14
  self,
11
15
  decoded_url,
12
- ensure_unique_file_name=True,
13
- overwrite=True,
14
- coloring_information=None,
16
+ coloring_information=FolderColoringInformation(color_hex="1"),
17
+ return_type=None,
15
18
  ):
16
19
  """
17
20
  :param str decoded_url:
18
- :param bool ensure_unique_file_name:
19
- :param bool overwrite:
20
21
  :param FolderColoringInformation coloring_information:
22
+ :param Folder return_type: Return type
21
23
  """
22
- return_type = Folder(self.context)
24
+ if return_type is None:
25
+ return_type = Folder(self.context)
23
26
 
24
27
  payload = {
25
- "DecodedUrl": decoded_url,
26
- "EnsureUniqueFileName": ensure_unique_file_name,
27
- "Overwrite": overwrite,
28
+ "path": SPResPath(decoded_url),
28
29
  "coloringInformation": coloring_information,
29
30
  }
30
31
  qry = ServiceOperationQuery(
@@ -34,6 +35,7 @@ class FolderColoring(Entity):
34
35
  return return_type
35
36
 
36
37
  def stamp_color(self, decoded_url, coloring_information):
38
+ # type: (str, FolderColoringInformation) -> Self
37
39
  """
38
40
  :param str decoded_url:
39
41
  :param FolderColoringInformation coloring_information:
@@ -1,6 +1,40 @@
1
1
  from office365.runtime.client_value import ClientValue
2
2
 
3
3
 
4
+ class FolderColors(object):
5
+ Yellow = "#FFCE3C"
6
+
7
+ Grey = "#B0B7BA"
8
+
9
+ DarkRed = "#E73E29"
10
+
11
+ LightRed = "#FFBCB2"
12
+
13
+ DarkOrange = "#EE7110"
14
+
15
+ LightOrange = "#FFBF84"
16
+
17
+ DarkGreen = "#3F9F4A"
18
+
19
+ LightGreen = "#8ED290"
20
+
21
+ DarkTeal = "#27938E"
22
+
23
+ LightTeal = "#7AD1CD"
24
+
25
+ DarkBlue = "#1E84D0"
26
+
27
+ LightBlue = "#86C8F7"
28
+
29
+ DarkPurple = "#9A61C7"
30
+
31
+ LightPurple = "#D4AFF6"
32
+
33
+ DarkPink = "#CC53B4"
34
+
35
+ LightPink = "#F7AAE7"
36
+
37
+
4
38
  class FolderColoringInformation(ClientValue):
5
39
  """"""
6
40
 
@@ -13,3 +47,7 @@ class FolderColoringInformation(ClientValue):
13
47
  self.ColorHex = color_hex
14
48
  self.ColorTag = color_tag
15
49
  self.Emoji = emoji
50
+
51
+ @property
52
+ def entity_type_name(self):
53
+ return "SP.FolderColoringInformation"
@@ -30,7 +30,7 @@ class Folder(Entity):
30
30
  """Represents a folder in a SharePoint Web site."""
31
31
 
32
32
  def __str__(self):
33
- return self.name
33
+ return self.name or self.entity_type_name
34
34
 
35
35
  def __repr__(self):
36
36
  return self.serverRelativeUrl or self.unique_id or self.entity_type_name
@@ -69,14 +69,14 @@ class Folder(Entity):
69
69
 
70
70
  return_type = FolderCollection(self.context, self.folders.resource_path, self)
71
71
 
72
- def _loaded(parent):
72
+ def _get_folders(parent):
73
73
  # type: ("Folder") -> None
74
74
  [return_type.add_child(f) for f in parent.folders]
75
75
  if recursive:
76
76
  for folder in parent.folders:
77
- folder.ensure_properties(["Folders"], _loaded, parent=folder)
77
+ folder.ensure_properties(["Folders"], _get_folders, parent=folder)
78
78
 
79
- self.ensure_properties(["Folders"], _loaded, parent=self)
79
+ self.ensure_properties(["Folders"], _get_folders, parent=self)
80
80
  return return_type
81
81
 
82
82
  def get_files(self, recursive=False):
@@ -88,16 +88,16 @@ class Folder(Entity):
88
88
 
89
89
  return_type = FileCollection(self.context, self.files.resource_path, self)
90
90
 
91
- def _loaded(parent):
91
+ def _get_files(parent):
92
92
  # type: ("Folder") -> None
93
93
  [return_type.add_child(f) for f in parent.files]
94
94
  if recursive:
95
95
  for folder in parent.folders:
96
96
  folder.ensure_properties(
97
- ["Files", "Folders"], _loaded, parent=folder
97
+ ["Files", "Folders"], _get_files, parent=folder
98
98
  )
99
99
 
100
- self.ensure_properties(["Files", "Folders"], _loaded, parent=self)
100
+ self.ensure_properties(["Files", "Folders"], _get_files, parent=self)
101
101
  return return_type
102
102
 
103
103
  def get_sharing_information(self):
@@ -115,18 +115,17 @@ class Folder(Entity):
115
115
  where to move a folder.
116
116
  """
117
117
 
118
- def _update_folder(url):
119
- self.set_property("ServerRelativeUrl", url)
120
-
121
118
  def _move_to(destination_folder):
122
119
  # type: ("Folder") -> None
123
120
  destination_url = "/".join(
124
121
  [destination_folder.serverRelativeUrl, self.name]
125
122
  )
126
123
  qry = ServiceOperationQuery(self, "MoveTo", {"newUrl": destination_url})
127
- self.context.add_query(qry).after_query_execute(
128
- _update_folder, destination_url
129
- )
124
+
125
+ def _update_folder(return_type):
126
+ self.set_property("ServerRelativeUrl", destination_url)
127
+
128
+ self.context.add_query(qry).after_query_execute(_update_folder)
130
129
 
131
130
  def _source_folder_resolved():
132
131
  if isinstance(destination, Folder):
@@ -146,21 +145,20 @@ class Folder(Entity):
146
145
  where to move a folder.
147
146
  """
148
147
 
149
- def _update_folder(url):
150
- self.set_property("ServerRelativePath", url)
151
-
152
148
  def _move_to_using_path(destination_folder):
153
149
  # type: ("Folder") -> None
154
- destination_url = "/".join(
150
+ destination_path = "/".join(
155
151
  [str(destination_folder.server_relative_path), self.name]
156
152
  )
157
153
  qry = ServiceOperationQuery(
158
- self, "MoveToUsingPath", {"DecodedUrl": destination_url}
159
- )
160
- self.context.add_query(qry).after_query_execute(
161
- _update_folder, destination_url
154
+ self, "MoveToUsingPath", {"DecodedUrl": destination_path}
162
155
  )
163
156
 
157
+ def _update_folder(url):
158
+ self.set_property("ServerRelativePath", destination_path)
159
+
160
+ self.context.add_query(qry).after_query_execute(_update_folder)
161
+
164
162
  def _source_folder_resolved():
165
163
  if isinstance(destination, Folder):
166
164
  destination.ensure_property(
@@ -380,7 +378,7 @@ class Folder(Entity):
380
378
  return_type = Folder(self.context)
381
379
  self.parent_collection.add_child(return_type)
382
380
 
383
- def _copy_folder(destination_folder):
381
+ def _copy_to(destination_folder):
384
382
  # type: ("Folder") -> None
385
383
  destination_url = "/".join(
386
384
  [destination_folder.serverRelativeUrl, self.name]
@@ -396,15 +394,11 @@ class Folder(Entity):
396
394
 
397
395
  def _source_folder_resolved():
398
396
  if isinstance(destination, Folder):
399
- destination.ensure_property(
400
- "ServerRelativeUrl", _copy_folder, destination
401
- )
397
+ destination.ensure_property("ServerRelativeUrl", _copy_to, destination)
402
398
  else:
403
- self.context.web.ensure_folder_path(destination).after_execute(
404
- _copy_folder
405
- )
399
+ self.context.web.ensure_folder_path(destination).after_execute(_copy_to)
406
400
 
407
- self.ensure_property("ServerRelativeUrl", _source_folder_resolved)
401
+ self.ensure_properties(["ServerRelativeUrl", "Name"], _source_folder_resolved)
408
402
  return return_type
409
403
 
410
404
  def copy_to_using_path(
@@ -491,7 +485,9 @@ class Folder(Entity):
491
485
 
492
486
  return self.properties.get(
493
487
  "Folders",
494
- FolderCollection(self.context, ResourcePath("Folders", self.resource_path)),
488
+ FolderCollection(
489
+ self.context, ResourcePath("Folders", self.resource_path), self
490
+ ),
495
491
  )
496
492
 
497
493
  @property
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.runtime.paths.resource_path import ResourcePath
2
4
  from office365.sharepoint.entity import Entity
3
5
  from office365.sharepoint.entity_collection import EntityCollection
@@ -9,24 +11,19 @@ class LikedByInformation(Entity):
9
11
 
10
12
  @property
11
13
  def like_count(self):
12
- """
13
- Number of users that have liked the item.
14
-
15
- :rtype: int or None
16
- """
14
+ # type: () -> Optional[int]
15
+ """Number of users that have liked the item."""
17
16
  return self.properties.get("LikeCount", None)
18
17
 
19
18
  @property
20
19
  def is_liked_by_user(self):
21
- """
22
- MUST be TRUE if the current user has liked the list item.
23
-
24
- :rtype: bool or None
25
- """
20
+ # type: () -> Optional[bool]
21
+ """MUST be TRUE if the current user has liked the list item."""
26
22
  return self.properties.get("isLikedByUser", None)
27
23
 
28
24
  @property
29
25
  def liked_by(self):
26
+ # type: () -> EntityCollection[UserEntity]
30
27
  """
31
28
  List of like entries corresponding to individual likes. MUST NOT contain more than one entry
32
29
  for the same user in the set.
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.sharepoint.entity import Entity
2
4
 
3
5
 
@@ -6,16 +8,12 @@ class UserEntity(Entity):
6
8
 
7
9
  @property
8
10
  def creation_date(self):
9
- """
10
- The Datetime of the like.
11
- """
11
+ # type: () -> Optional[str]
12
+ """The Datetime of the like."""
12
13
  return self.properties.get("creationDate", None)
13
14
 
14
15
  @property
15
16
  def email(self):
16
- """
17
- The email of the user who liked the item.
18
-
19
- :rtype: str
20
- """
17
+ # type: () -> Optional[str]
18
+ """The email of the user who liked the item."""
21
19
  return self.properties.get("email", None)
@@ -7,7 +7,14 @@ from office365.sharepoint.fields.lookup_value import FieldLookupValue
7
7
  class ListItemFormUpdateValue(ClientValue):
8
8
  """Specifies the properties of a list item field and its value."""
9
9
 
10
- def __init__(self, name=None, value=None, has_exception=None, error_code=None):
10
+ def __init__(
11
+ self,
12
+ name=None,
13
+ value=None,
14
+ has_exception=None,
15
+ error_code=None,
16
+ error_message=None,
17
+ ):
11
18
  """
12
19
  :param str name: Specifies the field internal name for a field.
13
20
  :param str value: Specifies a value for a field.
@@ -19,6 +26,15 @@ class ListItemFormUpdateValue(ClientValue):
19
26
  self.FieldValue = value
20
27
  self.HasException = has_exception
21
28
  self.ErrorCode = error_code
29
+ self.ErrorMessage = error_message
30
+
31
+ def __repr__(self):
32
+ if self.HasException:
33
+ return "{0} update failed: Message: {1}".format(
34
+ self.FieldName, self.ErrorMessage
35
+ )
36
+ else:
37
+ return "{0} update succeeded".format(self.FieldName)
22
38
 
23
39
  def to_json(self, json_format=None):
24
40
  json = super(ListItemFormUpdateValue, self).to_json(json_format)
@@ -210,14 +210,15 @@ class ListItem(SecurableObject):
210
210
  ExternalSharingSiteOption.Edit: "role:1073741827",
211
211
  }
212
212
 
213
- def _picker_value_resolved(resp, picker_result):
214
- file_abs_url = self.get_property("EncodedAbsUrl")
213
+ def _picker_value_resolved(picker_result):
214
+ # type: (ClientResult) -> None
215
+ abs_url = self.get_property("EncodedAbsUrl")
215
216
  picker_value = "[{0}]".format(picker_result.value)
216
217
  from office365.sharepoint.webs.web import Web
217
218
 
218
219
  Web.share_object(
219
220
  self.context,
220
- file_abs_url,
221
+ abs_url,
221
222
  picker_value,
222
223
  role_values[share_option],
223
224
  0,
@@ -229,15 +230,12 @@ class ListItem(SecurableObject):
229
230
  return_type=return_type,
230
231
  )
231
232
 
232
- def _property_resolved():
233
- picker_result = (
234
- ClientPeoplePickerWebServiceInterface.client_people_picker_resolve_user(
235
- self.context, user_principal_name
236
- )
237
- )
238
- self.context.after_execute(_picker_value_resolved, True, picker_result)
233
+ def _url_resolved():
234
+ ClientPeoplePickerWebServiceInterface.client_people_picker_resolve_user(
235
+ self.context, user_principal_name
236
+ ).after_execute(_picker_value_resolved)
239
237
 
240
- self.ensure_property("EncodedAbsUrl", _property_resolved)
238
+ self.ensure_property("EncodedAbsUrl", _url_resolved)
241
239
  return return_type
242
240
 
243
241
  def unshare(self):
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.runtime.client_value_collection import ClientValueCollection
2
4
  from office365.sharepoint.entity import Entity
3
5
 
@@ -7,15 +9,11 @@ class ListBloomFilter(Entity):
7
9
 
8
10
  @property
9
11
  def bloom_filter_size(self):
10
- """
11
- The length of the Bloom Filter
12
- :rtype: int or None
13
- """
12
+ # type: () -> Optional[int]
13
+ """The length of the Bloom Filter"""
14
14
  return self.properties.get("BloomFilterSize", None)
15
15
 
16
16
  @property
17
17
  def index_map(self):
18
- """
19
- Specifies a list of bloom indexes for item.
20
- """
18
+ """Specifies a list of bloom indexes for item."""
21
19
  return self.properties.get("IndexMap", ClientValueCollection(int))
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.sharepoint.entity import Entity
2
4
  from office365.sharepoint.lists.creatable_item_info import CreatableItemInfoCollection
3
5
 
@@ -14,30 +16,27 @@ class CreatablesInfo(Entity):
14
16
 
15
17
  @property
16
18
  def can_create_folders(self):
19
+ # type: () -> Optional[bool]
17
20
  """
18
21
  Indicates if the user is able to create folders in the current list. The user MUST have the appropriate
19
22
  permissions and the list MUST allow folder creation.
20
-
21
- :rtype: bool or None
22
23
  """
23
24
  return self.properties.get("CanCreateFolders", None)
24
25
 
25
26
  @property
26
27
  def can_create_items(self):
28
+ # type: () -> Optional[bool]
27
29
  """
28
30
  Indicates whether this list can create items (such as documents (Word/Excel/PowerPoint))
29
31
  using Microsoft Office Online.
30
-
31
- :rtype: bool or None
32
32
  """
33
33
  return self.properties.get("CanCreateItems", None)
34
34
 
35
35
  @property
36
36
  def can_upload_files(self):
37
+ # type: () -> Optional[bool]
37
38
  """
38
39
  Indicates whether the user is able to upload files to this list.
39
-
40
- :rtype: bool or None
41
40
  """
42
41
  return self.properties.get("CanUploadFiles", None)
43
42
 
@@ -1,6 +1,6 @@
1
1
  import os
2
2
  from datetime import datetime
3
- from typing import AnyStr, Optional
3
+ from typing import TYPE_CHECKING, AnyStr, Optional
4
4
 
5
5
  from office365.runtime.client_result import ClientResult
6
6
  from office365.runtime.client_value_collection import ClientValueCollection
@@ -59,6 +59,9 @@ from office365.sharepoint.views.collection import ViewCollection
59
59
  from office365.sharepoint.views.view import View
60
60
  from office365.sharepoint.webhooks.subscription_collection import SubscriptionCollection
61
61
 
62
+ if TYPE_CHECKING:
63
+ from office365.sharepoint.lists.collection import ListCollection
64
+
62
65
 
63
66
  class List(SecurableObject):
64
67
  """
@@ -74,6 +77,15 @@ class List(SecurableObject):
74
77
  def __repr__(self):
75
78
  return self.id or self.title or self.entity_type_name
76
79
 
80
+ def clear(self):
81
+ """Clears the list."""
82
+
83
+ def _clear(items):
84
+ [item.delete_object() for item in items]
85
+
86
+ self.items.get().after_execute(_clear, execute_first=True)
87
+ return self
88
+
77
89
  def create_document_and_get_edit_link(
78
90
  self,
79
91
  file_name=None,
@@ -301,7 +313,7 @@ class List(SecurableObject):
301
313
 
302
314
  def render_list_data(self, view_xml):
303
315
  """
304
- Returns the data for the specified query view.<56> The result is implementation-specific, used for
316
+ Returns the data for the specified query view. The result is implementation-specific, used for
305
317
  providing data to a user interface.
306
318
 
307
319
  :param str view_xml: Specifies the query as XML that conforms to the ViewDefinition type as specified in
@@ -610,10 +622,11 @@ class List(SecurableObject):
610
622
  )
611
623
 
612
624
  def get_changes(self, query=None):
625
+ # type: (ChangeQuery) -> ChangeCollection
613
626
  """Returns the collection of changes from the change log that have occurred within the list,
614
627
  based on the specified query.
615
628
 
616
- :param office365.sharepoint.changeQuery.ChangeQuery query: Specifies which changes to return
629
+ :param ChangeQuery query: Specifies which changes to return
617
630
  """
618
631
  if query is None:
619
632
  query = ChangeQuery(list_=True)
@@ -825,6 +838,12 @@ class List(SecurableObject):
825
838
  # type: () -> Optional[bool]
826
839
  return self.properties.get("DisableGridEditing", None)
827
840
 
841
+ @property
842
+ def document_template_url(self):
843
+ # type: () -> Optional[str]
844
+ """Specifies the URL of the document template assigned to the list."""
845
+ return self.properties.get("DocumentTemplateUrl", None)
846
+
828
847
  @property
829
848
  def effective_base_permissions(self):
830
849
  """
@@ -1294,17 +1313,13 @@ class List(SecurableObject):
1294
1313
 
1295
1314
  @property
1296
1315
  def validation_formula(self):
1297
- """
1298
- Specifies the data validation criteria for a list item.
1299
- :rtype: str or None
1300
- """
1316
+ # type: () -> Optional[str]
1317
+ """Specifies the data validation criteria for a list item."""
1301
1318
  return self.properties.get("ValidationFormula", None)
1302
1319
 
1303
1320
  @property
1304
1321
  def parent_collection(self):
1305
- """
1306
- :rtype: office365.sharepoint.lists.collection.ListCollection
1307
- """
1322
+ # type: () -> ListCollection
1308
1323
  return self._parent_collection
1309
1324
 
1310
1325
  def get_property(self, name, default_value=None):
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.runtime.client_result import ClientResult
2
4
  from office365.runtime.paths.service_operation import ServiceOperationPath
3
5
  from office365.runtime.queries.service_operation import ServiceOperationQuery
@@ -16,6 +18,9 @@ class ListTemplate(Entity):
16
18
  list template from the collection.
17
19
  """
18
20
 
21
+ def __repr__(self):
22
+ return self.internal_name or self.entity_type_name
23
+
19
24
  def get_global_schema_xml(self):
20
25
  """Retrieves the global schema.xml file."""
21
26
  return_type = ClientResult(self.context)
@@ -27,10 +32,8 @@ class ListTemplate(Entity):
27
32
 
28
33
  @property
29
34
  def internal_name(self):
30
- """Gets a value that specifies the identifier for the list template.
31
-
32
- :rtype: str or None
33
- """
35
+ # type: () -> Optional[str]
36
+ """Gets a value that specifies the identifier for the list template."""
34
37
  return self.properties.get("InternalName", None)
35
38
 
36
39
  def set_property(self, name, value, persist_changes=True):
@@ -3,7 +3,7 @@ from office365.sharepoint.entity_collection import EntityCollection
3
3
  from office365.sharepoint.lists.template import ListTemplate
4
4
 
5
5
 
6
- class ListTemplateCollection(EntityCollection):
6
+ class ListTemplateCollection(EntityCollection[ListTemplate]):
7
7
  """Specifies a collection of list templates"""
8
8
 
9
9
  def __init__(self, context, resource_path=None):
@@ -13,9 +13,7 @@ class ListTemplateCollection(EntityCollection):
13
13
  )
14
14
 
15
15
  def get_by_name(self, name):
16
- """
17
- Returns the list template with the specified name.
18
-
16
+ """Returns the list template with the specified name.
19
17
  :param str name: The specified name.
20
18
  """
21
19
  return ListTemplate(