Office365-REST-Python-Client 2.5.9__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 (82) hide show
  1. {Office365_REST_Python_Client-2.5.9.dist-info → Office365_REST_Python_Client-2.5.11.dist-info}/METADATA +9 -10
  2. {Office365_REST_Python_Client-2.5.9.dist-info → Office365_REST_Python_Client-2.5.11.dist-info}/RECORD +82 -70
  3. {Office365_REST_Python_Client-2.5.9.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/internal/paths/url.py +14 -0
  18. office365/onedrive/listitems/list_item.py +1 -0
  19. office365/onedrive/lists/collection.py +6 -0
  20. office365/onedrive/sharepoint_ids.py +18 -1
  21. office365/onedrive/shares/drive_item.py +1 -2
  22. office365/onedrive/sitepages/horizontal_section_column.py +1 -1
  23. office365/onedrive/sitepages/site_page.py +1 -1
  24. office365/onedrive/sitepages/vertical_section.py +1 -1
  25. office365/onedrive/sitepages/webparts/__init__.py +0 -0
  26. office365/onedrive/sitepages/webparts/standard.py +5 -0
  27. office365/onedrive/sitepages/webparts/text.py +5 -0
  28. office365/onedrive/storage/__init__.py +0 -0
  29. office365/onedrive/storage/storage.py +5 -0
  30. office365/onedrive/workbooks/filter.py +7 -0
  31. office365/onedrive/workbooks/filter_criteria.py +9 -2
  32. office365/onedrive/workbooks/tables/rows/collection.py +20 -0
  33. office365/onedrive/workbooks/tables/rows/row.py +2 -1
  34. office365/onedrive/workbooks/workbook.py +7 -5
  35. office365/onenote/internal/multipart_page_query.py +2 -3
  36. office365/outlook/category.py +7 -0
  37. office365/outlook/mail/item_body.py +10 -1
  38. office365/outlook/mail/messages/collection.py +3 -0
  39. office365/outlook/mail/messages/message.py +3 -4
  40. office365/runtime/auth/providers/saml_token_provider.py +4 -4
  41. office365/runtime/client_object.py +4 -3
  42. office365/runtime/client_request.py +1 -1
  43. office365/runtime/client_runtime_context.py +3 -3
  44. office365/runtime/http/request_options.py +7 -3
  45. office365/runtime/paths/resource_path.py +3 -0
  46. office365/runtime/queries/create_entity.py +6 -8
  47. office365/runtime/queries/update_entity.py +3 -5
  48. office365/sharepoint/attachments/attachment.py +14 -2
  49. office365/sharepoint/attachments/collection.py +27 -4
  50. office365/sharepoint/businessdata/infrastructure/securestore/connection_settings.py +23 -1
  51. office365/sharepoint/changes/app_consent_principal.py +5 -0
  52. office365/sharepoint/changes/file.py +4 -0
  53. office365/sharepoint/directory/membership_result.py +5 -0
  54. office365/sharepoint/documentmanagement/document_set.py +7 -8
  55. office365/sharepoint/entity.py +5 -0
  56. office365/sharepoint/fields/builtin_field_id.py +19 -0
  57. office365/sharepoint/fields/choice.py +2 -2
  58. office365/sharepoint/fields/collection.py +1 -3
  59. office365/sharepoint/fields/field.py +5 -2
  60. office365/sharepoint/files/file.py +1 -1
  61. office365/sharepoint/internal/queries/upload_file.py +12 -8
  62. office365/sharepoint/lists/list.py +3 -2
  63. office365/sharepoint/navigation/node.py +4 -2
  64. office365/sharepoint/packaging/app_details.py +34 -0
  65. office365/sharepoint/policy/dlp_policy_tip.py +9 -1
  66. office365/sharepoint/portal/sites/manager.py +1 -1
  67. office365/sharepoint/principal/principal.py +10 -1
  68. office365/sharepoint/principal/users/collection.py +1 -3
  69. office365/sharepoint/publishing/sites/communication/site.py +4 -3
  70. office365/sharepoint/request.py +33 -1
  71. office365/sharepoint/search/service.py +5 -3
  72. office365/sharepoint/sharing/information.py +5 -0
  73. office365/sharepoint/sharing/permission_collection.py +13 -9
  74. office365/sharepoint/sharing/recipient_limits.py +9 -0
  75. office365/sharepoint/sharing/site_sharing_report_helper.py +2 -3
  76. office365/sharepoint/tenant/administration/tenant.py +22 -0
  77. office365/sharepoint/tenant/management/office365_tenant.py +18 -0
  78. office365/sharepoint/userprofiles/profile_loader.py +1 -3
  79. office365/sharepoint/userprofiles/user_profile.py +80 -6
  80. {Office365_REST_Python_Client-2.5.9.dist-info → Office365_REST_Python_Client-2.5.11.dist-info}/LICENSE +0 -0
  81. {Office365_REST_Python_Client-2.5.9.dist-info → Office365_REST_Python_Client-2.5.11.dist-info}/top_level.txt +0 -0
  82. /office365/onedrive/sitepages/{web_part.py → webparts/web_part.py} +0 -0
@@ -684,7 +684,7 @@ class File(AbstractFile):
684
684
  chunk_downloaded(bytes_read)
685
685
  file_object.write(chunk)
686
686
 
687
- self.context.add_query(qry).before_execute(
687
+ self.context.add_query(qry).before_query_execute(
688
688
  _construct_request
689
689
  ).after_execute(_process_response)
690
690
 
@@ -1,20 +1,24 @@
1
+ from typing import IO, TYPE_CHECKING
2
+
1
3
  from office365.runtime.http.http_method import HttpMethod
4
+ from office365.runtime.http.request_options import RequestOptions
2
5
  from office365.runtime.queries.service_operation import ServiceOperationQuery
3
6
 
7
+ if TYPE_CHECKING:
8
+ from office365.sharepoint.attachments.attachment import Attachment
9
+ from office365.sharepoint.files.file import File
4
10
 
5
- def create_upload_file_query(file, file_object):
6
- """
7
- Constructs upload file content query
8
11
 
9
- :type file: office365.sharepoint.files.file.File
10
- :type file_object: typing.IO
11
- """
12
+ def create_upload_file_query(file, file_object):
13
+ # type: (File|Attachment, IO) -> ServiceOperationQuery
14
+ """Constructs upload file content query"""
12
15
  qry = ServiceOperationQuery(file, "$value")
13
16
 
14
- def _construct_upload_request(request):
17
+ def _construct_request(request):
18
+ # type: (RequestOptions) -> None
15
19
  request.data = file_object.read()
16
20
  request.method = HttpMethod.Post
17
21
  request.set_header("X-HTTP-Method", "PUT")
18
22
 
19
- file.context.before_execute(_construct_upload_request)
23
+ file.context.before_execute(_construct_request)
20
24
  return qry
@@ -1,6 +1,6 @@
1
1
  import os
2
2
  from datetime import datetime
3
- from typing import TYPE_CHECKING, AnyStr, Optional
3
+ from typing import TYPE_CHECKING, AnyStr, Dict, Optional
4
4
 
5
5
  from office365.runtime.client_result import ClientResult
6
6
  from office365.runtime.client_value_collection import ClientValueCollection
@@ -182,11 +182,12 @@ class List(SecurableObject):
182
182
  return return_type
183
183
 
184
184
  def get_site_script(self, options=None):
185
+ # type: (Dict) -> ClientResult[str]
185
186
  """Creates site script syntax
186
187
 
187
188
  :param dict or None options:
188
189
  """
189
- return_type = ClientResult(self.context) # type: ClientResult[str]
190
+ return_type = ClientResult(self.context)
190
191
 
191
192
  def _list_loaded():
192
193
  list_abs_path = SPResPath.create_absolute(
@@ -15,13 +15,14 @@ class NavigationNode(Entity):
15
15
  """
16
16
 
17
17
  def __str__(self):
18
- return self.title
18
+ return self.title or self.entity_type_name
19
19
 
20
20
  def __repr__(self):
21
- return self.url
21
+ return self.url or self.entity_type_name
22
22
 
23
23
  @property
24
24
  def children(self):
25
+ # type: () -> NavigationNodeCollection
25
26
  """Gets the collection of child nodes of the navigation node."""
26
27
  return self.properties.get(
27
28
  "Children",
@@ -49,6 +50,7 @@ class NavigationNode(Entity):
49
50
 
50
51
  @url.setter
51
52
  def url(self, value):
53
+ # type: (str) -> None
52
54
  """Sets a value that specifies the URL stored with the navigation node."""
53
55
  self.set_property("Url", value)
54
56
 
@@ -1,7 +1,41 @@
1
+ from typing import Optional
2
+
1
3
  from office365.sharepoint.entity import Entity
2
4
 
3
5
 
4
6
  class AppDetails(Entity):
7
+ """Specifies the detail properties for a SharePoint Add-in."""
8
+
9
+ @property
10
+ def eula_url(self):
11
+ # type: () -> Optional[str]
12
+ """Specifies the URL to get the End User License Agreement (EULA) information for the SharePoint Add-in."""
13
+ return self.properties.get("EulaUrl", None)
14
+
15
+ @property
16
+ def privacy_url(self):
17
+ # type: () -> Optional[str]
18
+ """Specifies the URL of the privacy statement for the SharePoint Add-in."""
19
+ return self.properties.get("PrivacyUrl", None)
20
+
21
+ @property
22
+ def publisher(self):
23
+ # type: () -> Optional[str]
24
+ """Specifies the publisher name for the SharePoint Add-in."""
25
+ return self.properties.get("Publisher", None)
26
+
27
+ @property
28
+ def short_description(self):
29
+ # type: () -> Optional[str]
30
+ """Specifies a short description for the SharePoint Add-in."""
31
+ return self.properties.get("ShortDescription", None)
32
+
33
+ @property
34
+ def support_url(self):
35
+ # type: () -> Optional[str]
36
+ """Specifies the URL of the support page for the SharePoint Add-in."""
37
+ return self.properties.get("SupportUrl", None)
38
+
5
39
  @property
6
40
  def entity_type_name(self):
7
41
  return "Microsoft.SharePoint.Packaging.AppDetails"
@@ -1,3 +1,6 @@
1
+ from datetime import datetime
2
+ from typing import Optional
3
+
1
4
  from office365.runtime.types.collections import StringCollection
2
5
  from office365.sharepoint.entity import Entity
3
6
 
@@ -7,23 +10,27 @@ class DlpPolicyTip(Entity):
7
10
 
8
11
  @property
9
12
  def applied_actions_text(self):
13
+ # type: () -> Optional[str]
10
14
  """Specifies the text which states what restrictive actions have been applied to this item."""
11
15
  return self.properties.get("AppliedActionsText", None)
12
16
 
13
17
  @property
14
18
  def compliance_url(self):
19
+ # type: () -> Optional[str]
15
20
  """Specifies the URL that provides additional help on the policy tip dialog."""
16
21
  return self.properties.get("ComplianceUrl", None)
17
22
 
18
23
  @property
19
24
  def general_text(self):
25
+ # type: () -> Optional[str]
20
26
  """General text that appears on the top of the policy tip dialog."""
21
27
  return self.properties.get("GeneralText", None)
22
28
 
23
29
  @property
24
30
  def last_processed_time(self):
31
+ # type: () -> Optional[datetime]
25
32
  """The last time this item was processed for policy matches."""
26
- return self.properties.get("LastProcessedTime", None)
33
+ return self.properties.get("LastProcessedTime", datetime.min)
27
34
 
28
35
  @property
29
36
  def matched_condition_descriptions(self):
@@ -37,5 +44,6 @@ class DlpPolicyTip(Entity):
37
44
 
38
45
  @property
39
46
  def two_letter_iso_language_name(self):
47
+ # type: () -> Optional[str]
40
48
  """The two-letter language code of the generated policy tip detail."""
41
49
  return self.properties.get("TwoLetterISOLanguageName", None)
@@ -80,7 +80,7 @@ class SPSiteManager(Entity):
80
80
  request.method = HttpMethod.Get
81
81
  request.url += "?url='{0}'".format(site_url)
82
82
 
83
- self.context.add_query(qry).before_execute(_construct_request)
83
+ self.context.add_query(qry).before_query_execute(_construct_request)
84
84
  return response
85
85
 
86
86
  def get_site_url(self, site_id):
@@ -11,7 +11,12 @@ class Principal(Entity):
11
11
  return self.title or self.entity_type_name
12
12
 
13
13
  def __repr__(self):
14
- return self.user_principal_name or self.id or self.entity_type_name
14
+ return (
15
+ self.user_principal_name
16
+ or self.login_name
17
+ or self.id
18
+ or self.entity_type_name
19
+ )
15
20
 
16
21
  @property
17
22
  def id(self):
@@ -55,6 +60,10 @@ class Principal(Entity):
55
60
  """Gets the type of the principal."""
56
61
  return self.properties.get("PrincipalType", None)
57
62
 
63
+ @property
64
+ def property_ref_name(self):
65
+ return "Id"
66
+
58
67
  def set_property(self, name, value, persist_changes=True):
59
68
  super(Principal, self).set_property(name, value, persist_changes)
60
69
  # fallback: create a new resource path
@@ -19,9 +19,7 @@ class UserCollection(EntityCollection[User]):
19
19
  self.add_child(return_type)
20
20
 
21
21
  def _create_and_add_query(login_name):
22
- """
23
- :type login_name: str
24
- """
22
+ # type: (str) -> None
25
23
  return_type.set_property("LoginName", login_name)
26
24
  qry = CreateEntityQuery(self, return_type, return_type)
27
25
  self.context.add_query(qry)
@@ -1,5 +1,6 @@
1
1
  from office365.runtime.client_result import ClientResult
2
2
  from office365.runtime.http.http_method import HttpMethod
3
+ from office365.runtime.http.request_options import RequestOptions
3
4
  from office365.runtime.queries.service_operation import ServiceOperationQuery
4
5
  from office365.sharepoint.entity import Entity
5
6
  from office365.sharepoint.publishing.sites.communication.creation_request import (
@@ -61,13 +62,13 @@ class CommunicationSite(Entity):
61
62
  qry = ServiceOperationQuery(
62
63
  self, "Status", None, {"url": site_url}, None, response
63
64
  )
64
- self.context.add_query(qry)
65
65
 
66
- def _construct_status_request(request):
66
+ def _construct_request(request):
67
+ # type: (RequestOptions) -> None
67
68
  request.method = HttpMethod.Get
68
69
  request.url += "?url='{0}'".format(site_url)
69
70
 
70
- self.context.before_execute(_construct_status_request)
71
+ self.context.add_query(qry).before_query_execute(_construct_request)
71
72
  return response
72
73
 
73
74
  def enable(self, design_package_id):
@@ -1,7 +1,39 @@
1
+ from typing import Optional
2
+
3
+ from requests import Response
4
+ from typing_extensions import Self
5
+
6
+ from office365.runtime.auth.authentication_context import AuthenticationContext
7
+ from office365.runtime.auth.client_credential import ClientCredential
8
+ from office365.runtime.auth.user_credential import UserCredential
9
+ from office365.runtime.http.request_options import RequestOptions
1
10
  from office365.runtime.odata.request import ODataRequest
2
11
  from office365.runtime.odata.v3.json_light_format import JsonLightFormat
3
12
 
4
13
 
5
14
  class SharePointRequest(ODataRequest):
6
- def __init__(self):
15
+ def __init__(self, base_url):
7
16
  super().__init__(JsonLightFormat())
17
+ self._auth_context = AuthenticationContext(url=base_url)
18
+ self.beforeExecute += self._authenticate_request
19
+
20
+ def execute_request(self, path):
21
+ # type: (str) -> Response
22
+ request_url = "{0}/_api/{1}".format(self._auth_context.url, path)
23
+ return self.execute_request_direct(RequestOptions(request_url))
24
+
25
+ def with_credentials(self, credentials, environment="commercial"):
26
+ # type: (UserCredential|ClientCredential, Optional[str]) -> Self
27
+ """
28
+ Initializes a client to acquire a token via user or client credentials
29
+ :type credentials: UserCredential or ClientCredential
30
+ :param str environment: The Office 365 Cloud Environment endpoint used for authentication
31
+ defaults to 'commercial'.
32
+ """
33
+ self._auth_context.with_credentials(credentials, environment=environment)
34
+ return self
35
+
36
+ def _authenticate_request(self, request):
37
+ # type: (RequestOptions) -> None
38
+ """Authenticate request"""
39
+ self._auth_context.authenticate_request(request)
@@ -1,3 +1,5 @@
1
+ from typing import Any, List
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.paths.resource_path import ResourcePath
@@ -162,6 +164,7 @@ class SearchService(Entity):
162
164
  row_limit=None,
163
165
  **kwargs
164
166
  ):
167
+ # type: (str, List[str], bool, int, Any) -> ClientResult[SearchResult]
165
168
  """The operation is used to retrieve search results through the use of the HTTP protocol
166
169
  with method type POST.
167
170
 
@@ -172,9 +175,7 @@ class SearchService(Entity):
172
175
  :param int row_limit: The number of search results the protocol client wants to receive, starting at the index
173
176
  specified in the StartRow element. The RowLimit value MUST be greater than or equal to zero.
174
177
  """
175
- return_type = ClientResult(
176
- self.context, SearchResult()
177
- ) # type: ClientResult[SearchResult]
178
+ return_type = ClientResult(self.context, SearchResult())
178
179
  request = SearchRequest(
179
180
  query_text=query_text,
180
181
  select_properties=select_properties,
@@ -211,6 +212,7 @@ class SearchService(Entity):
211
212
  return self
212
213
 
213
214
  def search_center_url(self):
215
+ # type: () -> ClientResult[str]
214
216
  """The operation is used to get the URI address of the search center by using the HTTP protocol
215
217
  with the GET method. The operation returns the URI of the of the search center.
216
218
  """
@@ -22,6 +22,11 @@ class SharingInformation(Entity):
22
22
  """
23
23
  return self.properties.get("accessRequestSettings", AccessRequestSettings())
24
24
 
25
+ @property
26
+ def anonymous_link_expiration_restriction_days(self):
27
+ """Tenant's anonymous link expiration restriction in days."""
28
+ return self.properties.get("anonymousLinkExpirationRestrictionDays", None)
29
+
25
30
  @property
26
31
  def permissions_information(self):
27
32
  """
@@ -14,25 +14,29 @@ class PermissionCollection(ClientValue):
14
14
 
15
15
  def __init__(
16
16
  self,
17
- hasInheritedLinks=None,
17
+ app_consent_principals=None,
18
+ has_inherited_links=None,
18
19
  links=None,
19
20
  principals=None,
20
- siteAdmins=None,
21
- totalNumberOfPrincipals=None,
21
+ site_admins=None,
22
+ total_number_of_principals=None,
22
23
  ):
23
24
  """
24
- :param bool hasInheritedLinks:
25
+ :param bool has_inherited_links:
25
26
  :param list[LinkInfo] links: The List of tokenized sharing links with their LinkInfo objects.
26
27
  :param list[PrincipalInfo] principals: The List of Principals with their roles on this list item.
27
- :param list[PrincipalInfo] siteAdmins: The List of Principals who are Site Admins. This property is returned
28
+ :param list[PrincipalInfo] site_admins: The List of Principals who are Site Admins. This property is returned
28
29
  only if the caller is an Auditor.
29
- :param int totalNumberOfPrincipals:
30
+ :param int total_number_of_principals:
30
31
  """
31
- self.hasInheritedLinks = hasInheritedLinks
32
+ self.appConsentPrincipals = ClientValueCollection(
33
+ PrincipalInfo, app_consent_principals
34
+ )
35
+ self.hasInheritedLinks = has_inherited_links
32
36
  self.links = ClientValueCollection(LinkInfo, links)
33
37
  self.principals = ClientValueCollection(PrincipalInfo, principals)
34
- self.siteAdmins = ClientValueCollection(PrincipalInfo, siteAdmins)
35
- self.totalNumberOfPrincipals = totalNumberOfPrincipals
38
+ self.siteAdmins = ClientValueCollection(PrincipalInfo, site_admins)
39
+ self.totalNumberOfPrincipals = total_number_of_principals
36
40
 
37
41
  @property
38
42
  def entity_type_name(self):
@@ -0,0 +1,9 @@
1
+ from office365.runtime.client_value import ClientValue
2
+
3
+
4
+ class RecipientLimits(ClientValue):
5
+ """"""
6
+
7
+ @property
8
+ def entity_type_name(self):
9
+ return "SP.Sharing.RecipientLimits"
@@ -1,5 +1,6 @@
1
1
  from office365.runtime.client_result import ClientResult
2
2
  from office365.runtime.queries.service_operation import ServiceOperationQuery
3
+ from office365.sharepoint.client_context import ClientContext
3
4
  from office365.sharepoint.entity import Entity
4
5
  from office365.sharepoint.sharing.reports.site_capabilities import (
5
6
  SiteSharingReportCapabilities,
@@ -12,9 +13,7 @@ from office365.sharepoint.sharing.site_sharing_report_status import (
12
13
  class SiteSharingReportHelper(Entity):
13
14
  @staticmethod
14
15
  def cancel_sharing_report_job(context):
15
- """
16
- :type context: office365.sharepoint.client_context.ClientContext
17
- """
16
+ # type: (ClientContext) -> ClientResult[SiteSharingReportStatus]
18
17
  return_type = ClientResult(context, SiteSharingReportStatus())
19
18
  binding_type = SiteSharingReportHelper(context)
20
19
  qry = ServiceOperationQuery(
@@ -319,6 +319,28 @@ class Tenant(Entity):
319
319
  self.context.add_query(qry)
320
320
  return return_type
321
321
 
322
+ def get_ransomware_activities(self):
323
+ # type: () -> ClientResult[AnyStr]
324
+ """ """
325
+ return_type = ClientResult(self.context)
326
+ payload = {"parameters": RenderListDataParameters()}
327
+ qry = ServiceOperationQuery(
328
+ self, "GetRansomwareActivities", None, payload, None, return_type
329
+ )
330
+ self.context.add_query(qry)
331
+ return return_type
332
+
333
+ def get_sp_list_item_count(self, listName):
334
+ # type: (str) -> ClientResult[int]
335
+ """ """
336
+ return_type = ClientResult(self.context)
337
+ payload = {"listName": listName}
338
+ qry = ServiceOperationQuery(
339
+ self, "GetSPListItemCount", None, payload, None, return_type
340
+ )
341
+ self.context.add_query(qry)
342
+ return return_type
343
+
322
344
  def check_tenant_intune_license(self):
323
345
  """
324
346
  Checks whether a tenant has the Intune license.
@@ -1,5 +1,7 @@
1
1
  from typing import Optional
2
2
 
3
+ from typing_extensions import Self
4
+
3
5
  from office365.runtime.client_object_collection import ClientObjectCollection
4
6
  from office365.runtime.client_result import ClientResult
5
7
  from office365.runtime.client_value_collection import ClientValueCollection
@@ -104,6 +106,22 @@ class Office365Tenant(Entity):
104
106
  self.context.add_query(qry)
105
107
  return return_type
106
108
 
109
+ def set_block_download_file_type_policy_data(
110
+ self, blockDownloadFileTypePolicy, fileTypeIds, excludedBlockDownloadGroupIds
111
+ ):
112
+ # type: (bool, list[int], list[str]) -> Self
113
+ """"""
114
+ payload = {
115
+ "blockDownloadFileTypePolicy": blockDownloadFileTypePolicy,
116
+ "fileTypeIds": fileTypeIds,
117
+ "excludedBlockDownloadGroupIds": excludedBlockDownloadGroupIds,
118
+ }
119
+ qry = ServiceOperationQuery(
120
+ self, "SetBlockDownloadFileTypePolicyData", None, payload
121
+ )
122
+ self.context.add_query(qry)
123
+ return self
124
+
107
125
  def set_tenant_cdn_enabled(self, cdn_type, is_enabled):
108
126
  """
109
127
  Enables or disables Public content delivery network (CDN) or Private CDN on the tenant level.
@@ -47,9 +47,7 @@ class ProfileLoader(ClientObject):
47
47
  return return_type
48
48
 
49
49
  def get_user_profile(self):
50
- """
51
- The GetUserProfile method returns the user profile for the current user.
52
- """
50
+ """The GetUserProfile method returns the user profile for the current user."""
53
51
  result = UserProfile(
54
52
  self.context, ResourcePath("GetUserProfile", self.resource_path)
55
53
  )
@@ -1,3 +1,4 @@
1
+ from datetime import datetime
1
2
  from typing import Optional
2
3
 
3
4
  from office365.runtime.client_result import ClientResult
@@ -12,6 +13,12 @@ class UserProfile(Entity):
12
13
  """The UserProfile class stores the profile of the individual user, which includes properties such
13
14
  as the user's account name, preferred name, and email address."""
14
15
 
16
+ def __str__(self):
17
+ return self.display_name or self.entity_type_name
18
+
19
+ def __repr__(self):
20
+ return self.account_name or self.entity_type_name
21
+
15
22
  @property
16
23
  def account_name(self):
17
24
  # type: () -> Optional[str]
@@ -25,19 +32,85 @@ class UserProfile(Entity):
25
32
  return self.properties.get("DisplayName", None)
26
33
 
27
34
  @property
28
- def my_site_host_url(self):
35
+ def follow_personal_site_url(self):
29
36
  # type: () -> Optional[str]
37
+ """The FollowPersonalSiteUrl property specifies the URL to allow the current user to create a personal site.
38
+ If there is no hybrid & cross-geo setting, it will return the same value as UrlToCreatePersonalSite,
39
+ otherwise a URL to allow the current user to create a personal site on the remote host.
30
40
  """
31
- Specifies the URL for the personal site of the current user.
32
- """
41
+ return self.properties.get("FollowPersonalSiteUrl", None)
42
+
43
+ @property
44
+ def is_default_document_library_blocked(self):
45
+ # type: () -> Optional[bool]
46
+ """If true, indicates that the access of the user to the default document library in the user’s OneDrive
47
+ is blocked."""
48
+ return self.properties.get("IsDefaultDocumentLibraryBlocked", None)
49
+
50
+ @property
51
+ def is_people_list_public(self):
52
+ # type: () -> Optional[bool]
53
+ """Specifies whether the list of people that the user is following is public."""
54
+ return self.properties.get("IsPeopleListPublic", None)
55
+
56
+ @property
57
+ def is_privacy_setting_on(self):
58
+ # type: () -> Optional[bool]
59
+ """Specifies whether the privacy setting has been set for the site."""
60
+ return self.properties.get("IsPrivacySettingOn", None)
61
+
62
+ @property
63
+ def is_self(self):
64
+ # type: () -> Optional[bool]
65
+ """Specifies whether the user profile is for the current user."""
66
+ return self.properties.get("IsSelf", None)
67
+
68
+ @property
69
+ def job_title(self):
70
+ # type: () -> Optional[str]
71
+ """Specifies the job title of the user."""
72
+ return self.properties.get("JobTitle", None)
73
+
74
+ @property
75
+ def my_site_first_run_experience(self):
76
+ # type: () -> Optional[int]
77
+ """Specifies the personal site First Run flag of the user."""
78
+ return self.properties.get("MySiteFirstRunExperience", None)
79
+
80
+ @property
81
+ def my_site_host_url(self):
82
+ # type: () -> Optional[str]
83
+ """Specifies the URL for the personal site of the current user."""
33
84
  return self.properties.get("MySiteHostUrl", None)
34
85
 
86
+ @property
87
+ def o15_first_run_experience(self):
88
+ # type: () -> Optional[int]
89
+ """Specifies the First Run flag of the user."""
90
+ return self.properties.get("O15FirstRunExperience", None)
91
+
92
+ @property
93
+ def personal_site_capabilities(self):
94
+ # type: () -> Optional[int]
95
+ """The PersonalSiteCapabilities property specifies attributes of the user's personal site."""
96
+ return self.properties.get("PersonalSiteCapabilities", None)
97
+
98
+ @property
99
+ def personal_site_first_creation_error(self):
100
+ # type: () -> Optional[str]
101
+ """Specifies the failure for the personal site first creation attempt."""
102
+ return self.properties.get("PersonalSiteFirstCreationError", None)
103
+
104
+ @property
105
+ def personal_site_first_creation_time(self):
106
+ # type: () -> Optional[datetime]
107
+ """Specifies the time for the personal site first creation attempt."""
108
+ return self.properties.get("PersonalSiteFirstCreationTime", datetime.min)
109
+
35
110
  @property
36
111
  def public_url(self):
37
112
  # type: () -> Optional[str]
38
- """
39
- Specifies the public URL for the personal site of the current user.
40
- """
113
+ """Specifies the public URL for the personal site of the current user."""
41
114
  return self.properties.get("PublicUrl", None)
42
115
 
43
116
  @property
@@ -120,6 +193,7 @@ class UserProfile(Entity):
120
193
  property_mapping = {
121
194
  "FollowedContent": self.followed_content,
122
195
  "PersonalSite": self.personal_site,
196
+ "PersonalSiteFirstCreationTime": self.personal_site_first_creation_time,
123
197
  }
124
198
  default_value = property_mapping.get(name, None)
125
199
  return super(UserProfile, self).get_property(name, default_value)