Office365-REST-Python-Client 2.5.1__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.
- {Office365_REST_Python_Client-2.5.1.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/METADATA +6 -6
- {Office365_REST_Python_Client-2.5.1.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/RECORD +265 -259
- office365/base_item.py +12 -20
- office365/communications/onlinemeetings/collection.py +1 -1
- office365/communications/onlinemeetings/online_meeting.py +20 -35
- office365/communications/presences/presence.py +18 -7
- office365/delta_collection.py +10 -1
- office365/delta_path.py +1 -1
- office365/directory/administrative_unit.py +6 -7
- office365/directory/applications/application.py +24 -18
- office365/directory/applications/roles/assignment.py +13 -1
- office365/directory/applications/roles/collection.py +13 -0
- office365/directory/applications/roles/role.py +6 -1
- office365/directory/audit/directory.py +8 -7
- office365/directory/audit/log_root.py +3 -0
- office365/directory/audit/signins/signin.py +19 -29
- office365/directory/authentication/authentication.py +1 -0
- office365/directory/authentication/methods/details.py +8 -6
- office365/directory/authentication/methods/phone.py +3 -1
- office365/directory/extensions/extension_property.py +7 -9
- office365/directory/groups/collection.py +10 -3
- office365/directory/groups/group.py +19 -19
- office365/directory/groups/lifecycle_policy.py +8 -7
- office365/directory/identities/provider.py +5 -6
- office365/directory/insights/usage_details.py +8 -3
- office365/directory/internal/paths/me.py +1 -1
- office365/directory/invitations/collection.py +1 -1
- office365/directory/invitations/invitation.py +6 -6
- office365/directory/object_collection.py +2 -3
- office365/directory/permissions/email_identity.py +7 -0
- office365/directory/permissions/grants/resource_specific.py +10 -9
- office365/directory/permissions/identity.py +3 -0
- office365/directory/permissions/identity_set.py +3 -0
- office365/directory/policies/base.py +4 -4
- office365/directory/policies/root.py +6 -4
- office365/directory/protection/information.py +3 -3
- office365/directory/rolemanagement/application.py +2 -0
- office365/directory/rolemanagement/role.py +11 -10
- office365/directory/rolemanagement/template.py +9 -8
- office365/directory/rolemanagement/unified_role_assignment.py +5 -4
- office365/directory/rolemanagement/unified_role_definition.py +6 -4
- office365/directory/security/security.py +3 -0
- office365/directory/serviceprincipals/collection.py +20 -4
- office365/directory/serviceprincipals/service_principal.py +79 -12
- office365/directory/users/activities/activity.py +5 -4
- office365/directory/users/user.py +29 -34
- office365/entity.py +2 -2
- office365/entity_collection.py +12 -5
- office365/graph_client.py +90 -8
- office365/intune/audit/event.py +4 -3
- office365/intune/devices/enrollment/configuration.py +6 -4
- office365/intune/devices/managed.py +9 -12
- office365/onedrive/analytics/item_activity_stat.py +4 -3
- office365/onedrive/columns/column_link.py +4 -4
- office365/onedrive/columns/definition.py +29 -32
- office365/onedrive/columns/definition_collection.py +1 -1
- office365/onedrive/contenttypes/content_type.py +16 -18
- office365/onedrive/documentsets/version.py +7 -3
- office365/onedrive/driveitems/driveItem.py +48 -49
- office365/onedrive/drives/drive.py +7 -2
- office365/onedrive/internal/paths/children.py +2 -2
- office365/onedrive/internal/paths/root.py +1 -1
- office365/onedrive/internal/paths/shared.py +1 -1
- office365/onedrive/internal/paths/site.py +3 -3
- office365/onedrive/internal/paths/url.py +2 -2
- office365/onedrive/listitems/list_item.py +2 -0
- office365/onedrive/lists/list.py +7 -4
- office365/onedrive/permissions/collection.py +28 -7
- office365/onedrive/permissions/permission.py +5 -7
- office365/onedrive/permissions/sharing_link.py +1 -1
- office365/onedrive/sharepoint.py +1 -0
- office365/onedrive/shares/collection.py +2 -5
- office365/onedrive/shares/drive_item.py +4 -0
- office365/onedrive/sites/site.py +6 -0
- office365/onedrive/termstore/groups/collection.py +3 -8
- office365/onedrive/termstore/groups/group.py +8 -0
- office365/onedrive/termstore/sets/collection.py +2 -6
- office365/onedrive/termstore/sets/name.py +5 -0
- office365/onedrive/termstore/sets/set.py +7 -0
- office365/onedrive/termstore/store.py +10 -13
- office365/onedrive/versions/drive_item.py +3 -1
- office365/onedrive/workbooks/ranges/range.py +9 -13
- office365/onedrive/workbooks/ranges/view.py +1 -0
- office365/onedrive/workbooks/tables/rows/row.py +3 -0
- office365/onedrive/workbooks/tables/table.py +7 -4
- office365/onedrive/workbooks/worksheets/worksheet.py +12 -4
- office365/onenote/entity_hierarchy_model.py +4 -0
- office365/onenote/internal/multipart_page_query.py +4 -5
- office365/onenote/notebooks/notebook.py +4 -0
- office365/onenote/pages/collection.py +3 -2
- office365/onenote/resources/resource.py +5 -4
- office365/onenote/sectiongroups/section_group.py +10 -7
- office365/onenote/sections/section.py +1 -1
- office365/outlook/calendar/attendees/base.py +2 -1
- office365/outlook/calendar/calendar.py +18 -10
- office365/outlook/calendar/events/collection.py +0 -2
- office365/outlook/calendar/group.py +7 -8
- office365/outlook/calendar/meetingtimes/suggestion.py +8 -4
- office365/outlook/calendar/meetingtimes/time_slot.py +3 -0
- office365/outlook/calendar/permissions/collection.py +1 -1
- office365/outlook/calendar/rooms/__init__.py +0 -0
- office365/outlook/calendar/rooms/list.py +27 -0
- office365/outlook/calendar/rooms/room.py +8 -0
- office365/outlook/calendar/schedule/information.py +0 -1
- office365/outlook/contacts/collection.py +0 -8
- office365/outlook/contacts/contact.py +14 -14
- office365/outlook/contacts/folder.py +3 -0
- office365/outlook/mail/attachments/attachment.py +31 -31
- office365/outlook/mail/attachments/collection.py +34 -6
- office365/outlook/mail/conversation.py +6 -4
- office365/outlook/mail/folders/collection.py +0 -7
- office365/outlook/mail/folders/folder.py +50 -18
- office365/outlook/mail/messages/collection.py +0 -1
- office365/outlook/mail/messages/message.py +58 -68
- office365/outlook/mail/physical_address.py +11 -5
- office365/outlook/mail/recipient.py +3 -1
- office365/outlook/mail/recurrence_range.py +14 -6
- office365/outlook/user.py +1 -0
- office365/planner/planner.py +9 -12
- office365/planner/plans/collection.py +17 -18
- office365/planner/plans/container.py +11 -0
- office365/planner/plans/plan.py +21 -10
- office365/runtime/auth/authentication_context.py +3 -3
- office365/runtime/auth/providers/acs_token_provider.py +7 -9
- office365/runtime/auth/providers/saml_token_provider.py +5 -2
- office365/runtime/client_object.py +6 -15
- office365/runtime/client_object_collection.py +36 -35
- office365/runtime/client_result.py +6 -7
- office365/runtime/client_runtime_context.py +10 -16
- office365/runtime/client_value_collection.py +3 -10
- office365/runtime/compat.py +2 -0
- office365/runtime/odata/query_options.py +1 -3
- office365/runtime/odata/reader.py +1 -1
- office365/runtime/odata/request.py +2 -4
- office365/runtime/odata/type.py +17 -0
- office365/runtime/odata/v4/upload_session_request.py +27 -30
- office365/runtime/paths/appid.py +1 -1
- office365/runtime/{odata/url_builder.py → paths/builder.py} +24 -9
- office365/runtime/paths/item.py +3 -1
- office365/runtime/paths/resource_path.py +12 -16
- office365/runtime/paths/service_operation.py +8 -7
- office365/runtime/paths/v3/__init__.py +0 -0
- office365/runtime/paths/{key.py → v3/entity.py} +5 -5
- office365/runtime/paths/v4/__init__.py +0 -0
- office365/runtime/paths/{entity.py → v4/entity.py} +13 -11
- office365/runtime/queries/function.py +1 -1
- office365/runtime/types/event_handler.py +1 -3
- office365/search/entity.py +15 -8
- office365/search/external/external.py +1 -0
- office365/search/sort_property.py +3 -0
- office365/sharepoint/attachments/attachment.py +3 -1
- office365/sharepoint/attachments/collection.py +3 -0
- office365/sharepoint/changes/change.py +12 -1
- office365/sharepoint/changes/collection.py +1 -1
- office365/sharepoint/changes/list.py +3 -0
- office365/sharepoint/changes/token.py +4 -0
- office365/sharepoint/changes/type.py +23 -23
- office365/sharepoint/changes/web.py +7 -3
- office365/sharepoint/client_context.py +21 -18
- office365/sharepoint/clientsidecomponent/hostedapps/manager.py +3 -3
- office365/sharepoint/contenttypes/content_type.py +47 -56
- office365/sharepoint/contenttypes/content_type_id.py +1 -1
- office365/sharepoint/documentmanagement/document_id.py +2 -2
- office365/sharepoint/documentmanagement/document_set.py +6 -7
- office365/sharepoint/entity_collection.py +9 -0
- office365/sharepoint/features/feature.py +6 -8
- office365/sharepoint/fields/collection.py +6 -5
- office365/sharepoint/fields/field.py +28 -46
- office365/sharepoint/fields/related_field_collection.py +1 -1
- office365/sharepoint/fields/user_value.py +3 -3
- office365/sharepoint/files/checked_out_file.py +4 -2
- office365/sharepoint/files/checked_out_file_collection.py +1 -1
- office365/sharepoint/files/collection.py +84 -14
- office365/sharepoint/files/file.py +118 -110
- office365/sharepoint/files/versions/collection.py +5 -3
- office365/sharepoint/files/versions/event.py +6 -3
- office365/sharepoint/files/versions/version.py +31 -18
- office365/sharepoint/folders/collection.py +5 -10
- office365/sharepoint/folders/folder.py +41 -24
- office365/sharepoint/forms/collection.py +1 -1
- office365/sharepoint/forms/form.py +4 -4
- office365/sharepoint/internal/paths/static_operation.py +9 -0
- office365/sharepoint/internal/paths/web.py +20 -0
- office365/sharepoint/listitems/collection.py +4 -0
- office365/sharepoint/listitems/listitem.py +37 -38
- office365/sharepoint/listitems/versions/collection.py +1 -1
- office365/sharepoint/listitems/versions/version.py +18 -11
- office365/sharepoint/lists/collection.py +1 -2
- office365/sharepoint/lists/list.py +106 -153
- office365/sharepoint/marketplace/app_metadata_collection.py +3 -1
- office365/sharepoint/navigation/node.py +16 -15
- office365/sharepoint/navigation/node_collection.py +9 -3
- office365/sharepoint/permissions/base_permissions.py +11 -6
- office365/sharepoint/permissions/roles/assignments/collection.py +8 -12
- office365/sharepoint/permissions/roles/definitions/definition.py +3 -1
- office365/sharepoint/permissions/securable_object.py +38 -31
- office365/sharepoint/portal/groups/service.py +12 -16
- office365/sharepoint/portal/groups/site_manager.py +0 -1
- office365/sharepoint/principal/groups/group.py +24 -30
- office365/sharepoint/principal/principal.py +21 -19
- office365/sharepoint/principal/users/collection.py +5 -0
- office365/sharepoint/principal/users/user.py +20 -26
- office365/sharepoint/publishing/pages/collection.py +1 -4
- office365/sharepoint/publishing/pages/metadata.py +38 -51
- office365/sharepoint/publishing/pages/metadata_collection.py +5 -2
- office365/sharepoint/publishing/pages/page.py +12 -21
- office365/sharepoint/publishing/pages/reposts/repost.py +5 -9
- office365/sharepoint/publishing/pages/service.py +36 -49
- office365/sharepoint/pushnotifications/collection.py +3 -1
- office365/sharepoint/recyclebin/item.py +11 -9
- office365/sharepoint/recyclebin/item_collection.py +1 -1
- office365/sharepoint/search/service.py +8 -6
- office365/sharepoint/sharing/links/info.py +5 -2
- office365/sharepoint/sharing/links/share_response.py +3 -0
- office365/sharepoint/sharing/links/share_settings.py +3 -0
- office365/sharepoint/sharing/object_sharing_information.py +25 -19
- office365/sharepoint/sharing/object_sharing_information_user.py +10 -19
- office365/sharepoint/sharing/result.py +18 -41
- office365/sharepoint/sharing/role.py +20 -0
- office365/sharepoint/sharing/role_type.py +1 -0
- office365/sharepoint/sharing/user_sharing_result.py +12 -0
- office365/sharepoint/sites/language.py +6 -0
- office365/sharepoint/sites/language_collection.py +3 -0
- office365/sharepoint/sites/site.py +65 -86
- office365/sharepoint/storagemetrics/storage_metrics.py +5 -6
- office365/sharepoint/taxonomy/item.py +11 -10
- office365/sharepoint/taxonomy/stores/store.py +8 -8
- office365/sharepoint/taxonomy/terms/label.py +3 -0
- office365/sharepoint/taxonomy/terms/term.py +31 -0
- office365/sharepoint/tenant/administration/collaboration/insights_overview.py +10 -0
- office365/sharepoint/tenant/administration/hubsites/collection.py +1 -2
- office365/sharepoint/tenant/administration/hubsites/hub_site.py +20 -24
- office365/sharepoint/tenant/administration/internal/permission_grant.py +7 -0
- office365/sharepoint/tenant/administration/sites/properties.py +55 -44
- office365/sharepoint/tenant/administration/tenant.py +69 -69
- office365/sharepoint/types/resource_path.py +2 -2
- office365/sharepoint/ui/applicationpages/peoplepicker/query_parameters.py +1 -1
- office365/sharepoint/usercustomactions/collection.py +1 -2
- office365/sharepoint/userprofiles/my_site_links.py +4 -4
- office365/sharepoint/userprofiles/people_manager.py +1 -3
- office365/sharepoint/userprofiles/user_profile.py +9 -11
- office365/sharepoint/utilities/principal_info.py +12 -0
- office365/sharepoint/viva/employee_engagement.py +1 -1
- office365/sharepoint/webparts/definition_collection.py +1 -1
- office365/sharepoint/webs/collection.py +8 -0
- office365/sharepoint/webs/template_collection.py +3 -5
- office365/sharepoint/webs/web.py +75 -95
- office365/subscriptions/collection.py +1 -1
- office365/subscriptions/subscription.py +13 -11
- office365/teams/apps/app.py +1 -0
- office365/teams/channels/channel.py +1 -3
- office365/teams/collection.py +12 -16
- office365/teams/info.py +7 -4
- office365/teams/members/conversation_collection.py +1 -3
- office365/teams/operations/async_operation.py +3 -5
- office365/teams/schedule/groups/group.py +3 -0
- office365/teams/team.py +18 -20
- office365/todo/attachments/base.py +7 -9
- office365/todo/linked_resource.py +6 -6
- office365/todo/tasks/list.py +1 -0
- office365/todo/tasks/task.py +3 -0
- office365/onedrive/internal/queries/resumable_file_upload.py +0 -36
- office365/outlook/internal/queries/attachment_upload.py +0 -53
- office365/runtime/odata/path_builder.py +0 -23
- office365/sharepoint/internal/key_value.py +0 -28
- office365/sharepoint/internal/queries/create_file.py +0 -20
- office365/sharepoint/internal/queries/upload_session.py +0 -103
- {Office365_REST_Python_Client-2.5.1.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/LICENSE +0 -0
- {Office365_REST_Python_Client-2.5.1.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/WHEEL +0 -0
- {Office365_REST_Python_Client-2.5.1.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/top_level.txt +0 -0
- /office365/planner/plans/{plan_details.py → details.py} +0 -0
|
@@ -14,6 +14,9 @@ class Field(Entity):
|
|
|
14
14
|
def __init__(self, context, resource_path=None):
|
|
15
15
|
super(Field, self).__init__(context, resource_path)
|
|
16
16
|
|
|
17
|
+
def __repr__(self):
|
|
18
|
+
return self.internal_name or self.id
|
|
19
|
+
|
|
17
20
|
@staticmethod
|
|
18
21
|
def resolve_field_type(type_id_or_name):
|
|
19
22
|
from office365.sharepoint.fields.calculated import FieldCalculated
|
|
@@ -138,9 +141,7 @@ class Field(Entity):
|
|
|
138
141
|
|
|
139
142
|
@property
|
|
140
143
|
def default_formula(self):
|
|
141
|
-
|
|
142
|
-
:rtype: str or None
|
|
143
|
-
"""
|
|
144
|
+
# type: () -> Optional[str]
|
|
144
145
|
return self.properties.get("DefaultFormula", None)
|
|
145
146
|
|
|
146
147
|
@property
|
|
@@ -155,9 +156,9 @@ class Field(Entity):
|
|
|
155
156
|
|
|
156
157
|
@property
|
|
157
158
|
def schema_xml(self):
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
# type: () -> Optional[str]
|
|
160
|
+
"""
|
|
161
|
+
Gets a value that specifies the XML schema that defines the field.
|
|
161
162
|
"""
|
|
162
163
|
return self.properties.get("SchemaXml", None)
|
|
163
164
|
|
|
@@ -168,41 +169,32 @@ class Field(Entity):
|
|
|
168
169
|
|
|
169
170
|
@property
|
|
170
171
|
def type_as_string(self):
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
:rtype: str or None
|
|
174
|
-
"""
|
|
172
|
+
# type: () -> Optional[str]
|
|
173
|
+
"""Gets a value that specifies the type of the field"""
|
|
175
174
|
return self.properties.get("TypeAsString", None)
|
|
176
175
|
|
|
177
176
|
@property
|
|
178
177
|
def title(self):
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
:rtype: str or None
|
|
182
|
-
"""
|
|
178
|
+
# type: () -> Optional[str]
|
|
179
|
+
"""Gets a value that specifies the display name of the field."""
|
|
183
180
|
return self.properties.get("Title", None)
|
|
184
181
|
|
|
185
182
|
@title.setter
|
|
186
183
|
def title(self, val):
|
|
187
184
|
"""
|
|
188
185
|
Sets a value that specifies the display name of the field.
|
|
189
|
-
:rtype: str or None
|
|
190
186
|
"""
|
|
191
187
|
self.set_property("Title", val)
|
|
192
188
|
|
|
193
189
|
@property
|
|
194
190
|
def group(self):
|
|
195
|
-
|
|
196
|
-
Gets a value that specifies the field group
|
|
197
|
-
:rtype: str or None
|
|
198
|
-
"""
|
|
191
|
+
# type: () -> Optional[str]
|
|
192
|
+
"""Gets a value that specifies the field group"""
|
|
199
193
|
return self.properties.get("Group", None)
|
|
200
194
|
|
|
201
195
|
@group.setter
|
|
202
196
|
def group(self, val):
|
|
203
|
-
"""Sets a value that specifies the field group.
|
|
204
|
-
:rtype: str or None
|
|
205
|
-
"""
|
|
197
|
+
"""Sets a value that specifies the field group."""
|
|
206
198
|
self.set_property("Group", val)
|
|
207
199
|
|
|
208
200
|
@property
|
|
@@ -215,71 +207,65 @@ class Field(Entity):
|
|
|
215
207
|
|
|
216
208
|
@property
|
|
217
209
|
def can_be_deleted(self):
|
|
210
|
+
# type: () -> Optional[bool]
|
|
218
211
|
"""
|
|
219
212
|
Gets a value that specifies whether the field can be deleted
|
|
220
|
-
:rtype: bool or None
|
|
221
213
|
"""
|
|
222
214
|
return self.properties.get("CanBeDeleted", None)
|
|
223
215
|
|
|
224
216
|
@property
|
|
225
217
|
def client_side_component_id(self):
|
|
226
|
-
|
|
227
|
-
:rtype: str or None
|
|
228
|
-
"""
|
|
218
|
+
# type: () -> Optional[str]
|
|
229
219
|
return self.properties.get("ClientSideComponentId", None)
|
|
230
220
|
|
|
231
221
|
@property
|
|
232
222
|
def client_side_component_properties(self):
|
|
233
|
-
|
|
234
|
-
:rtype: str or None
|
|
235
|
-
"""
|
|
223
|
+
# type: () -> Optional[str]
|
|
236
224
|
return self.properties.get("ClientSideComponentProperties", None)
|
|
237
225
|
|
|
238
226
|
@property
|
|
239
227
|
def client_validation_formula(self):
|
|
240
|
-
|
|
241
|
-
:rtype: str or None
|
|
242
|
-
"""
|
|
228
|
+
# type: () -> Optional[str]
|
|
243
229
|
return self.properties.get("ClientValidationFormula", None)
|
|
244
230
|
|
|
245
231
|
@property
|
|
246
232
|
def enforce_unique_values(self):
|
|
233
|
+
# type: () -> Optional[bool]
|
|
247
234
|
"""
|
|
248
235
|
Specifies whether the field enforces unique values.
|
|
249
|
-
:rtype: bool or None
|
|
250
236
|
"""
|
|
251
237
|
return self.properties.get("enforceUniqueValues", None)
|
|
252
238
|
|
|
253
239
|
@property
|
|
254
240
|
def filterable(self):
|
|
241
|
+
# type: () -> Optional[bool]
|
|
255
242
|
"""
|
|
256
243
|
Specifies whether list items in the list can be filtered by the field value.
|
|
257
|
-
:rtype: bool or None
|
|
258
244
|
"""
|
|
259
245
|
return self.properties.get("Filterable", None)
|
|
260
246
|
|
|
261
247
|
@property
|
|
262
248
|
def from_base_type(self):
|
|
249
|
+
# type: () -> Optional[bool]
|
|
263
250
|
"""
|
|
264
251
|
Gets a Boolean value that indicates whether the field derives from a base field type.
|
|
265
|
-
:rtype: bool or None
|
|
266
252
|
"""
|
|
267
253
|
return self.properties.get("FromBaseType", None)
|
|
268
254
|
|
|
269
255
|
@property
|
|
270
256
|
def js_link(self):
|
|
257
|
+
# type: () -> Optional[str]
|
|
271
258
|
"""
|
|
272
259
|
When implemented in a derived class, gets or sets the name of an external JavaScript file that contains
|
|
273
260
|
any client rendering logic for fields of the derived type.
|
|
274
|
-
:rtype: str or None
|
|
275
261
|
"""
|
|
276
262
|
return self.properties.get("JSLink", None)
|
|
277
263
|
|
|
278
264
|
@property
|
|
279
265
|
def hidden(self):
|
|
266
|
+
# type: () -> Optional[bool]
|
|
280
267
|
"""
|
|
281
268
|
Gets a value that specifies whether the field is hidden in list views and list forms.
|
|
282
|
-
:rtype: bool or None
|
|
283
269
|
"""
|
|
284
270
|
return self.properties.get("Hidden", None)
|
|
285
271
|
|
|
@@ -292,25 +278,25 @@ class Field(Entity):
|
|
|
292
278
|
|
|
293
279
|
@property
|
|
294
280
|
def no_crawl(self):
|
|
281
|
+
# type: () -> Optional[bool]
|
|
295
282
|
"""
|
|
296
283
|
Gets value that specifies whether the field can be crawled by a search engine.
|
|
297
|
-
:rtype: bool or None
|
|
298
284
|
"""
|
|
299
285
|
return self.properties.get("NoCrawl", None)
|
|
300
286
|
|
|
301
287
|
@property
|
|
302
288
|
def read_only_field(self):
|
|
289
|
+
# type: () -> Optional[bool]
|
|
303
290
|
"""
|
|
304
291
|
Specifies whether the value of the field is read-only.
|
|
305
|
-
:rtype: bool or None
|
|
306
292
|
"""
|
|
307
293
|
return self.properties.get("ReadOnlyField", None)
|
|
308
294
|
|
|
309
295
|
@property
|
|
310
296
|
def default_value(self):
|
|
297
|
+
# type: () -> Optional[str]
|
|
311
298
|
"""
|
|
312
299
|
Gets a value that specifies the default value for the field.
|
|
313
|
-
:rtype: str or None
|
|
314
300
|
"""
|
|
315
301
|
return self.properties.get("DefaultValue", None)
|
|
316
302
|
|
|
@@ -323,16 +309,13 @@ class Field(Entity):
|
|
|
323
309
|
|
|
324
310
|
@property
|
|
325
311
|
def indexed(self):
|
|
326
|
-
"""
|
|
327
|
-
:rtype: str or None
|
|
328
|
-
"""
|
|
329
312
|
return self.properties.get("Indexed", None)
|
|
330
313
|
|
|
331
314
|
@property
|
|
332
315
|
def type_display_name(self):
|
|
316
|
+
# type: () -> Optional[str]
|
|
333
317
|
"""
|
|
334
318
|
Gets a value that specifies the display name for the type of the field.
|
|
335
|
-
:rtype: str or None
|
|
336
319
|
"""
|
|
337
320
|
return self.properties.get("TypeDisplayName", None)
|
|
338
321
|
|
|
@@ -348,10 +331,9 @@ class Field(Entity):
|
|
|
348
331
|
|
|
349
332
|
@property
|
|
350
333
|
def type_short_description(self):
|
|
334
|
+
# type: () -> Optional[str]
|
|
351
335
|
"""
|
|
352
336
|
Gets a value that specifies the description for the type of the field.
|
|
353
|
-
|
|
354
|
-
:rtype: str or None
|
|
355
337
|
"""
|
|
356
338
|
return self.properties.get("TypeShortDescription", None)
|
|
357
339
|
|
|
@@ -3,7 +3,7 @@ from office365.sharepoint.entity_collection import EntityCollection
|
|
|
3
3
|
from office365.sharepoint.fields.related_field import RelatedField
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
class RelatedFieldCollection(EntityCollection):
|
|
6
|
+
class RelatedFieldCollection(EntityCollection[RelatedField]):
|
|
7
7
|
"""Represents a collection of RelatedField resources."""
|
|
8
8
|
|
|
9
9
|
def __init__(self, context, resource_path=None):
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from office365.sharepoint.fields.lookup_value import FieldLookupValue
|
|
2
|
+
from office365.sharepoint.principal.users.user import User
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
class FieldUserValue(FieldLookupValue):
|
|
@@ -8,11 +9,10 @@ class FieldUserValue(FieldLookupValue):
|
|
|
8
9
|
|
|
9
10
|
@staticmethod
|
|
10
11
|
def from_user(user):
|
|
12
|
+
# type: (User) -> FieldUserValue
|
|
11
13
|
"""
|
|
12
14
|
Initialize field value from User
|
|
13
|
-
|
|
14
|
-
:param office365.sharepoint.principal.user.User user: User entity
|
|
15
|
-
:return: FieldUserValue
|
|
15
|
+
:param User user: User object
|
|
16
16
|
"""
|
|
17
17
|
return_type = FieldUserValue(-1)
|
|
18
18
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
from office365.runtime.paths.key import KeyPath
|
|
2
1
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
2
|
+
from office365.runtime.paths.v3.entity import EntityPath
|
|
3
3
|
from office365.runtime.queries.service_operation import ServiceOperationQuery
|
|
4
4
|
from office365.sharepoint.entity import Entity
|
|
5
5
|
from office365.sharepoint.principal.users.user import User
|
|
@@ -43,5 +43,7 @@ class CheckedOutFile(Entity):
|
|
|
43
43
|
super(CheckedOutFile, self).set_property(name, value, persist_changes)
|
|
44
44
|
# fallback: create a new resource path
|
|
45
45
|
if name == "CheckedOutById":
|
|
46
|
-
self._resource_path =
|
|
46
|
+
self._resource_path = EntityPath(
|
|
47
|
+
value, self.parent_collection.resource_path
|
|
48
|
+
)
|
|
47
49
|
return self
|
|
@@ -3,7 +3,7 @@ from office365.sharepoint.entity_collection import EntityCollection
|
|
|
3
3
|
from office365.sharepoint.files.checked_out_file import CheckedOutFile
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
class CheckedOutFileCollection(EntityCollection):
|
|
6
|
+
class CheckedOutFileCollection(EntityCollection[CheckedOutFile]):
|
|
7
7
|
def __init__(self, context, resource_path=None):
|
|
8
8
|
super(CheckedOutFileCollection, self).__init__(
|
|
9
9
|
context, CheckedOutFile, resource_path
|
|
@@ -1,23 +1,31 @@
|
|
|
1
|
+
import hashlib
|
|
1
2
|
import os
|
|
3
|
+
import uuid
|
|
4
|
+
from typing import IO, TYPE_CHECKING, Callable
|
|
2
5
|
|
|
6
|
+
from office365.runtime.client_result import ClientResult
|
|
7
|
+
from office365.runtime.paths.resource_path import ResourcePath
|
|
3
8
|
from office365.runtime.paths.service_operation import ServiceOperationPath
|
|
4
9
|
from office365.runtime.queries.service_operation import ServiceOperationQuery
|
|
10
|
+
from office365.sharepoint.client_context import ClientContext
|
|
5
11
|
from office365.sharepoint.entity_collection import EntityCollection
|
|
6
12
|
from office365.sharepoint.files.creation_information import FileCreationInformation
|
|
7
13
|
from office365.sharepoint.files.file import File
|
|
8
|
-
from office365.sharepoint.internal.queries.upload_session import (
|
|
9
|
-
create_upload_session_query_ex,
|
|
10
|
-
)
|
|
11
14
|
from office365.sharepoint.types.resource_path import ResourcePath as SPResPath
|
|
12
15
|
|
|
16
|
+
if TYPE_CHECKING:
|
|
17
|
+
from office365.sharepoint.folders.folder import Folder
|
|
18
|
+
|
|
13
19
|
|
|
14
20
|
class FileCollection(EntityCollection[File]):
|
|
15
21
|
"""Represents a collection of File resources."""
|
|
16
22
|
|
|
17
23
|
def __init__(self, context, resource_path=None, parent=None):
|
|
24
|
+
# type: (ClientContext, ResourcePath, Folder) -> None
|
|
18
25
|
super(FileCollection, self).__init__(context, File, resource_path, parent)
|
|
19
26
|
|
|
20
27
|
def upload(self, path_or_file):
|
|
28
|
+
# type: (str|IO) -> File
|
|
21
29
|
"""Uploads a file into folder.
|
|
22
30
|
|
|
23
31
|
Note: This method only supports files up to 4MB in size!
|
|
@@ -34,22 +42,77 @@ class FileCollection(EntityCollection[File]):
|
|
|
34
42
|
name = os.path.basename(path_or_file)
|
|
35
43
|
return self.add(name, content, True)
|
|
36
44
|
|
|
45
|
+
def upload_with_checksum(self, file_object, chunk_size=1024):
|
|
46
|
+
# type: (IO, int) -> File
|
|
47
|
+
""" """
|
|
48
|
+
h = hashlib.sha1() # hashlib.md5()
|
|
49
|
+
file_name = os.path.basename(file_object.name)
|
|
50
|
+
upload_id = str(uuid.uuid4())
|
|
51
|
+
|
|
52
|
+
def _upload_session(return_type):
|
|
53
|
+
# type: (File) -> None
|
|
54
|
+
content = file_object.read(chunk_size)
|
|
55
|
+
h.update(content)
|
|
56
|
+
return_type.upload_with_checksum(
|
|
57
|
+
upload_id, h.hexdigest(), content
|
|
58
|
+
).after_execute(_upload_session)
|
|
59
|
+
|
|
60
|
+
return self.add(file_name, None, True).after_execute(_upload_session)
|
|
61
|
+
|
|
37
62
|
def create_upload_session(
|
|
38
|
-
self,
|
|
63
|
+
self, file, chunk_size, chunk_uploaded=None, file_name=None, **kwargs
|
|
39
64
|
):
|
|
65
|
+
# type: (IO|str, int, Callable[[int, ...], None], str, ...) -> File
|
|
40
66
|
"""Upload a file as multiple chunks
|
|
41
|
-
|
|
42
|
-
:param str or typing.IO path_or_file: path where file to upload resides or file handle
|
|
67
|
+
:param str or typing.IO file: path where file to upload resides or file handle
|
|
43
68
|
:param int chunk_size: upload chunk size (in bytes)
|
|
44
69
|
:param (long)->None or None chunk_uploaded: uploaded event
|
|
70
|
+
:param str file_name: custom file name
|
|
45
71
|
:param kwargs: arguments to pass to chunk_uploaded function
|
|
46
72
|
"""
|
|
47
73
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
74
|
+
auto_close = False
|
|
75
|
+
if not hasattr(file, "read"):
|
|
76
|
+
file = open(file, "rb")
|
|
77
|
+
auto_close = True
|
|
78
|
+
|
|
79
|
+
file_size = os.fstat(file.fileno()).st_size
|
|
80
|
+
file_name = file_name if file_name else os.path.basename(file.name)
|
|
81
|
+
upload_id = str(uuid.uuid4())
|
|
82
|
+
|
|
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
|
|
87
|
+
|
|
88
|
+
uploaded_bytes = file.tell()
|
|
89
|
+
if callable(chunk_uploaded):
|
|
90
|
+
chunk_uploaded(uploaded_bytes, **kwargs)
|
|
91
|
+
|
|
92
|
+
if uploaded_bytes == file_size:
|
|
93
|
+
if auto_close and not file.closed:
|
|
94
|
+
file.close()
|
|
95
|
+
return
|
|
96
|
+
|
|
97
|
+
content = file.read(chunk_size)
|
|
98
|
+
|
|
99
|
+
if uploaded_bytes == 0:
|
|
100
|
+
return_file.start_upload(upload_id, content).after_execute(
|
|
101
|
+
_upload_session, return_file
|
|
102
|
+
)
|
|
103
|
+
elif uploaded_bytes + len(content) < file_size:
|
|
104
|
+
return_file.continue_upload(
|
|
105
|
+
upload_id, uploaded_bytes, content
|
|
106
|
+
).after_execute(_upload_session, return_file)
|
|
107
|
+
else:
|
|
108
|
+
return_file.finish_upload(
|
|
109
|
+
upload_id, uploaded_bytes, content
|
|
110
|
+
).after_execute(_upload_session, return_file)
|
|
111
|
+
|
|
112
|
+
if file_size > chunk_size:
|
|
113
|
+
return self.add(file_name, None, True).after_execute(_upload_session, None)
|
|
114
|
+
else:
|
|
115
|
+
return self.add(file_name, file.read(), True)
|
|
53
116
|
|
|
54
117
|
def add(self, url, content, overwrite=False):
|
|
55
118
|
"""
|
|
@@ -60,7 +123,7 @@ class FileCollection(EntityCollection[File]):
|
|
|
60
123
|
or absolute form. Its length MUST be equal to or greater than 1.
|
|
61
124
|
:param bool overwrite: Specifies whether to overwrite an existing file with the same name and in the same
|
|
62
125
|
location as the one being added.
|
|
63
|
-
:param str or bytes content: Specifies the binary content of the file to be added.
|
|
126
|
+
:param str or bytes or None content: Specifies the binary content of the file to be added.
|
|
64
127
|
"""
|
|
65
128
|
return_type = File(self.context)
|
|
66
129
|
self.add_child(return_type)
|
|
@@ -80,7 +143,7 @@ class FileCollection(EntityCollection[File]):
|
|
|
80
143
|
return_type = File(self.context)
|
|
81
144
|
self.add_child(return_type)
|
|
82
145
|
|
|
83
|
-
def
|
|
146
|
+
def _add_template_file():
|
|
84
147
|
params = {
|
|
85
148
|
"urlOfFile": str(
|
|
86
149
|
SPResPath.create_relative(
|
|
@@ -94,17 +157,24 @@ class FileCollection(EntityCollection[File]):
|
|
|
94
157
|
)
|
|
95
158
|
self.context.add_query(qry)
|
|
96
159
|
|
|
97
|
-
self.parent.ensure_property("ServerRelativeUrl",
|
|
160
|
+
self.parent.ensure_property("ServerRelativeUrl", _add_template_file)
|
|
98
161
|
return return_type
|
|
99
162
|
|
|
100
163
|
def get_by_url(self, url):
|
|
164
|
+
# type: (str) -> File
|
|
101
165
|
"""Retrieve File object by url"""
|
|
102
166
|
return File(
|
|
103
167
|
self.context, ServiceOperationPath("GetByUrl", [url], self.resource_path)
|
|
104
168
|
)
|
|
105
169
|
|
|
106
170
|
def get_by_id(self, _id):
|
|
171
|
+
# type: (int) -> File
|
|
107
172
|
"""Gets the File with the specified ID."""
|
|
108
173
|
return File(
|
|
109
174
|
self.context, ServiceOperationPath("getById", [_id], self.resource_path)
|
|
110
175
|
)
|
|
176
|
+
|
|
177
|
+
@property
|
|
178
|
+
def parent(self):
|
|
179
|
+
# type: () -> Folder
|
|
180
|
+
return self._parent
|