Office365-REST-Python-Client 2.5.7__py3-none-any.whl → 2.5.9__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 (109) hide show
  1. {Office365_REST_Python_Client-2.5.7.dist-info → Office365_REST_Python_Client-2.5.9.dist-info}/METADATA +1 -1
  2. {Office365_REST_Python_Client-2.5.7.dist-info → Office365_REST_Python_Client-2.5.9.dist-info}/RECORD +109 -71
  3. office365/communications/onlinemeetings/online_meeting.py +30 -3
  4. office365/communications/onlinemeetings/recordings/__init__.py +0 -0
  5. office365/communications/onlinemeetings/recordings/call.py +5 -0
  6. office365/communications/onlinemeetings/transcripts/__init__.py +0 -0
  7. office365/directory/identitygovernance/entitlementmanagement/entitlement_management.py +7 -0
  8. office365/directory/identitygovernance/governance.py +16 -0
  9. office365/directory/serviceprincipals/service_principal.py +110 -21
  10. office365/graph_client.py +8 -0
  11. office365/onedrive/driveitems/driveItem.py +51 -5
  12. office365/onedrive/driveitems/retention_label.py +25 -0
  13. office365/onedrive/workbooks/charts/chart.py +13 -0
  14. office365/onedrive/workbooks/icon.py +5 -0
  15. office365/onedrive/workbooks/names/named_item.py +6 -0
  16. office365/onedrive/workbooks/ranges/font.py +5 -0
  17. office365/onedrive/workbooks/ranges/format.py +60 -0
  18. office365/onedrive/workbooks/ranges/range.py +12 -0
  19. office365/onedrive/workbooks/ranges/reference.py +6 -0
  20. office365/onedrive/workbooks/sort_field.py +26 -0
  21. office365/onedrive/workbooks/tables/pivot_table_collection.py +16 -0
  22. office365/onedrive/workbooks/worksheets/protection_options.py +3 -0
  23. office365/onedrive/workbooks/worksheets/worksheet.py +5 -4
  24. office365/sharepoint/activities/action_facet.py +17 -0
  25. office365/sharepoint/activities/client_request.py +4 -0
  26. office365/sharepoint/activities/client_response.py +8 -0
  27. office365/sharepoint/activities/entity.py +10 -0
  28. office365/sharepoint/activities/facets/delete.py +1 -0
  29. office365/sharepoint/activities/facets/get_mention.py +10 -0
  30. office365/sharepoint/activities/facets/in_doc.py +4 -0
  31. office365/sharepoint/activities/facets/move.py +14 -0
  32. office365/sharepoint/activities/facets/point_in_time_restore.py +9 -0
  33. office365/sharepoint/activities/facets/revision_set.py +9 -0
  34. office365/sharepoint/activities/facets/task_completed.py +9 -0
  35. office365/sharepoint/activities/facets/version.py +12 -0
  36. office365/sharepoint/activities/identity_item.py +16 -1
  37. office365/sharepoint/alerts/collection.py +12 -0
  38. office365/sharepoint/attachments/attachment.py +3 -0
  39. office365/sharepoint/attachments/collection.py +26 -4
  40. office365/sharepoint/client_context.py +29 -0
  41. office365/sharepoint/comments/collection.py +1 -1
  42. office365/sharepoint/compliance/store_proxy.py +43 -0
  43. office365/sharepoint/directory/provider/alternate_id_data.py +9 -0
  44. office365/sharepoint/directory/provider/notification.py +15 -0
  45. office365/sharepoint/directory/provider/object_data.py +14 -0
  46. office365/sharepoint/directory/provider/provider.py +13 -0
  47. office365/sharepoint/entity.py +15 -0
  48. office365/sharepoint/features/collection.py +2 -0
  49. office365/sharepoint/fields/date_time.py +18 -0
  50. office365/sharepoint/fields/lookup.py +20 -0
  51. office365/sharepoint/fields/multi_line_text.py +25 -0
  52. office365/sharepoint/fields/rating_scale.py +2 -5
  53. office365/sharepoint/fields/user_value.py +1 -1
  54. office365/sharepoint/files/collection.py +6 -5
  55. office365/sharepoint/files/versions/version.py +7 -0
  56. office365/sharepoint/folders/folder.py +2 -2
  57. office365/sharepoint/migrationcenter/service/performance/dashboard_data.py +12 -0
  58. office365/sharepoint/migrationcenter/service/performance/data.py +38 -0
  59. office365/sharepoint/migrationcenter/service/performance/throughput_data.py +9 -0
  60. office365/sharepoint/migrationcenter/service/services.py +22 -0
  61. office365/sharepoint/multigeo/api_versions.py +28 -0
  62. office365/sharepoint/multigeo/move_job_entity_data.py +9 -0
  63. office365/sharepoint/multigeo/services.py +39 -0
  64. office365/sharepoint/multigeo/site_move_job_entity_data.py +9 -0
  65. office365/sharepoint/multigeo/tenant_information.py +9 -0
  66. office365/sharepoint/multigeo/user_personal_site_location.py +9 -0
  67. office365/sharepoint/permissions/securable_object.py +2 -0
  68. office365/sharepoint/publishing/portal_health_details.py +10 -0
  69. office365/sharepoint/publishing/portal_health_status.py +8 -1
  70. office365/sharepoint/sharing/object_sharing_information.py +2 -0
  71. office365/sharepoint/sharing/permission_collection.py +8 -1
  72. office365/sharepoint/sharing/shared_document_info.py +28 -0
  73. office365/sharepoint/sitehealth/summary.py +20 -0
  74. office365/sharepoint/sites/site.py +12 -0
  75. office365/sharepoint/sites/version_policy_manager.py +7 -0
  76. office365/sharepoint/tenant/administration/container_properties.py +17 -0
  77. office365/sharepoint/tenant/administration/group.py +17 -0
  78. office365/sharepoint/tenant/administration/powerapps/environment.py +31 -0
  79. office365/sharepoint/tenant/administration/recent_admin_action_report.py +14 -0
  80. office365/sharepoint/tenant/administration/recent_admin_action_report_payload.py +10 -0
  81. office365/sharepoint/tenant/administration/secondary_administrators_info.py +5 -0
  82. office365/sharepoint/tenant/administration/siteinfo_for_site_picker.py +5 -1
  83. office365/sharepoint/tenant/administration/sites/creation_default_storage_quota.py +5 -0
  84. office365/sharepoint/tenant/administration/sites/creation_source.py +16 -1
  85. office365/sharepoint/tenant/administration/sites/properties_collection.py +2 -0
  86. office365/sharepoint/tenant/administration/sites/state_properties.py +14 -0
  87. office365/sharepoint/tenant/administration/tenant.py +56 -1
  88. office365/sharepoint/tenant/cdn_api.py +16 -0
  89. office365/sharepoint/tenant/management/externalusers/results/get.py +4 -0
  90. office365/sharepoint/tenant/management/office365_tenant.py +14 -0
  91. office365/sharepoint/types/resource_path.py +1 -1
  92. office365/sharepoint/ui/applicationpages/peoplepicker/web_service_interface.py +39 -33
  93. office365/sharepoint/userprofiles/cross_geo_sync.py +37 -0
  94. office365/sharepoint/userprofiles/cross_geo_sync_user_data_batch.py +5 -0
  95. office365/sharepoint/userprofiles/followed_content.py +15 -0
  96. office365/sharepoint/userprofiles/people_manager.py +23 -10
  97. office365/sharepoint/userprofiles/person_properties.py +7 -0
  98. office365/sharepoint/userprofiles/user_profile.py +4 -6
  99. office365/sharepoint/views/view.py +3 -1
  100. office365/sharepoint/views/visualization/__init__.py +0 -0
  101. office365/sharepoint/views/visualization/field.py +14 -0
  102. office365/sharepoint/views/visualization/style_set.py +5 -0
  103. office365/sharepoint/webs/web.py +43 -0
  104. office365/sharepoint/workflow/manager.py +5 -0
  105. office365/sharepoint/workflowservices/deployment_service.py +9 -0
  106. {Office365_REST_Python_Client-2.5.7.dist-info → Office365_REST_Python_Client-2.5.9.dist-info}/LICENSE +0 -0
  107. {Office365_REST_Python_Client-2.5.7.dist-info → Office365_REST_Python_Client-2.5.9.dist-info}/WHEEL +0 -0
  108. {Office365_REST_Python_Client-2.5.7.dist-info → Office365_REST_Python_Client-2.5.9.dist-info}/top_level.txt +0 -0
  109. /office365/sharepoint/views/{visualization.py → visualization/visualization.py} +0 -0
@@ -7,8 +7,15 @@ from office365.sharepoint.activities.facets.delete import DeleteFacet
7
7
  from office365.sharepoint.activities.facets.discard_checkout import DiscardCheckoutFacet
8
8
  from office365.sharepoint.activities.facets.edit import EditFacet
9
9
  from office365.sharepoint.activities.facets.get_comment import GetCommentFacet
10
+ from office365.sharepoint.activities.facets.get_mention import GetMentionFacet
11
+ from office365.sharepoint.activities.facets.move import MoveFacet
12
+ from office365.sharepoint.activities.facets.point_in_time_restore import (
13
+ PointInTimeRestoreFacet,
14
+ )
10
15
  from office365.sharepoint.activities.facets.rename import RenameFacet
11
16
  from office365.sharepoint.activities.facets.sharing import SharingFacet
17
+ from office365.sharepoint.activities.facets.task_completed import TaskCompletedFacet
18
+ from office365.sharepoint.activities.facets.version import VersionFacet
12
19
 
13
20
 
14
21
  class ActionFacet(ClientValue):
@@ -22,8 +29,13 @@ class ActionFacet(ClientValue):
22
29
  delete=DeleteFacet(),
23
30
  discard_checkout=DiscardCheckoutFacet(),
24
31
  edit=EditFacet(),
32
+ mention=GetMentionFacet(),
33
+ move=MoveFacet(),
34
+ pointInTimeRestore=PointInTimeRestoreFacet(),
25
35
  rename=RenameFacet(),
26
36
  share=SharingFacet(),
37
+ taskCompleted=TaskCompletedFacet(),
38
+ version=VersionFacet(),
27
39
  ):
28
40
  """
29
41
  :param AddToOneDriveFacet add_to_one_drive:
@@ -42,8 +54,13 @@ class ActionFacet(ClientValue):
42
54
  self.delete = delete
43
55
  self.discardCheckout = discard_checkout
44
56
  self.edit = edit
57
+ self.mention = mention
58
+ self.move = move
59
+ self.pointInTimeRestore = pointInTimeRestore
45
60
  self.rename = rename
46
61
  self.share = share
62
+ self.taskCompleted = taskCompleted
63
+ self.version = version
47
64
 
48
65
  def __repr__(self):
49
66
  return self.facet_type
@@ -1,7 +1,11 @@
1
1
  from office365.runtime.client_value import ClientValue
2
+ from office365.sharepoint.activities.facets.revision_set import RevisionSetFacet
2
3
 
3
4
 
4
5
  class ActivityClientRequest(ClientValue):
6
+ def __init__(self, revisionSet=RevisionSetFacet()):
7
+ self.revisionSet = revisionSet
8
+
5
9
  @property
6
10
  def entity_type_name(self):
7
11
  return "Microsoft.SharePoint.Activities.ActivityClientRequest"
@@ -4,6 +4,14 @@ from office365.runtime.client_value import ClientValue
4
4
  class ActivityClientResponse(ClientValue):
5
5
  """"""
6
6
 
7
+ def __init__(self, id_, message=None, serverId=None, status=None):
8
+ # type: (str, str, str, int) -> None
9
+ """ """
10
+ self.id = id_
11
+ self.message = message
12
+ self.serverId = serverId
13
+ self.status = status
14
+
7
15
  @property
8
16
  def entity_type_name(self):
9
17
  return "Microsoft.SharePoint.Activities.ActivityClientResponse"
@@ -34,6 +34,16 @@ class SPActivityEntity(Entity):
34
34
  def times(self):
35
35
  return self.properties.get("times", ActivityTimeFacet())
36
36
 
37
+ @property
38
+ def property_ref_name(self):
39
+ return "id"
40
+
37
41
  @property
38
42
  def entity_type_name(self):
39
43
  return "Microsoft.SharePoint.Activities.SPActivityEntity"
44
+
45
+ def set_property(self, name, value, persist_changes=True):
46
+ super(SPActivityEntity, self).set_property(name, value, persist_changes)
47
+ if name == self.property_ref_name:
48
+ self._resource_path.patch(value)
49
+ return self
@@ -5,6 +5,7 @@ class DeleteFacet(ClientValue):
5
5
  """"""
6
6
 
7
7
  def __init__(self, name=None):
8
+ # type: (str) -> None
8
9
  self.name = name
9
10
 
10
11
  @property
@@ -0,0 +1,10 @@
1
+ from office365.runtime.client_value import ClientValue
2
+ from office365.runtime.client_value_collection import ClientValueCollection
3
+ from office365.sharepoint.activities.identity import ActivityIdentity
4
+
5
+
6
+ class GetMentionFacet(ClientValue):
7
+ """"""
8
+
9
+ def __init__(self, mentionees=None):
10
+ self.mentionees = ClientValueCollection(ActivityIdentity, mentionees)
@@ -4,6 +4,10 @@ from office365.runtime.client_value import ClientValue
4
4
  class InDocFacet(ClientValue):
5
5
  """"""
6
6
 
7
+ def __init__(self, contentId=None, navigationId=None):
8
+ self.contentId = contentId
9
+ self.navigationId = navigationId
10
+
7
11
  @property
8
12
  def entity_type_name(self):
9
13
  return "Microsoft.SharePoint.Activities.InDocFacet"
@@ -0,0 +1,14 @@
1
+ from office365.runtime.client_value import ClientValue
2
+ from office365.sharepoint.types.resource_path import ResourcePath as SPResPath
3
+
4
+
5
+ class MoveFacet(ClientValue):
6
+ """"""
7
+
8
+ def __init__(self, from_=SPResPath(), to=SPResPath()):
9
+ self.from_ = from_
10
+ self.to = to
11
+
12
+ @property
13
+ def entity_type_name(self):
14
+ return "Microsoft.SharePoint.Activities.MoveFacet"
@@ -0,0 +1,9 @@
1
+ from office365.runtime.client_value import ClientValue
2
+
3
+
4
+ class PointInTimeRestoreFacet(ClientValue):
5
+ """"""
6
+
7
+ @property
8
+ def entity_type_name(self):
9
+ return "Microsoft.SharePoint.Activities.PointInTimeRestoreFacet"
@@ -0,0 +1,9 @@
1
+ from office365.runtime.client_value import ClientValue
2
+
3
+
4
+ class RevisionSetFacet(ClientValue):
5
+ """ """
6
+
7
+ @property
8
+ def entity_type_name(self):
9
+ return "Microsoft.SharePoint.Activities.RevisionSetFacet"
@@ -0,0 +1,9 @@
1
+ from office365.runtime.client_value import ClientValue
2
+
3
+
4
+ class TaskCompletedFacet(ClientValue):
5
+ """ """
6
+
7
+ @property
8
+ def entity_type_name(self):
9
+ return "Microsoft.SharePoint.Activities.TaskCompletedFacet"
@@ -0,0 +1,12 @@
1
+ from office365.runtime.client_value import ClientValue
2
+
3
+
4
+ class VersionFacet(ClientValue):
5
+ """"""
6
+
7
+ def __init__(self, fromVersion=None):
8
+ self.fromVersion = fromVersion
9
+
10
+ @property
11
+ def entity_type_name(self):
12
+ return "Microsoft.SharePoint.Activities.VersionFacet"
@@ -2,11 +2,26 @@ from office365.runtime.client_value import ClientValue
2
2
 
3
3
 
4
4
  class ActivityIdentityItem(ClientValue):
5
- def __init__(self, client_id=None):
5
+ def __init__(
6
+ self,
7
+ client_id=None,
8
+ clientIdProvider=None,
9
+ displayName=None,
10
+ email=None,
11
+ userPrincipalName=None,
12
+ ):
6
13
  """
7
14
  :param str client_id:
15
+ :param str clientIdProvider:
16
+ :param str displayName:
17
+ :param str email:
18
+ :param str userPrincipalName:
8
19
  """
9
20
  self.clientId = client_id
21
+ self.clientIdProvider = clientIdProvider
22
+ self.displayName = displayName
23
+ self.email = email
24
+ self.userPrincipalName = userPrincipalName
10
25
 
11
26
  @property
12
27
  def entity_type_name(self):
@@ -39,6 +39,18 @@ class AlertCollection(EntityCollection[Alert]):
39
39
  self.context.add_query(qry)
40
40
  return return_type
41
41
 
42
+ def delete_alert_at_index(self, index):
43
+ """Deletes the alert based on the given index.
44
+
45
+ :param int index: A 32-bit integer that is greater than or equal to 0 and less than the count of the
46
+ alert in the collection. Specifies the index of the alert in the collection.
47
+ """
48
+ qry = ServiceOperationQuery(
49
+ self, "DeleteAlertAtIndex", {"index": index}, None, None, None
50
+ )
51
+ self.context.add_query(qry)
52
+ return self
53
+
42
54
  def get_by_id(self, id_alert):
43
55
  """
44
56
  Gets an alert based on the Id.
@@ -10,6 +10,9 @@ from office365.sharepoint.types.resource_path import ResourcePath as SPResPath
10
10
  class Attachment(Entity):
11
11
  """Represents an attachment file in a SharePoint List Item."""
12
12
 
13
+ def __repr__(self):
14
+ return self.server_relative_url or self.entity_type_name
15
+
13
16
  def download(self, file_object, use_path=True):
14
17
  """Download attachment file
15
18
 
@@ -1,4 +1,5 @@
1
- from typing import AnyStr
1
+ import os
2
+ from typing import IO, AnyStr
2
3
 
3
4
  from office365.runtime.paths.service_operation import ServiceOperationPath
4
5
  from office365.runtime.queries.service_operation import ServiceOperationQuery
@@ -18,7 +19,7 @@ class AttachmentCollection(EntityCollection[Attachment]):
18
19
  )
19
20
 
20
21
  def add(self, attachment_file_information):
21
- # type: (AttachmentCreationInformation) -> Attachment
22
+ # type: (AttachmentCreationInformation|dict) -> Attachment
22
23
  """
23
24
  Adds the attachment represented by the file name and stream in the specified parameter to the list item.
24
25
 
@@ -55,14 +56,35 @@ class AttachmentCollection(EntityCollection[Attachment]):
55
56
  :param str content_stream: Stream containing the content of the attachment.
56
57
  """
57
58
  return_type = Attachment(self.context)
58
- payload = {"DecodedUrl": decoded_url, "contentStream": content_stream}
59
+ params = {"DecodedUrl": decoded_url}
59
60
  qry = ServiceOperationQuery(
60
- self, "AddUsingPath", None, payload, None, return_type
61
+ self, "AddUsingPath", params, content_stream, None, return_type
61
62
  )
62
63
  self.context.add_query(qry)
63
64
  self.add_child(return_type)
64
65
  return return_type
65
66
 
67
+ def delete_all(self):
68
+ """Deletes all attachments"""
69
+
70
+ def _delete_all(return_type):
71
+ # type: ("AttachmentCollection") -> None
72
+ [a.delete_object() for a in return_type]
73
+
74
+ self.get().after_execute(_delete_all)
75
+ return self
76
+
77
+ def upload(self, file, use_path=True):
78
+ # type: (IO, bool) -> Attachment
79
+ """
80
+ Uploads the attachment
81
+ """
82
+ info = AttachmentCreationInformation(os.path.basename(file.name), file.read())
83
+ if use_path:
84
+ return self.add_using_path(info.filename, info.content)
85
+ else:
86
+ return self.add(info)
87
+
66
88
  def get_by_filename(self, filename):
67
89
  """Retrieve Attachment file object by filename
68
90
 
@@ -410,6 +410,16 @@ class ClientContext(ClientRuntimeContext):
410
410
 
411
411
  return AnnouncementsController(self, ResourcePath("Announcements"))
412
412
 
413
+ @property
414
+ def client_people_picker(self):
415
+ """Query principals service alias"""
416
+
417
+ from office365.sharepoint.ui.applicationpages.peoplepicker.web_service_interface import (
418
+ ClientPeoplePickerWebServiceInterface,
419
+ )
420
+
421
+ return ClientPeoplePickerWebServiceInterface(self)
422
+
413
423
  @property
414
424
  def consumer_permissions(self):
415
425
  """Consumer permissions alias"""
@@ -431,6 +441,15 @@ class ClientContext(ClientRuntimeContext):
431
441
 
432
442
  return EmployeeEngagement(self)
433
443
 
444
+ @property
445
+ def directory_provider(self):
446
+ """Alias to SharePointDirectoryProvider"""
447
+ from office365.sharepoint.directory.provider.provider import (
448
+ SharePointDirectoryProvider,
449
+ )
450
+
451
+ return SharePointDirectoryProvider(self)
452
+
434
453
  @property
435
454
  def employee_experience(self):
436
455
  """Alias to EmployeeExperience"""
@@ -612,6 +631,16 @@ class ClientContext(ClientRuntimeContext):
612
631
 
613
632
  return SPHSite(self, ResourcePath("SPHSite"))
614
633
 
634
+ @property
635
+ def people_picker(self):
636
+ """Query principals service alias"""
637
+
638
+ from office365.sharepoint.ui.applicationpages.peoplepicker.web_service_interface import (
639
+ PeoplePickerWebServiceInterface,
640
+ )
641
+
642
+ return PeoplePickerWebServiceInterface(self)
643
+
615
644
  @property
616
645
  def publications(self):
617
646
  from office365.sharepoint.contentcenter.machinelearning.publications.publication import (
@@ -4,7 +4,7 @@ from office365.sharepoint.comments.comment import Comment
4
4
  from office365.sharepoint.entity_collection import EntityCollection
5
5
 
6
6
 
7
- class CommentCollection(EntityCollection):
7
+ class CommentCollection(EntityCollection[Comment]):
8
8
  def __init__(self, context, resource_path=None):
9
9
  super(CommentCollection, self).__init__(context, Comment, resource_path)
10
10
 
@@ -1,3 +1,5 @@
1
+ from typing import TYPE_CHECKING, Optional
2
+
1
3
  from office365.runtime.client_result import ClientResult
2
4
  from office365.runtime.client_value_collection import ClientValueCollection
3
5
  from office365.runtime.queries.service_operation import ServiceOperationQuery
@@ -5,8 +7,49 @@ from office365.runtime.types.collections import StringCollection
5
7
  from office365.sharepoint.compliance.tag import ComplianceTag
6
8
  from office365.sharepoint.entity import Entity
7
9
 
10
+ if TYPE_CHECKING:
11
+ from office365.sharepoint.client_context import ClientContext
12
+
8
13
 
9
14
  class SPPolicyStoreProxy(Entity):
15
+ @staticmethod
16
+ def check_site_is_deletable_by_id(context, site_id, return_type=None):
17
+ # type: (ClientContext, str, Optional[ClientResult[bool]]) -> ClientResult[bool]
18
+ """ """
19
+ if return_type is None:
20
+ return_type = ClientResult(context, bool())
21
+ payload = {"siteId": site_id}
22
+ qry = ServiceOperationQuery(
23
+ SPPolicyStoreProxy(context),
24
+ "CheckSiteIsDeletableById",
25
+ None,
26
+ payload,
27
+ None,
28
+ return_type,
29
+ True,
30
+ )
31
+ context.add_query(qry)
32
+ return return_type
33
+
34
+ @staticmethod
35
+ def is_site_deletable(context, site_url, return_type=None):
36
+ # type: (ClientContext, str, Optional[ClientResult[bool]]) -> ClientResult[bool]
37
+ """ """
38
+ if return_type is None:
39
+ return_type = ClientResult(context, bool())
40
+ payload = {"siteUrl": site_url}
41
+ qry = ServiceOperationQuery(
42
+ SPPolicyStoreProxy(context),
43
+ "IsSiteDeletable",
44
+ None,
45
+ payload,
46
+ None,
47
+ return_type,
48
+ True,
49
+ )
50
+ context.add_query(qry)
51
+ return return_type
52
+
10
53
  @staticmethod
11
54
  def get_available_tags_for_site(context, site_url, return_type=None):
12
55
  """
@@ -0,0 +1,9 @@
1
+ from office365.runtime.client_value import ClientValue
2
+
3
+
4
+ class AlternateIdData(ClientValue):
5
+ """"""
6
+
7
+ @property
8
+ def entity_type_name(self):
9
+ return "SP.Directory.Provider.AlternateIdData"
@@ -0,0 +1,15 @@
1
+ from office365.runtime.paths.resource_path import ResourcePath
2
+ from office365.sharepoint.entity import Entity
3
+
4
+
5
+ class DirectoryNotification(Entity):
6
+ """"""
7
+
8
+ def __init__(self, context, resource_path=None):
9
+ if resource_path is None:
10
+ resource_path = ResourcePath("SP.Directory.Provider.DirectoryNotification")
11
+ super(DirectoryNotification, self).__init__(context, resource_path)
12
+
13
+ @property
14
+ def entity_type_name(self):
15
+ return "SP.Directory.Provider.DirectoryNotification"
@@ -0,0 +1,14 @@
1
+ from office365.runtime.client_value import ClientValue
2
+ from office365.sharepoint.directory.provider.alternate_id_data import AlternateIdData
3
+
4
+
5
+ class DirectoryObjectData(ClientValue):
6
+ """"""
7
+
8
+ def __init__(self, AlternateId=AlternateIdData(), Id=None):
9
+ self.AlternateId = AlternateId
10
+ self.Id = Id
11
+
12
+ @property
13
+ def entity_type_name(self):
14
+ return "SP.Directory.Provider.DirectoryObjectData"
@@ -1,4 +1,7 @@
1
+ from office365.runtime.client_result import ClientResult
1
2
  from office365.runtime.paths.resource_path import ResourcePath
3
+ from office365.runtime.queries.service_operation import ServiceOperationQuery
4
+ from office365.sharepoint.directory.provider.object_data import DirectoryObjectData
2
5
  from office365.sharepoint.entity import Entity
3
6
 
4
7
 
@@ -10,6 +13,16 @@ class SharePointDirectoryProvider(Entity):
10
13
  )
11
14
  super(SharePointDirectoryProvider, self).__init__(context, resource_path)
12
15
 
16
+ def read_directory_object(self, data):
17
+ """"""
18
+ return_type = ClientResult(self.context, DirectoryObjectData())
19
+ payload = {"data": data}
20
+ qry = ServiceOperationQuery(
21
+ self, "ReadDirectoryObject", None, payload, None, return_type
22
+ )
23
+ self.context.add_query(qry)
24
+ return return_type
25
+
13
26
  @property
14
27
  def entity_type_name(self):
15
28
  return "SP.Directory.Provider.SharePointDirectoryProvider"
@@ -5,6 +5,7 @@ from typing_extensions import Self
5
5
  from office365.runtime.auth.client_credential import ClientCredential
6
6
  from office365.runtime.auth.user_credential import UserCredential
7
7
  from office365.runtime.client_object import ClientObject
8
+ from office365.runtime.paths.v3.entity import EntityPath
8
9
  from office365.runtime.queries.delete_entity import DeleteEntityQuery
9
10
  from office365.runtime.queries.update_entity import UpdateEntityQuery
10
11
 
@@ -53,3 +54,17 @@ class Entity(ClientObject):
53
54
  @property
54
55
  def property_ref_name(self):
55
56
  return "Id"
57
+
58
+ def set_property(self, name, value, persist_changes=True):
59
+ super(Entity, self).set_property(name, value, persist_changes)
60
+ if name == self.property_ref_name:
61
+ if self.resource_path is None:
62
+ if self.parent_collection:
63
+ self._resource_path = EntityPath(
64
+ value, self.parent_collection.resource_path
65
+ )
66
+ else:
67
+ pass
68
+ else:
69
+ self._resource_path.patch(value)
70
+ return self
@@ -11,6 +11,7 @@ class FeatureCollection(EntityCollection[Feature]):
11
11
  super(FeatureCollection, self).__init__(context, Feature, resource_path, parent)
12
12
 
13
13
  def add(self, feature_id, force, featdef_scope, verify_if_activated=False):
14
+ # type: (str, bool, int, bool) -> Feature
14
15
  """
15
16
  Adds the feature to the collection of activated features and returns the added feature.
16
17
 
@@ -43,6 +44,7 @@ class FeatureCollection(EntityCollection[Feature]):
43
44
  return return_type
44
45
 
45
46
  def get_by_id(self, feature_id):
47
+ # type: (str) -> Feature
46
48
  """Returns the feature for the given feature identifier. Returns NULL if no feature is available for the given
47
49
  feature identifier.
48
50
 
@@ -24,3 +24,21 @@ class FieldDateTime(Field):
24
24
  # type: () -> Optional[str]
25
25
  """ """
26
26
  return self.properties.get("DateFormat", None)
27
+
28
+ @property
29
+ def display_format(self):
30
+ # type: () -> Optional[int]
31
+ """Specifies the type of date and time format that is used in the field"""
32
+ return self.properties.get("DisplayFormat", None)
33
+
34
+ @property
35
+ def friendly_display_format(self):
36
+ # type: () -> Optional[int]
37
+ """Gets the type of friendly display format that is used in the field"""
38
+ return self.properties.get("FriendlyDisplayFormat", None)
39
+
40
+ @property
41
+ def time_format(self):
42
+ # type: () -> Optional[str]
43
+ """Gets the time format that is used in the field"""
44
+ return self.properties.get("TimeFormat", None)
@@ -43,3 +43,23 @@ class FieldLookup(Field):
43
43
  """Sets a value that specifies the list identifier of the list that contains the field to use as
44
44
  the lookup values."""
45
45
  self.set_property("LookupList", val, True)
46
+
47
+ @property
48
+ def primary_field_id(self):
49
+ # type: () -> Optional[str]
50
+ """Specifies the primary lookup field identifier if this is a dependent lookup field.
51
+ Otherwise, it is an empty string."""
52
+ return self.properties.get("PrimaryFieldId", None)
53
+
54
+ @property
55
+ def relationship_delete_behavior(self):
56
+ # type: () -> Optional[int]
57
+ """Gets a value that specifies the relationship delete behavior of the lookup field."""
58
+ return self.properties.get("RelationshipDeleteBehavior", None)
59
+
60
+ @property
61
+ def unlimited_length_in_document_library(self):
62
+ # type: () -> Optional[bool]
63
+ """Gets or sets a Boolean value that specifies whether to allow values with unlimited text
64
+ in the lookup field."""
65
+ return self.properties.get("UnlimitedLengthInDocumentLibrary", None)
@@ -31,3 +31,28 @@ class FieldMultiLineText(Field):
31
31
  # type: (int) -> None
32
32
  """Set the number of lines to display in the field."""
33
33
  self.set_property("NumberOfLines", val)
34
+
35
+ @property
36
+ def restricted_mode(self):
37
+ # type: () -> Optional[bool]
38
+ """Specifies whether the field supports a subset of rich text formatting."""
39
+ return self.properties.get("RestrictedMode", None)
40
+
41
+ @property
42
+ def rich_text(self):
43
+ # type: () -> Optional[bool]
44
+ """Specifies whether the field supports rich text formatting."""
45
+ return self.properties.get("RichText", None)
46
+
47
+ @property
48
+ def unlimited_length_in_document_library(self):
49
+ # type: () -> Optional[bool]
50
+ """Gets a Boolean value that specifies whether to allow unlimited field length in document libraries."""
51
+ return self.properties.get("UnlimitedLengthInDocumentLibrary", None)
52
+
53
+ @property
54
+ def wiki_linking(self):
55
+ # type: () -> Optional[bool]
56
+ """Specifies whether an implementation-specific mechanism for linking wiki pages is supported.
57
+ It MUST be "false" if RichText is "false"."""
58
+ return self.properties.get("WikiLinking", None)
@@ -15,11 +15,8 @@ class FieldRatingScale(FieldMultiChoice):
15
15
 
16
16
  @grid_start_number.setter
17
17
  def grid_start_number(self, value):
18
- """
19
- Gets the start number for the rating scale.
20
-
21
- :type value: int
22
- """
18
+ # type: (int) -> None
19
+ """Gets the start number for the rating scale."""
23
20
  self.set_property("GridStartNumber", value)
24
21
 
25
22
  @property
@@ -9,7 +9,7 @@ class FieldUserValue(FieldLookupValue):
9
9
 
10
10
  @staticmethod
11
11
  def from_user(user):
12
- # type: (User) -> FieldUserValue
12
+ # type: (User) -> "FieldUserValue"
13
13
  """
14
14
  Initialize field value from User
15
15
  :param User user: User object
@@ -24,22 +24,23 @@ class FileCollection(EntityCollection[File]):
24
24
  # type: (ClientContext, ResourcePath, Folder) -> None
25
25
  super(FileCollection, self).__init__(context, File, resource_path, parent)
26
26
 
27
- def upload(self, path_or_file):
28
- # type: (str|IO) -> File
27
+ def upload(self, path_or_file, file_name=None):
28
+ # type: (str|IO, str) -> File
29
29
  """Uploads a file into folder.
30
30
 
31
31
  Note: This method only supports files up to 4MB in size!
32
32
  Consider create_upload_session method instead for larger files
33
- :param str or typing.IO path_or_file: path where file to upload resides or file handle
33
+ :param str or typing.IO path_or_file: Path where file to upload resides or file handle
34
+ :param str file_name: New file name
34
35
  """
35
36
  if hasattr(path_or_file, "read"):
37
+ name = file_name or os.path.basename(path_or_file.name)
36
38
  content = path_or_file.read()
37
- name = os.path.basename(path_or_file.name)
38
39
  return self.add(name, content, True)
39
40
  else:
40
41
  with open(path_or_file, "rb") as f:
41
42
  content = f.read()
42
- name = os.path.basename(path_or_file)
43
+ name = file_name or os.path.basename(path_or_file)
43
44
  return self.add(name, content, True)
44
45
 
45
46
  def upload_with_checksum(self, file_object, chunk_size=1024):