Office365-REST-Python-Client 2.5.10__py3-none-any.whl → 2.5.11__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 (62) hide show
  1. {Office365_REST_Python_Client-2.5.10.dist-info → Office365_REST_Python_Client-2.5.11.dist-info}/METADATA +9 -10
  2. {Office365_REST_Python_Client-2.5.10.dist-info → Office365_REST_Python_Client-2.5.11.dist-info}/RECORD +62 -53
  3. {Office365_REST_Python_Client-2.5.10.dist-info → Office365_REST_Python_Client-2.5.11.dist-info}/WHEEL +1 -1
  4. office365/directory/identitygovernance/appconsent/request.py +32 -0
  5. office365/directory/identitygovernance/appconsent/request_scope.py +5 -0
  6. office365/directory/identitygovernance/privilegedaccess/group.py +5 -0
  7. office365/directory/identitygovernance/privilegedaccess/root.py +14 -0
  8. office365/directory/identitygovernance/privilegedaccess/schedule_instance.py +6 -0
  9. office365/directory/policies/admin_consent_request.py +10 -0
  10. office365/directory/policies/root.py +15 -0
  11. office365/directory/synchronization/status.py +14 -1
  12. office365/directory/synchronization/task_execution.py +5 -0
  13. office365/directory/users/user.py +4 -2
  14. office365/graph_client.py +7 -24
  15. office365/graph_request.py +24 -1
  16. office365/onedrive/driveitems/driveItem.py +41 -38
  17. office365/onedrive/listitems/list_item.py +1 -0
  18. office365/onedrive/lists/collection.py +6 -0
  19. office365/onedrive/sharepoint_ids.py +18 -1
  20. office365/onedrive/shares/drive_item.py +1 -2
  21. office365/onedrive/storage/__init__.py +0 -0
  22. office365/onedrive/storage/storage.py +5 -0
  23. office365/onedrive/workbooks/filter.py +7 -0
  24. office365/onedrive/workbooks/filter_criteria.py +9 -2
  25. office365/onedrive/workbooks/tables/rows/collection.py +20 -0
  26. office365/onedrive/workbooks/tables/rows/row.py +2 -1
  27. office365/onedrive/workbooks/workbook.py +7 -5
  28. office365/onenote/internal/multipart_page_query.py +2 -3
  29. office365/outlook/category.py +7 -0
  30. office365/outlook/mail/item_body.py +10 -1
  31. office365/outlook/mail/messages/collection.py +3 -0
  32. office365/outlook/mail/messages/message.py +3 -4
  33. office365/runtime/auth/providers/saml_token_provider.py +4 -4
  34. office365/runtime/http/request_options.py +7 -3
  35. office365/runtime/queries/create_entity.py +6 -8
  36. office365/runtime/queries/update_entity.py +3 -5
  37. office365/sharepoint/attachments/attachment.py +14 -2
  38. office365/sharepoint/attachments/collection.py +27 -4
  39. office365/sharepoint/changes/app_consent_principal.py +5 -0
  40. office365/sharepoint/changes/file.py +4 -0
  41. office365/sharepoint/documentmanagement/document_set.py +7 -8
  42. office365/sharepoint/fields/builtin_field_id.py +19 -0
  43. office365/sharepoint/fields/choice.py +2 -2
  44. office365/sharepoint/fields/collection.py +1 -3
  45. office365/sharepoint/fields/field.py +5 -2
  46. office365/sharepoint/files/file.py +1 -1
  47. office365/sharepoint/internal/queries/upload_file.py +12 -8
  48. office365/sharepoint/navigation/node.py +4 -2
  49. office365/sharepoint/packaging/app_details.py +34 -0
  50. office365/sharepoint/policy/dlp_policy_tip.py +9 -1
  51. office365/sharepoint/portal/sites/manager.py +1 -1
  52. office365/sharepoint/principal/principal.py +10 -1
  53. office365/sharepoint/principal/users/collection.py +1 -3
  54. office365/sharepoint/publishing/sites/communication/site.py +4 -3
  55. office365/sharepoint/request.py +33 -1
  56. office365/sharepoint/sharing/information.py +5 -0
  57. office365/sharepoint/sharing/permission_collection.py +13 -9
  58. office365/sharepoint/sharing/recipient_limits.py +9 -0
  59. office365/sharepoint/sharing/site_sharing_report_helper.py +2 -3
  60. office365/sharepoint/tenant/administration/tenant.py +22 -0
  61. {Office365_REST_Python_Client-2.5.10.dist-info → Office365_REST_Python_Client-2.5.11.dist-info}/LICENSE +0 -0
  62. {Office365_REST_Python_Client-2.5.10.dist-info → Office365_REST_Python_Client-2.5.11.dist-info}/top_level.txt +0 -0
@@ -1,3 +1,4 @@
1
+ from office365.directory.policies.admin_consent_request import AdminConsentRequestPolicy
1
2
  from office365.directory.policies.app_management import AppManagementPolicy
2
3
  from office365.directory.policies.authentication_flows import AuthenticationFlowsPolicy
3
4
  from office365.directory.policies.authentication_methods import (
@@ -20,6 +21,19 @@ from office365.runtime.paths.resource_path import ResourcePath
20
21
  class PolicyRoot(Entity):
21
22
  """Resource type exposing navigation properties for the policies singleton."""
22
23
 
24
+ @property
25
+ def admin_consent_request_policy(self):
26
+ """
27
+ The policy by which consent requests are created and managed for the entire tenant.
28
+ """
29
+ return self.properties.get(
30
+ "adminConsentRequestPolicy",
31
+ AdminConsentRequestPolicy(
32
+ self.context,
33
+ ResourcePath("adminConsentRequestPolicy", self.resource_path),
34
+ ),
35
+ )
36
+
23
37
  @property
24
38
  def authentication_methods_policy(self):
25
39
  """
@@ -151,6 +165,7 @@ class PolicyRoot(Entity):
151
165
  def get_property(self, name, default_value=None):
152
166
  if default_value is None:
153
167
  property_mapping = {
168
+ "adminConsentRequestPolicy": self.admin_consent_request_policy,
154
169
  "authenticationStrengthPolicies": self.authentication_strength_policies,
155
170
  "authenticationFlowsPolicy": self.authentication_flows_policy,
156
171
  "appManagementPolicies": self.app_management_policies,
@@ -1,5 +1,8 @@
1
1
  from office365.directory.synchronization.progress import SynchronizationProgress
2
2
  from office365.directory.synchronization.quarantine import SynchronizationQuarantine
3
+ from office365.directory.synchronization.task_execution import (
4
+ SynchronizationTaskExecution,
5
+ )
3
6
  from office365.runtime.client_value import ClientValue
4
7
  from office365.runtime.client_value_collection import ClientValueCollection
5
8
 
@@ -7,10 +10,20 @@ from office365.runtime.client_value_collection import ClientValueCollection
7
10
  class SynchronizationStatus(ClientValue):
8
11
  """Represents the current status of the synchronizationJob."""
9
12
 
10
- def __init__(self, progress=None, quarantine=SynchronizationQuarantine()):
13
+ def __init__(
14
+ self,
15
+ progress=None,
16
+ quarantine=SynchronizationQuarantine(),
17
+ last_execution=SynchronizationTaskExecution(),
18
+ last_successful_execution=SynchronizationTaskExecution(),
19
+ last_successful_execution_with_exports=SynchronizationTaskExecution(),
20
+ ):
11
21
  """
12
22
  :param list[SynchronizationProgress] progress: Details of the progress of a job toward completion.
13
23
  :param SynchronizationQuarantine quarantine:
14
24
  """
15
25
  self.progress = ClientValueCollection(SynchronizationProgress, progress)
16
26
  self.quarantine = quarantine
27
+ self.lastExecution = last_execution
28
+ self.lastSuccessfulExecution = last_successful_execution
29
+ self.lastSuccessfulExecutionWithExports = last_successful_execution_with_exports
@@ -0,0 +1,5 @@
1
+ from office365.runtime.client_value import ClientValue
2
+
3
+
4
+ class SynchronizationTaskExecution(ClientValue):
5
+ """Summarizes the results of the synchronization job run."""
@@ -1,6 +1,6 @@
1
1
  import json
2
2
  from datetime import datetime
3
- from typing import Optional
3
+ from typing import List, Optional
4
4
 
5
5
  from office365.communications.onlinemeetings.collection import OnlineMeetingCollection
6
6
  from office365.communications.presences.presence import Presence
@@ -46,6 +46,7 @@ from office365.outlook.contacts.collection import ContactCollection
46
46
  from office365.outlook.contacts.folder import ContactFolder
47
47
  from office365.outlook.convert_id_result import ConvertIdResult
48
48
  from office365.outlook.mail.folders.collection import MailFolderCollection
49
+ from office365.outlook.mail.item_body import ItemBody
49
50
  from office365.outlook.mail.mailbox_settings import MailboxSettings
50
51
  from office365.outlook.mail.messages.collection import MessageCollection
51
52
  from office365.outlook.mail.messages.message import Message
@@ -201,6 +202,7 @@ class User(DirectoryObject):
201
202
  bcc_recipients=None,
202
203
  save_to_sent_items=False,
203
204
  ):
205
+ # type: (str, str|ItemBody, List[str], List[str], List[str], bool) -> Message
204
206
  """Send a new message on the fly
205
207
 
206
208
  :param str subject: The subject of the message.
@@ -347,7 +349,7 @@ class User(DirectoryObject):
347
349
  start_dt.isoformat(), end_dt.isoformat()
348
350
  )
349
351
 
350
- self.context.add_query(qry).before_execute(_construct_request)
352
+ self.context.add_query(qry).before_query_execute(_construct_request)
351
353
  return return_type
352
354
 
353
355
  def get_reminder_view(self, start_dt, end_dt):
office365/graph_client.py CHANGED
@@ -41,6 +41,7 @@ from office365.directory.users.collection import UserCollection
41
41
  from office365.directory.users.user import User
42
42
  from office365.education.root import EducationRoot
43
43
  from office365.entity_collection import EntityCollection
44
+ from office365.graph_request import GraphRequest
44
45
  from office365.intune.devices.app_management import DeviceAppManagement
45
46
  from office365.intune.devices.collection import DeviceCollection
46
47
  from office365.intune.devices.management.management import DeviceManagement
@@ -58,7 +59,6 @@ from office365.runtime.auth.token_response import TokenResponse
58
59
  from office365.runtime.client_runtime_context import ClientRuntimeContext
59
60
  from office365.runtime.http.http_method import HttpMethod
60
61
  from office365.runtime.http.request_options import RequestOptions
61
- from office365.runtime.odata.request import ODataRequest
62
62
  from office365.runtime.odata.v4.batch_request import ODataV4BatchRequest
63
63
  from office365.runtime.odata.v4.json_format import V4JsonFormat
64
64
  from office365.runtime.paths.resource_path import ResourcePath
@@ -73,31 +73,14 @@ from office365.teams.collection import TeamCollection
73
73
  from office365.teams.template import TeamsTemplate
74
74
  from office365.teams.viva.employee_experience import EmployeeExperience
75
75
 
76
- environments_endpoints = {
77
- "GCCH": {
78
- "graph_url": "https://graph.microsoft.com",
79
- "entra_url": "https://login.microsoftonline.com",
80
- },
81
- "GCC High": {
82
- "graph_url": "https://graph.microsoft.us",
83
- "entra_url": "https://login.microsoftonline.us",
84
- },
85
- "DoD": {
86
- "graph_url": "https://dod-graph.microsoft.us",
87
- "entra_url": "https://login.chinacloudapi.cn",
88
- },
89
- }
90
-
91
76
 
92
77
  class GraphClient(ClientRuntimeContext):
93
78
  """Graph Service client"""
94
79
 
95
- def __init__(self, acquire_token_callback, version="v1.0", environment="GCCH"):
96
- # type: (Callable[[], dict], str, str) -> None
80
+ def __init__(self, acquire_token_callback):
81
+ # type: (Callable[[], dict]) -> None
97
82
  super(GraphClient, self).__init__()
98
83
  self._pending_request = None
99
- self._version = version
100
- self._environment_endpoints = environments_endpoints.get(environment, None)
101
84
  self._acquire_token_callback = acquire_token_callback
102
85
 
103
86
  @staticmethod
@@ -127,7 +110,7 @@ class GraphClient(ClientRuntimeContext):
127
110
  "thumbprint": thumbprint,
128
111
  "private_key": private_key,
129
112
  },
130
- token_cache=token_cache # Default cache is in memory only.
113
+ token_cache=token_cache, # Default cache is in memory only.
131
114
  # You can learn how to use SerializableTokenCache from
132
115
  # https://msal-python.readthedocs.io/en/latest/#msal.SerializableTokenCache
133
116
  )
@@ -259,16 +242,16 @@ class GraphClient(ClientRuntimeContext):
259
242
  return self
260
243
 
261
244
  def pending_request(self):
262
- # type: () -> ODataRequest
245
+ # type: () -> GraphRequest
263
246
  if self._pending_request is None:
264
- self._pending_request = ODataRequest(V4JsonFormat())
247
+ self._pending_request = GraphRequest()
265
248
  self._pending_request.beforeExecute += self._authenticate_request
266
249
  self._pending_request.beforeExecute += self._build_specific_query
267
250
  return self._pending_request
268
251
 
269
252
  def service_root_url(self):
270
253
  # type: () -> str
271
- return "https://graph.microsoft.com/{0}".format(self._version)
254
+ return self.pending_request().service_root_url
272
255
 
273
256
  def _build_specific_query(self, request):
274
257
  # type: (RequestOptions) -> None
@@ -1,7 +1,30 @@
1
1
  from office365.runtime.odata.request import ODataRequest
2
2
  from office365.runtime.odata.v4.json_format import V4JsonFormat
3
3
 
4
+ environments_endpoints = {
5
+ "GCCH": {
6
+ "graph_url": "https://graph.microsoft.com",
7
+ "entra_url": "https://login.microsoftonline.com",
8
+ },
9
+ "GCC High": {
10
+ "graph_url": "https://graph.microsoft.us",
11
+ "entra_url": "https://login.microsoftonline.us",
12
+ },
13
+ "DoD": {
14
+ "graph_url": "https://dod-graph.microsoft.us",
15
+ "entra_url": "https://login.chinacloudapi.cn",
16
+ },
17
+ }
18
+
4
19
 
5
20
  class GraphRequest(ODataRequest):
6
- def __init__(self):
21
+ def __init__(self, version="v1.0", environment="GCCH"):
22
+ # type: (str, str) -> None
7
23
  super(GraphRequest, self).__init__(V4JsonFormat())
24
+ self._version = version
25
+ self._environment_endpoints = environments_endpoints.get(environment, None)
26
+
27
+ @property
28
+ def service_root_url(self):
29
+ # type: () -> str
30
+ return "https://graph.microsoft.com/{0}".format(self._version)
@@ -469,6 +469,7 @@ class DriveItem(BaseItem):
469
469
  return self.get_content(format_name)
470
470
 
471
471
  def copy(self, name=None, parent=None, conflict_behavior=ConflictBehavior.Fail):
472
+ # type: (str, ItemReference|"DriveItem", str) -> ClientResult[str]
472
473
  """Asynchronously creates a copy of an driveItem (including any children), under a new parent item or with a
473
474
  new name.
474
475
 
@@ -480,32 +481,30 @@ class DriveItem(BaseItem):
480
481
 
481
482
  Returns location for details about how to monitor the progress of the copy, upon accepting the request.
482
483
  """
483
- return_type = ClientResult(self.context) # type: ClientResult[str]
484
+ return_type = ClientResult(self.context, str())
484
485
 
485
- def _create_request(request):
486
- # type: (RequestOptions) -> None
487
- request.url += "?@microsoft.graph.conflictBehavior={0}".format(
488
- conflict_behavior
489
- )
486
+ def _copy(parent_reference):
487
+ # type: (ItemReference) -> None
488
+
489
+ def _create_request(request):
490
+ # type: (RequestOptions) -> None
491
+ request.url += "?@microsoft.graph.conflictBehavior={0}".format(
492
+ conflict_behavior
493
+ )
494
+
495
+ def _process_response(resp):
496
+ # type: (requests.Response) -> None
497
+ resp.raise_for_status()
498
+ location = resp.headers.get("Location", None)
499
+ if location is None:
500
+ return
501
+ return_type.set_property("__value", location)
490
502
 
491
- def _process_response(resp):
492
- # type: (requests.Response) -> None
493
- resp.raise_for_status()
494
- location = resp.headers.get("Location", None)
495
- if location is None:
496
- return
497
- return_type.set_property("__value", location)
498
-
499
- def _create_and_add_query(parent_reference):
500
- """
501
- :param office365.onedrive.listitems.item_reference.ItemReference or None parent_reference: Reference to the
502
- parent item the copy will be created in.
503
- """
504
503
  payload = {"name": name, "parentReference": parent_reference}
505
- self.context.before_execute(_create_request)
506
- self.context.after_execute(_process_response)
507
504
  qry = ServiceOperationQuery(self, "copy", None, payload, None, return_type)
508
- self.context.add_query(qry)
505
+ self.context.add_query(qry).before_query_execute(
506
+ _create_request
507
+ ).after_execute(_process_response)
509
508
 
510
509
  if isinstance(parent, DriveItem):
511
510
 
@@ -513,14 +512,15 @@ class DriveItem(BaseItem):
513
512
  parent_reference = ItemReference(
514
513
  drive_id=parent.parent_reference.driveId, _id=parent.id
515
514
  )
516
- _create_and_add_query(parent_reference)
515
+ _copy(parent_reference)
517
516
 
518
517
  parent.ensure_property("parentReference", _drive_item_loaded)
519
518
  else:
520
- _create_and_add_query(parent)
519
+ _copy(parent)
521
520
  return return_type
522
521
 
523
- def move(self, name=None, parent=None):
522
+ def move(self, name=None, parent=None, conflict_behavior=ConflictBehavior.Fail):
523
+ # type: (str, ItemReference|"DriveItem", str) -> "DriveItem"
524
524
  """To move a DriveItem to a new parent item, your app requests to update the parentReference of the DriveItem
525
525
  to move.
526
526
 
@@ -528,29 +528,34 @@ class DriveItem(BaseItem):
528
528
  original.
529
529
  :param ItemReference or DriveItem or None parent: Reference to the
530
530
  parent item the move will be created in.
531
+ :param str conflict_behavior: query parameter to customize the behavior when a conflict occurs.
531
532
  """
532
533
 
533
- return_type = ClientResult(self.context, str())
534
+ return_type = DriveItem(self.context)
535
+ self.children.add_child(return_type)
534
536
 
535
- def _create_and_add_query(parent_reference):
537
+ def _move(parent_reference):
538
+ # type: (ItemReference) -> None
536
539
  payload = {"name": name, "parentReference": parent_reference}
537
540
 
538
541
  def _construct_request(request):
539
542
  # type: (RequestOptions) -> None
540
543
  request.method = HttpMethod.Patch
544
+ request.url += "?@microsoft.graph.conflictBehavior={0}".format(
545
+ conflict_behavior
546
+ )
541
547
 
542
- self.context.before_execute(_construct_request)
543
- qry = ServiceOperationQuery(self, "move", None, payload, None, return_type)
544
- self.context.add_query(qry)
548
+ qry = ServiceOperationQuery(self, "", None, payload, None, return_type)
549
+ self.context.add_query(qry).before_execute(_construct_request)
545
550
 
546
551
  if isinstance(parent, DriveItem):
547
552
 
548
553
  def _drive_item_loaded():
549
- _create_and_add_query(ItemReference(_id=parent.id))
554
+ _move(ItemReference(_id=parent.id))
550
555
 
551
556
  parent.ensure_property("parentReference", _drive_item_loaded)
552
557
  else:
553
- _create_and_add_query(parent)
558
+ _move(parent)
554
559
  return return_type
555
560
 
556
561
  def rename(self, new_name):
@@ -618,9 +623,9 @@ class DriveItem(BaseItem):
618
623
  DriveRecipient, [DriveRecipient.from_email(r) for r in recipients]
619
624
  ),
620
625
  "message": message,
621
- "expirationDateTime": expiration_datetime.isoformat() + "Z"
622
- if expiration_datetime
623
- else None,
626
+ "expirationDateTime": (
627
+ expiration_datetime.isoformat() + "Z" if expiration_datetime else None
628
+ ),
624
629
  "password": password,
625
630
  "retainInheritedPermissions": retain_inherited_permissions,
626
631
  }
@@ -662,7 +667,7 @@ class DriveItem(BaseItem):
662
667
  return self
663
668
 
664
669
  def restore(self, parent_reference=None, name=None):
665
- # type: (ItemReference or None, str or None) -> DriveItem
670
+ # type: (Optional[ItemReference], str) -> "DriveItem"
666
671
  """
667
672
  Restore a driveItem that has been deleted and is currently in the recycle bin.
668
673
  NOTE: This functionality is currently only available for OneDrive Personal.
@@ -910,8 +915,6 @@ class DriveItem(BaseItem):
910
915
 
911
916
  def set_property(self, name, value, persist_changes=True):
912
917
  super(DriveItem, self).set_property(name, value, persist_changes)
913
- if name == "parentReference":
914
- pass
915
918
  return self
916
919
 
917
920
  def get_property(self, name, default_value=None):
@@ -38,6 +38,7 @@ class ListItem(BaseItem):
38
38
 
39
39
  @property
40
40
  def versions(self):
41
+ # type: () -> EntityCollection[ListItemVersion]
41
42
  """The list of previous versions of the list item."""
42
43
  return self.properties.get(
43
44
  "versions",
@@ -26,3 +26,9 @@ class ListCollection(EntityCollection[List]):
26
26
  qry = CreateEntityQuery(self, payload, return_type)
27
27
  self.context.add_query(qry)
28
28
  return return_type
29
+
30
+ def get_by_name(self, name):
31
+ return List(self.context, EntityPath(name, self.resource_path))
32
+
33
+ def get_by_id(self, list_id):
34
+ return List(self.context, EntityPath(list_id, self.resource_path))
@@ -5,13 +5,30 @@ class SharePointIds(ClientValue):
5
5
  """The SharePointIds resource groups the various identifiers for an item stored in a SharePoint site or OneDrive
6
6
  for Business into a single structure."""
7
7
 
8
- def __init__(self, list_id=None, list_item_id=None, list_item_unique_id=None):
8
+ def __init__(
9
+ self,
10
+ list_id=None,
11
+ list_item_id=None,
12
+ list_item_unique_id=None,
13
+ siteId=None,
14
+ siteUrl=None,
15
+ tenantId=None,
16
+ webId=None,
17
+ ):
9
18
  """
10
19
  :param str list_id: The unique identifier (guid) for the item's list in SharePoint.
11
20
  :param str list_item_id: An integer identifier for the item within the containing list.
12
21
  :param str list_item_unique_id: The unique identifier (guid) for the item within OneDrive for Business
13
22
  or a SharePoint site.
23
+ :param str siteId: The unique identifier (guid) for the item's site collection (SPSite).
24
+ :param str siteUrl: The SharePoint URL for the site that contains the item.
25
+ :param str tenantId: The unique identifier (guid) for the tenancy.
26
+ :param str webId: The unique identifier (guid) for the item's site (SPWeb).
14
27
  """
15
28
  self.listId = list_id
16
29
  self.listItemId = list_item_id
17
30
  self.listItemUniqueId = list_item_unique_id
31
+ self.siteId = siteId
32
+ self.siteUrl = siteUrl
33
+ self.tenantId = tenantId
34
+ self.webId = webId
@@ -8,7 +8,6 @@ from office365.onedrive.lists.list import List
8
8
  from office365.onedrive.permissions.permission import Permission
9
9
  from office365.onedrive.sites.site import Site
10
10
  from office365.runtime.paths.resource_path import ResourcePath
11
- from office365.runtime.paths.v4.entity import EntityPath
12
11
 
13
12
 
14
13
  class SharedDriveItem(BaseItem):
@@ -48,7 +47,7 @@ class SharedDriveItem(BaseItem):
48
47
  """Used to access the underlying driveItem"""
49
48
  return self.properties.get(
50
49
  "driveItem",
51
- DriveItem(self.context, EntityPath("driveItem", self.resource_path)),
50
+ DriveItem(self.context, ResourcePath("driveItem", self.resource_path)),
52
51
  )
53
52
 
54
53
  @property
File without changes
@@ -0,0 +1,5 @@
1
+ from office365.entity import Entity
2
+
3
+
4
+ class Storage(Entity):
5
+ """Facilitates the structures of fileStorageContainers."""
@@ -2,11 +2,18 @@ from typing import Optional
2
2
 
3
3
  from office365.entity import Entity
4
4
  from office365.onedrive.workbooks.filter_criteria import WorkbookFilterCriteria
5
+ from office365.runtime.queries.service_operation import ServiceOperationQuery
5
6
 
6
7
 
7
8
  class WorkbookFilter(Entity):
8
9
  """Manages the filtering of a table's column."""
9
10
 
11
+ def clear(self):
12
+ """Clear the filter on the given column."""
13
+ qry = ServiceOperationQuery(self, "clear")
14
+ self.context.add_query(qry)
15
+ return self
16
+
10
17
  @property
11
18
  def criteria(self):
12
19
  # type: () -> Optional[WorkbookFilterCriteria]
@@ -4,7 +4,14 @@ from office365.runtime.client_value import ClientValue
4
4
  class WorkbookFilterCriteria(ClientValue):
5
5
  """Represents the filtering criteria applied to a column."""
6
6
 
7
- def __init__(self, operator=None, values=None):
8
- """ """
7
+ def __init__(self, color=None, dynamicCriteria=None, operator=None, values=None):
8
+ """
9
+ :param str color: The color applied to the cell.
10
+ :param str dynamicCriteria: A dynamic formula specified in a custom filter.
11
+ :param str operator: An operator in a cell; for example, =, >, <, <=, or <>.
12
+ :param list values: The values that appear in the cell.
13
+ """
14
+ self.color = color
15
+ self.dynamicCriteria = dynamicCriteria
9
16
  self.operator = operator
10
17
  self.values = values
@@ -1,5 +1,7 @@
1
1
  from office365.entity_collection import EntityCollection
2
2
  from office365.onedrive.workbooks.tables.rows.row import WorkbookTableRow
3
+ from office365.runtime.client_result import ClientResult
4
+ from office365.runtime.queries.function import FunctionQuery
3
5
 
4
6
 
5
7
  class WorkbookTableRowCollection(EntityCollection[WorkbookTableRow]):
@@ -25,3 +27,21 @@ class WorkbookTableRowCollection(EntityCollection[WorkbookTableRow]):
25
27
  Any rows below the inserted row are shifted downwards. Zero-indexed.
26
28
  """
27
29
  return super(WorkbookTableRowCollection, self).add(values=values, index=index)
30
+
31
+ def count(self):
32
+ """"""
33
+ return_type = ClientResult(self.context, int())
34
+ qry = FunctionQuery(self, "count", None, return_type)
35
+ self.context.add_query(qry)
36
+ return return_type
37
+
38
+ def item_at(self, index):
39
+ # type: (int) -> WorkbookTableRow
40
+ """Gets a row based on its position in the collection.
41
+ :param int index: Index value of the object to be retrieved. Zero-indexed.
42
+ """
43
+ return_type = WorkbookTableRow(self.context)
44
+ self.add_child(return_type)
45
+ qry = FunctionQuery(self, "itemAt", [index], return_type)
46
+ self.context.add_query(qry)
47
+ return return_type
@@ -1,4 +1,4 @@
1
- from typing import Optional
1
+ from typing import List, Optional
2
2
 
3
3
  from office365.entity import Entity
4
4
 
@@ -14,6 +14,7 @@ class WorkbookTableRow(Entity):
14
14
 
15
15
  @property
16
16
  def values(self):
17
+ # type: () -> Optional[List]
17
18
  """
18
19
  Represents the raw values of the specified range. The data returned could be of type string, number,
19
20
  or a boolean. Cell that contain an error will return the error string.
@@ -1,3 +1,5 @@
1
+ from typing_extensions import Self
2
+
1
3
  from office365.entity import Entity
2
4
  from office365.entity_collection import EntityCollection
3
5
  from office365.onedrive.workbooks.applications.application import WorkbookApplication
@@ -50,20 +52,21 @@ class Workbook(Entity):
50
52
  return return_type
51
53
 
52
54
  def refresh_session(self, session_id):
55
+ # type: (str) -> Self
53
56
  """Use this API to refresh an existing workbook session.
54
57
  :param str session_id: Identifier of the workbook session
55
58
  """
56
- qry = ServiceOperationQuery(self, "refreshSession")
57
- self.context.add_query(qry)
58
59
 
59
60
  def _construct_request(request):
60
61
  # type: (RequestOptions) -> None
61
62
  request.set_header("workbook-session-id", session_id)
62
63
 
63
- self.context.before_execute(_construct_request)
64
+ qry = ServiceOperationQuery(self, "refreshSession")
65
+ self.context.add_query(qry).before_query_execute(_construct_request)
64
66
  return self
65
67
 
66
68
  def close_session(self, session_id):
69
+ # type: (str) -> Self
67
70
  """Use this API to close an existing workbook session.
68
71
  :param str session_id: Identifier of the workbook session
69
72
  """
@@ -73,8 +76,7 @@ class Workbook(Entity):
73
76
  # type: (RequestOptions) -> None
74
77
  request.set_header("workbook-session-id", session_id)
75
78
 
76
- self.context.before_execute(_construct_request)
77
- self.context.add_query(qry)
79
+ self.context.add_query(qry).before_query_execute(_construct_request)
78
80
  return self
79
81
 
80
82
  @property
@@ -3,6 +3,7 @@ from typing import AnyStr
3
3
 
4
4
  from office365.runtime.compat import get_mime_type, message_as_bytes_or_string
5
5
  from office365.runtime.http.http_method import HttpMethod
6
+ from office365.runtime.http.request_options import RequestOptions
6
7
  from office365.runtime.queries.batch import create_boundary
7
8
  from office365.runtime.queries.client_query import ClientQuery
8
9
 
@@ -32,9 +33,7 @@ class OneNotePageCreateQuery(ClientQuery):
32
33
  self._files = attachment_files
33
34
 
34
35
  def _construct_multipart_request(self, request):
35
- """
36
- :type request: office365.runtime.http.request_options.RequestOptions
37
- """
36
+ # type: (RequestOptions) -> None
38
37
  request.method = HttpMethod.Post
39
38
  boundary = create_boundary("PageBoundary", True)
40
39
  request.set_header(
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.entity import Entity
2
4
 
3
5
 
@@ -6,13 +8,18 @@ class OutlookCategory(Entity):
6
8
  The user defines categories in a master list, and can apply one or more
7
9
  of these user-defined categories to an item."""
8
10
 
11
+ def __str__(self):
12
+ return self.display_name or self.entity_type_name
13
+
9
14
  @property
10
15
  def color(self):
16
+ # type: () -> Optional[str]
11
17
  """A pre-set color constant that characterizes a category, and that is mapped to one of 25 predefined colors"""
12
18
  return self.properties.get("color", None)
13
19
 
14
20
  @property
15
21
  def display_name(self):
22
+ # type: () -> Optional[str]
16
23
  """A unique name that identifies a category in the user's mailbox.
17
24
  After a category is created, the name cannot be changed"""
18
25
  return self.properties.get("displayName", None)
@@ -6,7 +6,6 @@ class ItemBody(ClientValue):
6
6
 
7
7
  def __init__(self, content=None, content_type="Text"):
8
8
  """
9
-
10
9
  :param str content: The content of the item.
11
10
  :param str content_type: The type of the content. Possible values are text and html.
12
11
  """
@@ -14,5 +13,15 @@ class ItemBody(ClientValue):
14
13
  self.content = content
15
14
  self.contentType = content_type
16
15
 
16
+ @staticmethod
17
+ def text(content):
18
+ # type: (str) -> "ItemBody"
19
+ return ItemBody(content)
20
+
21
+ @staticmethod
22
+ def html(content):
23
+ # type: (str) -> "ItemBody"
24
+ return ItemBody(content, "html")
25
+
17
26
  def __repr__(self):
18
27
  return self.content
@@ -1,3 +1,5 @@
1
+ from typing import List
2
+
1
3
  from office365.delta_collection import DeltaCollection
2
4
  from office365.outlook.mail.item_body import ItemBody
3
5
  from office365.outlook.mail.messages.message import Message
@@ -10,6 +12,7 @@ class MessageCollection(DeltaCollection[Message]):
10
12
  super(MessageCollection, self).__init__(context, Message, resource_path)
11
13
 
12
14
  def add(self, subject=None, body=None, to_recipients=None, **kwargs):
15
+ # type: (str, str|ItemBody, List[str], ...) -> Message
13
16
  """
14
17
  Create a draft of a new message in either JSON or MIME format.
15
18