Office365-REST-Python-Client 2.5.2__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.
Files changed (124) hide show
  1. {Office365_REST_Python_Client-2.5.2.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/METADATA +4 -4
  2. {Office365_REST_Python_Client-2.5.2.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/RECORD +122 -119
  3. office365/base_item.py +12 -20
  4. office365/communications/presences/presence.py +18 -7
  5. office365/delta_path.py +1 -1
  6. office365/directory/administrative_unit.py +6 -7
  7. office365/directory/applications/application.py +15 -13
  8. office365/directory/audit/signins/signin.py +8 -12
  9. office365/directory/authentication/methods/details.py +8 -6
  10. office365/directory/groups/lifecycle_policy.py +8 -7
  11. office365/directory/identities/provider.py +5 -6
  12. office365/directory/internal/paths/me.py +1 -1
  13. office365/directory/permissions/email_identity.py +7 -0
  14. office365/directory/rolemanagement/role.py +5 -4
  15. office365/directory/rolemanagement/template.py +2 -6
  16. office365/directory/rolemanagement/unified_role_assignment.py +5 -4
  17. office365/directory/rolemanagement/unified_role_definition.py +6 -4
  18. office365/directory/serviceprincipals/service_principal.py +11 -6
  19. office365/directory/users/user.py +8 -11
  20. office365/entity.py +2 -2
  21. office365/entity_collection.py +11 -4
  22. office365/intune/devices/enrollment/configuration.py +6 -4
  23. office365/intune/devices/managed.py +9 -12
  24. office365/onedrive/analytics/item_activity_stat.py +4 -3
  25. office365/onedrive/columns/definition.py +9 -9
  26. office365/onedrive/documentsets/version.py +1 -3
  27. office365/onedrive/driveitems/driveItem.py +30 -29
  28. office365/onedrive/internal/paths/children.py +2 -2
  29. office365/onedrive/internal/paths/root.py +1 -1
  30. office365/onedrive/internal/paths/shared.py +1 -1
  31. office365/onedrive/internal/paths/site.py +3 -3
  32. office365/onedrive/internal/paths/url.py +2 -2
  33. office365/onedrive/listitems/list_item.py +2 -0
  34. office365/onedrive/lists/list.py +7 -4
  35. office365/onedrive/permissions/collection.py +26 -6
  36. office365/onedrive/sharepoint.py +1 -0
  37. office365/onedrive/shares/collection.py +2 -5
  38. office365/onedrive/shares/drive_item.py +3 -0
  39. office365/onedrive/termstore/groups/collection.py +3 -8
  40. office365/onedrive/termstore/groups/group.py +8 -0
  41. office365/onedrive/termstore/sets/collection.py +2 -6
  42. office365/onedrive/termstore/sets/name.py +5 -0
  43. office365/onedrive/termstore/sets/set.py +7 -0
  44. office365/onedrive/termstore/store.py +10 -13
  45. office365/onedrive/versions/drive_item.py +3 -1
  46. office365/onedrive/workbooks/ranges/range.py +9 -13
  47. office365/onedrive/workbooks/ranges/view.py +1 -0
  48. office365/onedrive/workbooks/tables/table.py +1 -3
  49. office365/onedrive/workbooks/worksheets/worksheet.py +5 -3
  50. office365/onenote/pages/collection.py +3 -2
  51. office365/onenote/resources/resource.py +5 -4
  52. office365/onenote/sectiongroups/section_group.py +10 -7
  53. office365/outlook/calendar/calendar.py +1 -1
  54. office365/outlook/calendar/schedule/information.py +0 -1
  55. office365/outlook/contacts/contact.py +3 -9
  56. office365/outlook/contacts/folder.py +3 -0
  57. office365/outlook/mail/messages/message.py +25 -18
  58. office365/outlook/mail/recipient.py +3 -1
  59. office365/runtime/auth/authentication_context.py +2 -2
  60. office365/runtime/auth/providers/acs_token_provider.py +7 -9
  61. office365/runtime/client_object.py +3 -11
  62. office365/runtime/client_object_collection.py +22 -20
  63. office365/runtime/client_result.py +1 -3
  64. office365/runtime/client_value_collection.py +2 -6
  65. office365/runtime/odata/query_options.py +1 -3
  66. office365/runtime/odata/type.py +2 -0
  67. office365/runtime/paths/appid.py +1 -1
  68. office365/runtime/{odata/url_builder.py → paths/builder.py} +24 -9
  69. office365/runtime/paths/item.py +1 -1
  70. office365/runtime/paths/resource_path.py +12 -16
  71. office365/runtime/paths/service_operation.py +8 -7
  72. office365/runtime/paths/v3/__init__.py +0 -0
  73. office365/runtime/paths/{key.py → v3/entity.py} +5 -5
  74. office365/runtime/paths/v4/__init__.py +0 -0
  75. office365/runtime/paths/{entity.py → v4/entity.py} +13 -11
  76. office365/sharepoint/contenttypes/content_type.py +6 -0
  77. office365/sharepoint/documentmanagement/document_set.py +4 -6
  78. office365/sharepoint/entity_collection.py +9 -0
  79. office365/sharepoint/features/feature.py +6 -8
  80. office365/sharepoint/files/checked_out_file.py +4 -2
  81. office365/sharepoint/files/checked_out_file_collection.py +1 -1
  82. office365/sharepoint/files/collection.py +35 -3
  83. office365/sharepoint/files/file.py +35 -11
  84. office365/sharepoint/files/versions/collection.py +4 -0
  85. office365/sharepoint/files/versions/event.py +6 -3
  86. office365/sharepoint/files/versions/version.py +6 -4
  87. office365/sharepoint/folders/collection.py +2 -2
  88. office365/sharepoint/folders/folder.py +5 -11
  89. office365/sharepoint/internal/paths/static_operation.py +9 -0
  90. office365/sharepoint/internal/paths/web.py +20 -0
  91. office365/sharepoint/listitems/collection.py +4 -0
  92. office365/sharepoint/listitems/listitem.py +19 -30
  93. office365/sharepoint/lists/list.py +44 -60
  94. office365/sharepoint/portal/groups/service.py +12 -16
  95. office365/sharepoint/portal/groups/site_manager.py +0 -1
  96. office365/sharepoint/publishing/pages/metadata.py +7 -2
  97. office365/sharepoint/publishing/pages/metadata_collection.py +0 -1
  98. office365/sharepoint/publishing/pages/page.py +3 -6
  99. office365/sharepoint/publishing/pages/reposts/repost.py +5 -9
  100. office365/sharepoint/recyclebin/item.py +11 -9
  101. office365/sharepoint/sharing/links/share_response.py +3 -0
  102. office365/sharepoint/sharing/result.py +18 -41
  103. office365/sharepoint/sites/site.py +46 -68
  104. office365/sharepoint/taxonomy/item.py +4 -2
  105. office365/sharepoint/taxonomy/stores/store.py +2 -6
  106. office365/sharepoint/tenant/administration/internal/permission_grant.py +7 -0
  107. office365/sharepoint/tenant/administration/sites/properties.py +55 -44
  108. office365/sharepoint/tenant/administration/tenant.py +25 -40
  109. office365/sharepoint/usercustomactions/collection.py +0 -1
  110. office365/sharepoint/webs/collection.py +8 -0
  111. office365/sharepoint/webs/template_collection.py +2 -4
  112. office365/sharepoint/webs/web.py +27 -24
  113. office365/teams/apps/app.py +1 -0
  114. office365/teams/collection.py +12 -16
  115. office365/teams/members/conversation_collection.py +1 -3
  116. office365/teams/operations/async_operation.py +3 -5
  117. office365/teams/schedule/groups/group.py +3 -0
  118. office365/teams/team.py +1 -1
  119. office365/todo/attachments/base.py +7 -9
  120. office365/runtime/odata/path_builder.py +0 -23
  121. office365/sharepoint/internal/key_value.py +0 -28
  122. {Office365_REST_Python_Client-2.5.2.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/LICENSE +0 -0
  123. {Office365_REST_Python_Client-2.5.2.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/WHEEL +0 -0
  124. {Office365_REST_Python_Client-2.5.2.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/top_level.txt +0 -0
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.entity import Entity
2
4
  from office365.onedrive.termstore.sets.collection import SetCollection
3
5
  from office365.runtime.paths.resource_path import ResourcePath
@@ -6,18 +8,24 @@ from office365.runtime.paths.resource_path import ResourcePath
6
8
  class Group(Entity):
7
9
  """Term Group"""
8
10
 
11
+ def __str__(self):
12
+ return self.display_name
13
+
9
14
  @property
10
15
  def display_name(self):
16
+ # type: () -> Optional[str]
11
17
  """Name of the group."""
12
18
  return self.properties.get("displayName", None)
13
19
 
14
20
  @property
15
21
  def parent_site_id(self):
22
+ # type: () -> Optional[str]
16
23
  """ID of the parent site of this group."""
17
24
  return self.properties.get("parentSiteId", None)
18
25
 
19
26
  @property
20
27
  def sets(self):
28
+ # type: () -> SetCollection
21
29
  """Collection of all sets available in the term store."""
22
30
  return self.properties.get(
23
31
  "sets",
@@ -14,12 +14,8 @@ class SetCollection(EntityCollection[Set]):
14
14
  self._parent_group = parent_group
15
15
 
16
16
  def get_by_name(self, name):
17
- """
18
- Returns the TermSet specified by its name.
19
-
20
- :param str name: Term set name
21
- :rtype: Set
22
- """
17
+ # type: (str) -> Set
18
+ """Returns the TermSet specified by its name."""
23
19
  return self.single("displayName eq '{0}'".format(name))
24
20
 
25
21
  def add(self, name, parent_group=None):
@@ -1,3 +1,5 @@
1
+ import json
2
+
1
3
  from office365.runtime.client_value import ClientValue
2
4
 
3
5
 
@@ -15,3 +17,6 @@ class LocalizedName(ClientValue):
15
17
  super(LocalizedName, self).__init__()
16
18
  self.name = name
17
19
  self.languageTag = language_tag
20
+
21
+ def __repr__(self):
22
+ return json.dumps(self.to_json())
@@ -14,8 +14,12 @@ class Set(Entity):
14
14
  terms. A group can contain multiple sets.
15
15
  """
16
16
 
17
+ def __repr__(self):
18
+ return repr(self.localized_names)
19
+
17
20
  @property
18
21
  def children(self):
22
+ # type: () -> TermCollection
19
23
  """Children terms of set in term store."""
20
24
  return self.properties.get(
21
25
  "children",
@@ -28,6 +32,7 @@ class Set(Entity):
28
32
 
29
33
  @property
30
34
  def localized_names(self):
35
+ # type: () -> ClientValueCollection[LocalizedName]
31
36
  """"""
32
37
  return self.properties.get(
33
38
  "localizedNames", ClientValueCollection(LocalizedName)
@@ -45,6 +50,7 @@ class Set(Entity):
45
50
 
46
51
  @property
47
52
  def relations(self):
53
+ # type: () -> EntityCollection[Relation]
48
54
  """Indicates which terms have been pinned or reused directly under the set."""
49
55
  return self.properties.get(
50
56
  "relations",
@@ -55,6 +61,7 @@ class Set(Entity):
55
61
 
56
62
  @property
57
63
  def terms(self):
64
+ # type: () -> TermCollection
58
65
  """All the terms under the set."""
59
66
  return self.properties.get(
60
67
  "terms",
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.entity import Entity
2
4
  from office365.entity_collection import EntityCollection
3
5
  from office365.onedrive.termstore.groups.collection import GroupCollection
@@ -15,17 +17,13 @@ class Store(Entity):
15
17
  """Returns a collection containing a flat list of all TermSet objects."""
16
18
  return_type = EntityCollection(self.context, Set)
17
19
 
18
- def _sets_loaded(group_sets):
19
- """
20
- :type group_sets: EntityCollection
21
- """
22
- [return_type.add_child(s) for s in group_sets]
20
+ def _sets_loaded(sets):
21
+ # type: (SetCollection) -> None
22
+ [return_type.add_child(s) for s in sets]
23
23
 
24
24
  def _groups_loaded(groups):
25
- """
26
- :type groups: EntityCollection
27
- """
28
- for g in groups: # type: Group
25
+ # type: (GroupCollection) -> None
26
+ for g in groups:
29
27
  self.context.load(g.sets, after_loaded=_sets_loaded)
30
28
 
31
29
  self.context.load(self.groups, after_loaded=_groups_loaded)
@@ -34,10 +32,8 @@ class Store(Entity):
34
32
 
35
33
  @property
36
34
  def default_language_tag(self):
37
- """Default language of the term store.
38
-
39
- :rtype: str
40
- """
35
+ # type: () -> Optional[str]
36
+ """Default language of the term store."""
41
37
  return self.properties.get("defaultLanguageTag", None)
42
38
 
43
39
  @property
@@ -47,6 +43,7 @@ class Store(Entity):
47
43
 
48
44
  @property
49
45
  def groups(self):
46
+ # type: () -> GroupCollection
50
47
  """Collection of all groups available in the term store."""
51
48
  return self.properties.get(
52
49
  "groups",
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.onedrive.versions.base_item import BaseItemVersion
2
4
  from office365.runtime.queries.service_operation import ServiceOperationQuery
3
5
 
@@ -23,8 +25,8 @@ class DriveItemVersion(BaseItemVersion):
23
25
 
24
26
  @property
25
27
  def size(self):
28
+ # type: () -> Optional[int]
26
29
  """
27
30
  Indicates the size of the content stream for this version of the item.
28
- :rtype: int
29
31
  """
30
32
  return self.properties.get("size", None)
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.entity import Entity
2
4
  from office365.onedrive.workbooks.ranges.format import WorkbookRangeFormat
3
5
  from office365.onedrive.workbooks.ranges.sort import WorkbookRangeSort
@@ -18,35 +20,29 @@ class WorkbookRange(Entity):
18
20
 
19
21
  @property
20
22
  def address(self):
23
+ # type: () -> Optional[str]
21
24
  """
22
25
  Represents the range reference in A1-style. Address value will contain the Sheet reference
23
26
  (e.g. Sheet1!A1:B4)
24
- :rtype: str or None
25
27
  """
26
28
  return self.properties.get("address", None)
27
29
 
28
30
  @property
29
31
  def address_local(self):
30
- """
31
- Represents range reference for the specified range in the language of the user. Read-only.
32
- :rtype: str or None
33
- """
32
+ # type: () -> Optional[str]
33
+ """Represents range reference for the specified range in the language of the user."""
34
34
  return self.properties.get("addressLocal", None)
35
35
 
36
36
  @property
37
37
  def cell_count(self):
38
- """
39
- Number of cells in the range. Read-only.
40
- :rtype: int or None
41
- """
38
+ # type: () -> Optional[int]
39
+ """Number of cells in the range. Read-only."""
42
40
  return self.properties.get("cellCount", None)
43
41
 
44
42
  @property
45
43
  def column_count(self):
46
- """
47
- Represents the total number of columns in the range. Read-only.
48
- :rtype: int or None
49
- """
44
+ # type: () -> Optional[int]
45
+ """Represents the total number of columns in the range. Read-only."""
50
46
  return self.properties.get("columnCount", None)
51
47
 
52
48
  @property
@@ -8,6 +8,7 @@ class WorkbookRangeView(Entity):
8
8
 
9
9
  @property
10
10
  def rows(self):
11
+ # type: () -> EntityCollection[WorkbookRangeView]
11
12
  """Represents a collection of range views associated with the range."""
12
13
  return self.properties.get(
13
14
  "rows",
@@ -71,9 +71,7 @@ class WorkbookTable(Entity):
71
71
  @property
72
72
  def rows(self):
73
73
  # type: () -> WorkbookTableRowCollection
74
- """
75
- Represents a collection of all the rows in the table.
76
- """
74
+ """Represents a collection of all the rows in the table."""
77
75
  return self.properties.get(
78
76
  "rows",
79
77
  WorkbookTableRowCollection(
@@ -20,8 +20,12 @@ class WorkbookWorksheet(Entity):
20
20
  def __repr__(self):
21
21
  return self.name
22
22
 
23
+ def __str__(self):
24
+ return self.name
25
+
23
26
  @property
24
27
  def charts(self):
28
+ # type: () -> EntityCollection[WorkbookChart]
25
29
  """Returns collection of charts that are part of the worksheet"""
26
30
  return self.properties.get(
27
31
  "charts",
@@ -33,9 +37,7 @@ class WorkbookWorksheet(Entity):
33
37
  @property
34
38
  def name(self):
35
39
  # type: () -> Optional[str]
36
- """
37
- The display name of the worksheet.
38
- """
40
+ """The display name of the worksheet."""
39
41
  return self.properties.get("name", None)
40
42
 
41
43
  @property
@@ -1,3 +1,5 @@
1
+ from typing import IO
2
+
1
3
  from office365.entity_collection import EntityCollection
2
4
  from office365.onenote.internal.multipart_page_query import OneNotePageCreateQuery
3
5
  from office365.onenote.pages.page import OnenotePage
@@ -10,12 +12,11 @@ class OnenotePageCollection(EntityCollection[OnenotePage]):
10
12
  super(OnenotePageCollection, self).__init__(context, OnenotePage, resource_path)
11
13
 
12
14
  def add(self, presentation_file, attachment_files=None):
15
+ # type: (IO, dict) -> OnenotePage
13
16
  """
14
17
  Create a new OneNote page.
15
-
16
18
  :param typing.IO presentation_file: Presentation file
17
19
  :param dict or None attachment_files: Attachment files
18
- :rtype: OnenotePage
19
20
  """
20
21
  qry = OneNotePageCreateQuery(self, presentation_file, attachment_files)
21
22
  self.context.add_query(qry)
@@ -1,3 +1,5 @@
1
+ from typing import AnyStr, Optional
2
+
1
3
  from office365.onenote.entity_base_model import OnenoteEntityBaseModel
2
4
  from office365.runtime.client_result import ClientResult
3
5
  from office365.runtime.queries.function import FunctionQuery
@@ -7,6 +9,7 @@ class OnenoteResource(OnenoteEntityBaseModel):
7
9
  """An image or other file resource on a OneNote page."""
8
10
 
9
11
  def get_content(self):
12
+ # type: () -> ClientResult[AnyStr]
10
13
  """Retrieve the binary data of a file or image resource object."""
11
14
  return_type = ClientResult(self.context)
12
15
  qry = FunctionQuery(self, "content", None, return_type)
@@ -15,8 +18,6 @@ class OnenoteResource(OnenoteEntityBaseModel):
15
18
 
16
19
  @property
17
20
  def content_url(self):
18
- """The URL for downloading the content
19
-
20
- :rtype: str or None
21
- """
21
+ # type: () -> Optional[str]
22
+ """The URL for downloading the content"""
22
23
  return self.properties.get("contentUrl", None)
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.entity_collection import EntityCollection
2
4
  from office365.onenote.entity_hierarchy_model import OnenoteEntityHierarchyModel
3
5
  from office365.onenote.notebooks.notebook import Notebook
@@ -10,22 +12,21 @@ class SectionGroup(OnenoteEntityHierarchyModel):
10
12
 
11
13
  @property
12
14
  def section_groups_url(self):
13
- """The URL for the sectionGroups navigation property, which returns all the section groups in the section group.
14
-
15
- :rtype: str or None
15
+ # type: () -> Optional[str]
16
+ """
17
+ The URL for the sectionGroups navigation property, which returns all the section groups in the section group.
16
18
  """
17
19
  return self.properties.get("sectionGroupsUrl", None)
18
20
 
19
21
  @property
20
22
  def sections_url(self):
21
- """The URL for the sections navigation property, which returns all the sections in the section group.
22
-
23
- :rtype: str or None
24
- """
23
+ # type: () -> Optional[str]
24
+ """The URL for the sections navigation property, which returns all the sections in the section group."""
25
25
  return self.properties.get("sectionsUrl", None)
26
26
 
27
27
  @property
28
28
  def parent_notebook(self):
29
+ # type: () -> Notebook
29
30
  """The notebook that contains the section group. Read-only."""
30
31
  return self.properties.get(
31
32
  "parentNotebook",
@@ -34,6 +35,7 @@ class SectionGroup(OnenoteEntityHierarchyModel):
34
35
 
35
36
  @property
36
37
  def sections(self):
38
+ # type: () -> EntityCollection[OnenoteSection]
37
39
  """The sections in the section group. Read-only. Nullable."""
38
40
  return self.properties.get(
39
41
  "sections",
@@ -46,6 +48,7 @@ class SectionGroup(OnenoteEntityHierarchyModel):
46
48
 
47
49
  @property
48
50
  def section_groups(self):
51
+ # type: () -> EntityCollection[SectionGroup]
49
52
  """Retrieve a list of onenoteSection objects from the specified notebook."""
50
53
  return self.properties.get(
51
54
  "sectionGroups",
@@ -28,7 +28,7 @@ class Calendar(Entity):
28
28
  """
29
29
 
30
30
  def __repr__(self):
31
- return self.name
31
+ return self.name or self.id or self.entity_type_name
32
32
 
33
33
  def allowed_calendar_sharing_roles(self, user):
34
34
  """
@@ -17,7 +17,6 @@ class ScheduleInformation(ClientValue):
17
17
  working_hours=WorkingHours(),
18
18
  ):
19
19
  """
20
-
21
20
  :param WorkingHours working_hours: The days of the week and hours in a specific time zone that the user works.
22
21
  These are set as part of the user's mailboxSettings.
23
22
  :param str error: Error information from attempting to get the availability of the user, distribution list,
@@ -45,25 +45,19 @@ class Contact(OutlookItem):
45
45
  @manager.setter
46
46
  def manager(self, value):
47
47
  # type: (str) -> None
48
- """
49
- Sets name of the contact's manager.
50
- """
48
+ """Sets name of the contact's manager."""
51
49
  self.set_property("manager", value)
52
50
 
53
51
  @property
54
52
  def mobile_phone(self):
55
53
  # type: () -> Optional[str]
56
- """
57
- The contact's mobile phone number.
58
- """
54
+ """The contact's mobile phone number."""
59
55
  return self.properties.get("mobilePhone", None)
60
56
 
61
57
  @mobile_phone.setter
62
58
  def mobile_phone(self, value):
63
59
  # type: (str) -> None
64
- """
65
- Sets contact's mobile phone number.
66
- """
60
+ """Sets contact's mobile phone number."""
67
61
  self.set_property("mobilePhone", value)
68
62
 
69
63
  @property
@@ -24,6 +24,7 @@ class ContactFolder(Entity):
24
24
 
25
25
  @property
26
26
  def child_folders(self):
27
+ # type: () -> EntityCollection["ContactFolder"]
27
28
  """The collection of child folders in the folder. Navigation property. Read-only. Nullable."""
28
29
  return self.properties.get(
29
30
  "childFolders",
@@ -36,6 +37,7 @@ class ContactFolder(Entity):
36
37
 
37
38
  @property
38
39
  def multi_value_extended_properties(self):
40
+ # type: () -> EntityCollection[MultiValueLegacyExtendedProperty]
39
41
  """The collection of multi-value extended properties defined for the Contact folder."""
40
42
  return self.properties.get(
41
43
  "multiValueExtendedProperties",
@@ -48,6 +50,7 @@ class ContactFolder(Entity):
48
50
 
49
51
  @property
50
52
  def single_value_extended_properties(self):
53
+ # type: () -> EntityCollection[SingleValueLegacyExtendedProperty]
51
54
  """The collection of single-value extended properties defined for the Contact folder."""
52
55
  return self.properties.get(
53
56
  "singleValueExtendedProperties",
@@ -174,17 +174,30 @@ class Message(OutlookItem):
174
174
  self.context.add_query(qry)
175
175
  return self
176
176
 
177
- def move(self, destination_id):
177
+ def move(self, destination):
178
178
  """
179
179
  Move a message to another folder within the specified user's mailbox.
180
180
  This creates a new copy of the message in the destination folder and removes the original message.
181
181
 
182
- :param str destination_id: The destination folder ID, or a well-known folder name.
182
+ :param str or MailFolder destination: The destination folder ID, or a well-known folder name.
183
183
  For a list of supported well-known folder names, see mailFolder resource type.
184
184
  """
185
- payload = {"DestinationId": destination_id}
186
- qry = ServiceOperationQuery(self, "move", None, payload, None, None)
187
- self.context.add_query(qry)
185
+ from office365.outlook.mail.folders.folder import MailFolder
186
+
187
+ def _move(destination_id):
188
+ # type: (str) -> None
189
+ payload = {"DestinationId": destination_id}
190
+ qry = ServiceOperationQuery(self, "move", None, payload, None, None)
191
+ self.context.add_query(qry)
192
+
193
+ if isinstance(destination, MailFolder):
194
+
195
+ def _loaded():
196
+ _move(destination.id)
197
+
198
+ destination.ensure_property("id", _loaded)
199
+ else:
200
+ _move(destination)
188
201
  return self
189
202
 
190
203
  def forward(self, to_recipients, comment=""):
@@ -205,13 +218,12 @@ class Message(OutlookItem):
205
218
 
206
219
  @property
207
220
  def has_attachments(self):
221
+ # type: () -> Optional[bool]
208
222
  """
209
223
  Indicates whether the message has attachments. This property doesn't include inline attachments,
210
224
  so if a message contains only inline attachments, this property is false. To verify the existence
211
225
  of inline attachments, parse the body property to look for a src attribute,
212
226
  such as <IMG src="cid:image001.jpg@01D26CD8.6C05F070">.
213
-
214
- :rtype: bool or None
215
227
  """
216
228
  return self.properties.get("hasAttachments", None)
217
229
 
@@ -229,6 +241,7 @@ class Message(OutlookItem):
229
241
 
230
242
  @property
231
243
  def extensions(self):
244
+ # type: () -> EntityCollection[Extension]
232
245
  """The collection of open extensions defined for the message. Nullable."""
233
246
  return self.properties.get(
234
247
  "extensions",
@@ -253,24 +266,19 @@ class Message(OutlookItem):
253
266
  @property
254
267
  def body_preview(self):
255
268
  # type: () -> Optional[str]
256
- """
257
- The first 255 characters of the message body. It is in text format."""
269
+ """The first 255 characters of the message body. It is in text format."""
258
270
  return self.properties.get("bodyPreview", None)
259
271
 
260
272
  @property
261
273
  def conversation_id(self):
262
274
  # type: () -> Optional[str]
263
- """
264
- The ID of the conversation the email belongs to.
265
- """
275
+ """The ID of the conversation the email belongs to."""
266
276
  return self.properties.get("conversationId", None)
267
277
 
268
278
  @property
269
279
  def conversation_index(self):
270
280
  # type: () -> Optional[str]
271
- """
272
- Indicates the position of the message within the conversation.
273
- """
281
+ """Indicates the position of the message within the conversation."""
274
282
  return self.properties.get("conversationIndex", None)
275
283
 
276
284
  @property
@@ -292,9 +300,7 @@ class Message(OutlookItem):
292
300
  @property
293
301
  def importance(self):
294
302
  # type: () -> Optional[str]
295
- """
296
- The importance of the message.
297
- """
303
+ """The importance of the message."""
298
304
  return self.properties.get("importance", None)
299
305
 
300
306
  @property
@@ -308,6 +314,7 @@ class Message(OutlookItem):
308
314
 
309
315
  @property
310
316
  def internet_message_headers(self):
317
+ # type: () -> ClientValueCollection[InternetMessageHeader]
311
318
  """
312
319
  A collection of message headers defined by RFC5322. The set includes message headers indicating the network
313
320
  path taken by a message from the sender to the recipient. It can also contain custom message headers that
@@ -5,10 +5,12 @@ from office365.runtime.client_value import ClientValue
5
5
  class Recipient(ClientValue):
6
6
  """Represents information about a user in the sending or receiving end of an event, message or group post."""
7
7
 
8
- def __init__(self, email_address=EmailAddress()):
8
+ def __init__(self, email_address=None):
9
9
  """
10
10
  :param EmailAddress email_address: The recipient's email address.
11
11
  """
12
+ if email_address is None:
13
+ email_address = EmailAddress()
12
14
  super(Recipient, self).__init__()
13
15
  self.emailAddress = email_address
14
16
 
@@ -1,8 +1,8 @@
1
1
  import json
2
2
  import sys
3
- from typing import Any, Callable, TypedDict
3
+ from typing import Any, Callable
4
4
 
5
- from typing_extensions import Required
5
+ from typing_extensions import Required, TypedDict
6
6
 
7
7
  from office365.runtime.auth.client_credential import ClientCredential
8
8
  from office365.runtime.auth.providers.acs_token_provider import ACSTokenProvider
@@ -1,9 +1,12 @@
1
+ from typing import Optional
2
+
1
3
  import requests
2
4
 
3
5
  import office365.logger
4
6
  from office365.runtime.auth.authentication_provider import AuthenticationProvider
5
7
  from office365.runtime.auth.token_response import TokenResponse
6
8
  from office365.runtime.compat import urlparse
9
+ from office365.runtime.http.request_options import RequestOptions
7
10
 
8
11
 
9
12
  class ACSTokenProvider(AuthenticationProvider, office365.logger.LoggerContext):
@@ -24,9 +27,7 @@ class ACSTokenProvider(AuthenticationProvider, office365.logger.LoggerContext):
24
27
  self._cached_token = None
25
28
 
26
29
  def authenticate_request(self, request):
27
- """
28
- :type request: office365.runtime.http.request_options.RequestOptions
29
- """
30
+ # type: (RequestOptions) -> None
30
31
  self.ensure_app_only_access_token()
31
32
  request.set_header("Authorization", self._get_authorization_header())
32
33
 
@@ -36,9 +37,7 @@ class ACSTokenProvider(AuthenticationProvider, office365.logger.LoggerContext):
36
37
  return self._cached_token and self._cached_token.is_valid
37
38
 
38
39
  def get_app_only_access_token(self):
39
- """
40
- Retrieves an app-only access token from ACS
41
- """
40
+ """Retrieves an app-only access token from ACS"""
42
41
  try:
43
42
  realm = self._get_realm_from_target_url()
44
43
  url_info = urlparse(self.url)
@@ -86,9 +85,7 @@ class ACSTokenProvider(AuthenticationProvider, office365.logger.LoggerContext):
86
85
 
87
86
  @staticmethod
88
87
  def process_realm_response(response):
89
- """
90
- :type response: requests.Response
91
- """
88
+ # type: (requests.Response) -> Optional[str]
92
89
  header_key = "WWW-Authenticate"
93
90
  if header_key in response.headers:
94
91
  auth_values = response.headers[header_key].split(",")
@@ -98,6 +95,7 @@ class ACSTokenProvider(AuthenticationProvider, office365.logger.LoggerContext):
98
95
 
99
96
  @staticmethod
100
97
  def get_formatted_principal(principal_name, host_name, realm):
98
+ # type: (str, Optional[str], str) -> str
101
99
  if host_name:
102
100
  return "{0}/{1}@{2}".format(principal_name, host_name, realm)
103
101
  return "{0}@{1}".format(principal_name, realm)
@@ -90,7 +90,6 @@ class ClientObject(Generic[T]):
90
90
  def is_property_available(self, name):
91
91
  # type: (str) -> bool
92
92
  """Returns a Boolean value that indicates whether the specified property has been retrieved or set.
93
-
94
93
  :param str name: A property name
95
94
  """
96
95
  if name in self.properties:
@@ -116,7 +115,7 @@ class ClientObject(Generic[T]):
116
115
 
117
116
  def remove_from_parent_collection(self):
118
117
  if self._parent_collection is None:
119
- return
118
+ return self
120
119
  self._parent_collection.remove_child(self)
121
120
  return self
122
121
 
@@ -174,19 +173,12 @@ class ClientObject(Generic[T]):
174
173
 
175
174
  def ensure_property(self, name, action, *args, **kwargs):
176
175
  # type: (str, Callable[[], None], Any, Any) -> Self
177
- """
178
- Ensures if property is loaded
179
-
180
- :type action: () -> None
181
- :type name: str
182
- """
176
+ """Ensures if property is loaded"""
183
177
  return self.ensure_properties([name], action, *args, **kwargs)
184
178
 
185
179
  def ensure_properties(self, names, action, *args, **kwargs):
186
180
  # type: (List[str], Callable[[Any, Any], None], Any, Any) -> Self
187
- """
188
- Ensure if list of properties are retrieved from the server
189
- """
181
+ """Ensure if list of properties are retrieved from the server"""
190
182
  if self.property_ref_name is not None and self.property_ref_name not in names:
191
183
  names.append(self.property_ref_name)
192
184