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
@@ -69,7 +69,6 @@ class Field(Entity):
69
69
 
70
70
  :type context: office365.sharepoint.client_context.ClientContext
71
71
  :type field_parameters: office365.sharepoint.fields.creation_information.FieldCreationInformation
72
- :return: Field
73
72
  """
74
73
  field_type = Field.resolve_field_type(field_parameters.FieldTypeKind)
75
74
  field = field_type(context)
@@ -124,19 +123,14 @@ class Field(Entity):
124
123
 
125
124
  @property
126
125
  def id(self):
127
- """
128
- Gets a value that specifies the field identifier.
129
-
130
- :rtype: str or None
131
- """
126
+ # type: () -> Optional[str]
127
+ """Gets a value that specifies the field identifier."""
132
128
  return self.properties.get("Id", None)
133
129
 
134
130
  @property
135
131
  def auto_indexed(self):
136
- """
137
- Gets a Boolean value that specifies whether the field is auto-indexed.
138
- :rtype: str or None
139
- """
132
+ # type: () -> Optional[bool]
133
+ """Gets a Boolean value that specifies whether the field is auto-indexed."""
140
134
  return self.properties.get("AutoIndexed", None)
141
135
 
142
136
  @property
@@ -200,17 +194,13 @@ class Field(Entity):
200
194
  @property
201
195
  def internal_name(self):
202
196
  # type: () -> Optional[str]
203
- """
204
- Gets a value that specifies the field internal name.
205
- """
197
+ """Gets a value that specifies the field internal name."""
206
198
  return self.properties.get("InternalName", None)
207
199
 
208
200
  @property
209
201
  def can_be_deleted(self):
210
202
  # type: () -> Optional[bool]
211
- """
212
- Gets a value that specifies whether the field can be deleted
213
- """
203
+ """Gets a value that specifies whether the field can be deleted"""
214
204
  return self.properties.get("CanBeDeleted", None)
215
205
 
216
206
  @property
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.sharepoint.fields.field import Field
2
4
 
3
5
 
@@ -6,38 +8,38 @@ class FieldLookup(Field):
6
8
 
7
9
  @property
8
10
  def allow_multiple_values(self):
9
- """Gets a value that specifies whether the lookup field allows multiple values.
10
- :rtype: bool or None
11
- """
11
+ # type: () -> Optional[bool]
12
+ """Gets a value that specifies whether the lookup field allows multiple values."""
12
13
  return self.properties.get("AllowMultipleValues", None)
13
14
 
14
15
  @allow_multiple_values.setter
15
16
  def allow_multiple_values(self, value):
17
+ # type: (bool) -> None
16
18
  """Sets a value that specifies whether the lookup field allows multiple values."""
17
19
  self.set_property("AllowMultipleValues", value)
18
20
 
19
21
  @property
20
22
  def lookup_web_id(self):
21
- """Gets the ID of the Web site that contains the list that is the source of this field's value.
22
- :rtype: str or None
23
- """
23
+ # type: () -> Optional[str]
24
+ """Gets the ID of the Web site that contains the list that is the source of this field's value."""
24
25
  return self.properties.get("LookupWebId", None)
25
26
 
26
27
  @lookup_web_id.setter
27
28
  def lookup_web_id(self, val):
28
- """Sets the ID of the Web site that contains the list that is the source of this field's value.
29
- :rtype: str or None
30
- """
29
+ # type: (str) -> None
30
+ """Sets the ID of the Web site that contains the list that is the source of this field's value."""
31
31
  self.set_property("LookupWebId", val, True)
32
32
 
33
33
  @property
34
34
  def lookup_list(self):
35
+ # type: () -> Optional[str]
35
36
  """Gets value that specifies the list identifier of the list that contains the field to use as the lookup
36
37
  values."""
37
38
  return self.properties.get("LookupList", None)
38
39
 
39
40
  @lookup_list.setter
40
41
  def lookup_list(self, val):
42
+ # type: (str) -> None
41
43
  """Sets a value that specifies the list identifier of the list that contains the field to use as
42
44
  the lookup values."""
43
45
  self.set_property("LookupList", val, True)
@@ -1,32 +1,28 @@
1
+ from typing import Optional
2
+
1
3
  from office365.runtime.types.collections import StringCollection
2
4
  from office365.sharepoint.fields.field import Field
3
5
 
4
6
 
5
7
  class FieldMultiChoice(Field):
6
- """Specifies a field (2) that contains one or more values from a set of specified values."""
8
+ """Specifies a field that contains one or more values from a set of specified values."""
7
9
 
8
10
  @property
9
11
  def fill_in_choice(self):
12
+ # type: () -> Optional[bool]
10
13
  """
11
- Specifies whether the field (2) can accept values other than those specified in
14
+ Specifies whether the field can accept values other than those specified in
12
15
  Microsoft.Sharepoint.Client.FieldMultiChoice.Choices, as specified in section 3.2.5.51.1.1.2.
13
-
14
- :rtype: bool or None
15
16
  """
16
17
  return self.properties.get("FillInChoice", None)
17
18
 
18
19
  @property
19
20
  def mappings(self):
20
- """
21
- Specifies the internal values corresponding to Choices.
22
-
23
- :rtype: str or None
24
- """
21
+ # type: () -> Optional[str]
22
+ """Specifies the internal values corresponding to Choices."""
25
23
  return self.properties.get("Mappings", None)
26
24
 
27
25
  @property
28
26
  def choices(self):
29
- """
30
- Specifies values that are available for selection in the field
31
- """
27
+ """Specifies values that are available for selection in the field"""
32
28
  return self.properties.get("Choices", StringCollection())
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.sharepoint.fields.field import Field
2
4
 
3
5
 
@@ -8,30 +10,24 @@ class FieldMultiLineText(Field):
8
10
 
9
11
  @property
10
12
  def allow_hyperlink(self):
11
- """
12
- Gets a value that specifies whether a hyperlink is allowed as a value of the field.
13
- :rtype: bool or None
14
- """
13
+ # type: () -> Optional[bool]
14
+ """Gets a value that specifies whether a hyperlink is allowed as a value of the field."""
15
15
  return self.properties.get("AllowHyperlink", None)
16
16
 
17
17
  @allow_hyperlink.setter
18
18
  def allow_hyperlink(self, val):
19
- """
20
- Sets a value that specifies whether a hyperlink is allowed as a value of the field.
21
- """
19
+ # type: (bool) -> None
20
+ """Sets a value that specifies whether a hyperlink is allowed as a value of the field."""
22
21
  self.set_property("AllowHyperlink", val)
23
22
 
24
23
  @property
25
24
  def number_of_lines(self):
26
- """
27
- Gets the number of lines to display in the field.
28
- :return:
29
- """
25
+ # type: () -> Optional[int]
26
+ """Gets the number of lines to display in the field."""
30
27
  return self.properties.get("NumberOfLines", None)
31
28
 
32
29
  @number_of_lines.setter
33
30
  def number_of_lines(self, val):
34
- """
35
- Set the number of lines to display in the field.
36
- """
31
+ # type: (int) -> None
32
+ """Set the number of lines to display in the field."""
37
33
  self.set_property("NumberOfLines", val)
@@ -1,51 +1,38 @@
1
+ from typing import Optional
2
+
1
3
  from office365.sharepoint.fields.field import Field
2
4
 
3
5
 
4
6
  class FieldNumber(Field):
5
- """Specifies a field (2) that contains number values. To set properties, call the Update method
7
+ """Specifies a field that contains number values. To set properties, call the Update method
6
8
  (section 3.2.5.53.2.1.5)."""
7
9
 
8
10
  @property
9
11
  def display_format(self):
10
- """
11
- Gets the number of decimal places to be used when displaying the field.
12
-
13
- :rtype: int or None
14
- """
12
+ # type: () -> Optional[int]
13
+ """Gets the number of decimal places to be used when displaying the field."""
15
14
  return self.properties.get("DisplayFormat", None)
16
15
 
17
16
  @property
18
17
  def comma_separator(self):
19
- """
20
- Gets the separator used to format the value of the field.
21
-
22
- :rtype: str or None
23
- """
18
+ # type: () -> Optional[str]
19
+ """Gets the separator used to format the value of the field."""
24
20
  return self.properties.get("CommaSeparator", None)
25
21
 
26
22
  @comma_separator.setter
27
23
  def comma_separator(self, value):
28
- """
29
- Sets the separator used to format the value of the field.
30
-
31
- :type value: str
32
- """
24
+ # type: (str) -> None
25
+ """Sets the separator used to format the value of the field."""
33
26
  self.set_property("CommaSeparator", value)
34
27
 
35
28
  @property
36
29
  def show_as_percentage(self):
37
- """
38
- Gets a Boolean value that specifies whether to render the field as a percentage.
39
-
40
- :rtype: int or None
41
- """
30
+ # type: () -> Optional[bool]
31
+ """Gets a Boolean value that specifies whether to render the field as a percentage."""
42
32
  return self.properties.get("ShowAsPercentage", None)
43
33
 
44
34
  @show_as_percentage.setter
45
35
  def show_as_percentage(self, value):
46
- """
47
- Sets a Boolean value that specifies whether to render the field as a percentage.
48
-
49
- :type value: str
50
- """
36
+ # type: (bool) -> None
37
+ """Sets a Boolean value that specifies whether to render the field as a percentage."""
51
38
  self.set_property("ShowAsPercentage", value)
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.sharepoint.fields.multi_choice import FieldMultiChoice
2
4
 
3
5
 
@@ -7,11 +9,8 @@ class FieldRatingScale(FieldMultiChoice):
7
9
 
8
10
  @property
9
11
  def grid_start_number(self):
10
- """
11
- Gets the start number for the rating scale.
12
-
13
- :rtype: int or None
14
- """
12
+ # type: () -> Optional[int]
13
+ """Gets the start number for the rating scale."""
15
14
  return self.properties.get("GridStartNumber", None)
16
15
 
17
16
  @grid_start_number.setter
@@ -25,9 +24,6 @@ class FieldRatingScale(FieldMultiChoice):
25
24
 
26
25
  @property
27
26
  def range_count(self):
28
- """
29
- Specifies the number of options in the rating scale.
30
-
31
- :rtype: int or None
32
- """
27
+ # type: () -> Optional[int]
28
+ """Specifies the number of options in the rating scale."""
33
29
  return self.properties.get("RangeCount", None)
@@ -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
 
@@ -7,35 +9,26 @@ class RelatedField(Entity):
7
9
 
8
10
  @property
9
11
  def field_id(self):
10
- """
11
- Gets the field id of the corresponding Lookup Field.
12
- :rtype: str or None
13
- """
12
+ # type: () -> Optional[str]
13
+ """Gets the field id of the corresponding Lookup Field."""
14
14
  return self.properties.get("FieldId", None)
15
15
 
16
16
  @property
17
17
  def list_id(self):
18
- """
19
- Gets the ID of the List containing the corresponding Lookup Field.
20
- :rtype: str or None
21
- """
18
+ # type: () -> Optional[str]
19
+ """Gets the ID of the List containing the corresponding Lookup Field."""
22
20
  return self.properties.get("ListId", None)
23
21
 
24
22
  @property
25
23
  def web_id(self):
26
- """
27
- Gets the ID of the Web containing the corresponding Lookup Field.
28
- :rtype: str or None
29
- """
24
+ # type: () -> Optional[str]
25
+ """Gets the ID of the Web containing the corresponding Lookup Field."""
30
26
  return self.properties.get("WebId", None)
31
27
 
32
28
  @property
33
29
  def relationship_delete_behavior(self):
34
- """
35
- Gets delete behavior of the corresponding Lookup Field.
36
-
37
- :rtype: int or None
38
- """
30
+ # type: () -> Optional[int]
31
+ """Gets delete behavior of the corresponding Lookup Field."""
39
32
  return self.properties.get("RelationshipDeleteBehavior", None)
40
33
 
41
34
  @property
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.sharepoint.fields.field import Field
2
4
 
3
5
 
@@ -6,9 +8,6 @@ class FieldUrl(Field):
6
8
 
7
9
  @property
8
10
  def display_format(self):
9
- """
10
- Gets the number of decimal places to be used when displaying the field.
11
-
12
- :rtype: int or None
13
- """
11
+ # type: () -> Optional[int]
12
+ """Gets the number of decimal places to be used when displaying the field."""
14
13
  return self.properties.get("DisplayFormat", None)
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.sharepoint.fields.lookup import FieldLookup
2
4
 
3
5
 
@@ -6,41 +8,40 @@ class FieldUser(FieldLookup):
6
8
 
7
9
  @property
8
10
  def presence(self):
9
- """Gets a value that specifies whether presence is enabled on the field.
10
-
11
- :rtype: bool or None
12
- """
11
+ # type: () -> Optional[bool]
12
+ """Gets a value that specifies whether presence is enabled on the field."""
13
13
  return self.properties.get("Presence", None)
14
14
 
15
15
  @presence.setter
16
16
  def presence(self, val):
17
+ # type: (bool) -> None
17
18
  """Sets a value that specifies whether presence is enabled on the field."""
18
19
  self.properties.get("Presence", val)
19
20
 
20
21
  @property
21
22
  def allow_display(self):
22
- """Gets a value that specifies whether to display the name of the user in a survey list.
23
-
24
- :rtype: bool or None
25
- """
23
+ # type: () -> Optional[bool]
24
+ """Gets a value that specifies whether to display the name of the user in a survey list."""
26
25
  return self.properties.get("AllowDisplay", None)
27
26
 
28
27
  @allow_display.setter
29
28
  def allow_display(self, val):
29
+ # type: (bool) -> None
30
30
  """Sets a value that specifies whether to display the name of the user in a survey list."""
31
31
  self.properties.get("AllowDisplay", val)
32
32
 
33
33
  @property
34
34
  def selection_group(self):
35
+ # type: () -> Optional[int]
35
36
  """
36
37
  Gets a value that specifies the identifier of the SharePoint group whose members can be selected
37
38
  as values of the field.
38
- :rtype: int or None
39
39
  """
40
40
  return self.properties.get("SelectionGroup", None)
41
41
 
42
42
  @selection_group.setter
43
43
  def selection_group(self, val):
44
+ # type: (int) -> None
44
45
  """Sets a value that specifies the identifier of the SharePoint group whose members can be selected as
45
46
  values of the field.
46
47
  """
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.runtime.paths.resource_path import ResourcePath
2
4
  from office365.runtime.paths.v3.entity import EntityPath
3
5
  from office365.runtime.queries.service_operation import ServiceOperationQuery
@@ -16,9 +18,8 @@ class CheckedOutFile(Entity):
16
18
 
17
19
  @property
18
20
  def checked_out_by_id(self):
19
- """Returns the user ID of the account used to check out the file.
20
- :rtype: int or None
21
- """
21
+ # type: () -> Optional[int]
22
+ """Returns the user ID of the account used to check out the file."""
22
23
  return self.properties.get("CheckedOutById", None)
23
24
 
24
25
  @property
@@ -45,7 +45,7 @@ class FileCollection(EntityCollection[File]):
45
45
  def upload_with_checksum(self, file_object, chunk_size=1024):
46
46
  # type: (IO, int) -> File
47
47
  """ """
48
- h = hashlib.sha1() # hashlib.md5()
48
+ h = hashlib.md5()
49
49
  file_name = os.path.basename(file_object.name)
50
50
  upload_id = str(uuid.uuid4())
51
51
 
@@ -53,9 +53,10 @@ class FileCollection(EntityCollection[File]):
53
53
  # type: (File) -> None
54
54
  content = file_object.read(chunk_size)
55
55
  h.update(content)
56
+
56
57
  return_type.upload_with_checksum(
57
58
  upload_id, h.hexdigest(), content
58
- ).after_execute(_upload_session)
59
+ ) # .after_execute(_upload_session)
59
60
 
60
61
  return self.add(file_name, None, True).after_execute(_upload_session)
61
62
 
@@ -80,37 +81,38 @@ class FileCollection(EntityCollection[File]):
80
81
  file_name = file_name if file_name else os.path.basename(file.name)
81
82
  upload_id = str(uuid.uuid4())
82
83
 
83
- def _upload_session(return_type, return_file):
84
- # type: (File|ClientResult, File) -> None
85
- if return_file is None:
86
- return_file = return_type
84
+ def _upload(return_type):
85
+ # type: (File) -> None
86
+
87
+ def _after_uploaded(result):
88
+ # type: (ClientResult) -> None
89
+ _upload(return_type)
87
90
 
88
91
  uploaded_bytes = file.tell()
89
92
  if callable(chunk_uploaded):
90
93
  chunk_uploaded(uploaded_bytes, **kwargs)
91
94
 
95
+ content = file.read(chunk_size)
92
96
  if uploaded_bytes == file_size:
93
97
  if auto_close and not file.closed:
94
98
  file.close()
95
99
  return
96
100
 
97
- content = file.read(chunk_size)
98
-
99
101
  if uploaded_bytes == 0:
100
- return_file.start_upload(upload_id, content).after_execute(
101
- _upload_session, return_file
102
+ return_type.start_upload(upload_id, content).after_execute(
103
+ _after_uploaded
102
104
  )
103
105
  elif uploaded_bytes + len(content) < file_size:
104
- return_file.continue_upload(
106
+ return_type.continue_upload(
105
107
  upload_id, uploaded_bytes, content
106
- ).after_execute(_upload_session, return_file)
108
+ ).after_execute(_after_uploaded)
107
109
  else:
108
- return_file.finish_upload(
110
+ return_type.finish_upload(
109
111
  upload_id, uploaded_bytes, content
110
- ).after_execute(_upload_session, return_file)
112
+ ).after_execute(_upload)
111
113
 
112
114
  if file_size > chunk_size:
113
- return self.add(file_name, None, True).after_execute(_upload_session, None)
115
+ return self.add(file_name, None, True).after_execute(_upload)
114
116
  else:
115
117
  return self.add(file_name, file.read(), True)
116
118
 
@@ -59,10 +59,7 @@ class File(AbstractFile):
59
59
  or a file in a folder."""
60
60
 
61
61
  def __repr__(self):
62
- if self.server_relative_path:
63
- return repr(self.server_relative_path)
64
- else:
65
- return self.serverRelativeUrl or self.unique_id or self.entity_type_name
62
+ return self.serverRelativeUrl or self.unique_id or self.entity_type_name
66
63
 
67
64
  def __str__(self):
68
65
  return self.name or self.entity_type_name
@@ -132,6 +129,19 @@ class File(AbstractFile):
132
129
  self.context.add_query(qry)
133
130
  return return_type
134
131
 
132
+ def get_pre_authorized_access_url(self, expiration_hours):
133
+ # type: (int) -> ClientResult[str]
134
+ """Returns a link for downloading the file without authentication.
135
+ :param int expiration_hours: The number of hours until the link expires. If the maximum expiration time
136
+ defined in the web application is less than the specified expiration time, the maximum expiration time
137
+ takes precedence.
138
+ """
139
+ return_type = ClientResult(self.context, str())
140
+ params = {"expirationHours": expiration_hours}
141
+ qry = FunctionQuery(self, "GetPreAuthorizedAccessUrl", params, return_type)
142
+ self.context.add_query(qry)
143
+ return return_type
144
+
135
145
  def get_absolute_url(self):
136
146
  # type: () -> ClientResult[str]
137
147
  """Gets absolute url of a File"""
@@ -332,19 +342,18 @@ class File(AbstractFile):
332
342
  :param int flag: Specifies the kind of move operation.
333
343
  """
334
344
 
335
- def _update_file(return_type, new_file_url):
336
- return_type.set_property("ServerRelativeUrl", new_file_url)
337
-
338
345
  def _moveto(destination_folder):
339
- """
340
- :type destination_folder: Folder
341
- """
342
- file_path = "/".join([str(destination_folder.serverRelativeUrl), self.name])
346
+ # type: (Folder) -> None
347
+ file_url = "/".join([str(destination_folder.serverRelativeUrl), self.name])
343
348
 
344
- params = {"newurl": file_path, "flags": flag}
349
+ params = {"newurl": file_url, "flags": flag}
345
350
  qry = ServiceOperationQuery(self, "moveto", params)
346
351
  self.context.add_query(qry)
347
- self.context.after_query_execute(_update_file, self, file_path)
352
+
353
+ def _update_file(return_type):
354
+ self.set_property("ServerRelativeUrl", file_url)
355
+
356
+ self.context.after_query_execute(_update_file)
348
357
 
349
358
  def _source_file_resolved():
350
359
  if isinstance(destination, Folder):
@@ -366,10 +375,6 @@ class File(AbstractFile):
366
375
  :param int flag: Specifies the kind of move operation.
367
376
  """
368
377
 
369
- def _update_file(return_type, new_file_url):
370
- # type: (File, str) -> None
371
- return_type.set_property("ServerRelativePath", new_file_url)
372
-
373
378
  def _move_to_using_path(destination_folder):
374
379
  # type: (Folder) -> None
375
380
  file_path = "/".join(
@@ -377,9 +382,12 @@ class File(AbstractFile):
377
382
  )
378
383
  params = {"DecodedUrl": file_path, "moveOperations": flag}
379
384
  qry = ServiceOperationQuery(self, "MoveToUsingPath", params)
380
- self.context.add_query(qry).after_query_execute(
381
- _update_file, self, file_path
382
- )
385
+
386
+ def _update_file(return_type):
387
+ # type: (File) -> None
388
+ self.set_property("ServerRelativePath", file_path)
389
+
390
+ self.context.add_query(qry).after_query_execute(_update_file)
383
391
 
384
392
  def _source_file_resolved():
385
393
  if isinstance(destination, Folder):
@@ -493,6 +501,7 @@ class File(AbstractFile):
493
501
  return return_type
494
502
 
495
503
  def upload_with_checksum(self, upload_id, checksum, stream):
504
+ # type: (str, str, bytes) -> File
496
505
  """
497
506
  :param str upload_id: The upload session ID.
498
507
  :param str checksum:
@@ -665,8 +674,6 @@ class File(AbstractFile):
665
674
  request.stream = True
666
675
  request.method = HttpMethod.Get
667
676
 
668
- self.context.before_execute(_construct_request)
669
-
670
677
  def _process_response(response):
671
678
  # type: (requests.Response) -> None
672
679
  response.raise_for_status()
@@ -677,8 +684,9 @@ class File(AbstractFile):
677
684
  chunk_downloaded(bytes_read)
678
685
  file_object.write(chunk)
679
686
 
680
- self.context.after_execute(_process_response)
681
- self.context.add_query(qry)
687
+ self.context.add_query(qry).before_execute(
688
+ _construct_request
689
+ ).after_execute(_process_response)
682
690
 
683
691
  if use_path:
684
692
  self.ensure_property("ServerRelativePath", _download_as_stream)
@@ -925,9 +933,7 @@ class File(AbstractFile):
925
933
 
926
934
  @property
927
935
  def parent_folder(self):
928
- """
929
- :rtype: office365.sharepoint.folders.folder.Folder
930
- """
936
+ # type: () -> Optional[Folder]
931
937
  if self.parent_collection is None:
932
938
  return None
933
939
  return self.parent_collection.parent