Office365-REST-Python-Client 2.5.4__py3-none-any.whl → 2.5.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {Office365_REST_Python_Client-2.5.4.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/METADATA +2 -2
- {Office365_REST_Python_Client-2.5.4.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/RECORD +224 -204
- office365/booking/business/business.py +5 -3
- office365/booking/virtualevents/__init__.py +0 -0
- office365/booking/virtualevents/root.py +5 -0
- office365/communications/calls/participant.py +4 -5
- office365/directory/applications/application.py +3 -3
- office365/directory/applications/roles/assignment_collection.py +1 -1
- office365/directory/applications/roles/collection.py +2 -2
- office365/directory/authentication/method_configuration.py +9 -0
- office365/directory/authentication/method_mode_detail.py +8 -0
- office365/directory/authentication/method_target.py +5 -0
- office365/directory/authentication/strength_root.py +5 -0
- office365/directory/certificates/auth_configuration.py +1 -3
- office365/directory/extensions/extended_property.py +4 -4
- office365/directory/extensions/open_type.py +4 -4
- office365/directory/groups/group.py +2 -6
- office365/directory/identities/conditional_access_root.py +10 -1
- office365/directory/identities/container.py +3 -9
- office365/directory/identities/providers/base.py +7 -5
- office365/directory/identities/providers/builtin_identity.py +3 -2
- office365/directory/identities/providers/saml_or_wsfed.py +4 -5
- office365/directory/identities/providers/social_identity.py +5 -3
- office365/directory/identities/userflows/b2x/user_flow.py +6 -5
- office365/directory/identities/userflows/language_configuration.py +10 -7
- office365/directory/identitygovernance/governance.py +14 -3
- office365/directory/identitygovernance/privilegedaccess/__init__.py +0 -0
- office365/directory/identitygovernance/privilegedaccess/root.py +5 -0
- office365/directory/key_credential.py +3 -0
- office365/directory/licenses/assignment_state.py +26 -2
- office365/directory/licenses/details.py +8 -6
- office365/directory/licenses/subscribed_sku.py +8 -10
- office365/directory/object_collection.py +40 -25
- office365/directory/password_credential.py +3 -0
- office365/directory/permissions/default_user_role.py +5 -0
- office365/directory/permissions/grants/condition_set.py +4 -2
- office365/directory/permissions/grants/oauth2.py +7 -10
- office365/directory/policies/authorization.py +50 -3
- office365/directory/policies/permission_grant.py +2 -0
- office365/directory/profile_photo.py +6 -6
- office365/directory/protection/riskyusers/risky_user.py +4 -4
- office365/directory/rolemanagement/resource_action.py +10 -0
- office365/directory/rolemanagement/role_permission.py +10 -0
- office365/directory/security/alerts/alert.py +5 -7
- office365/directory/security/attacksimulations/landing_page.py +5 -0
- office365/directory/security/attacksimulations/operation.py +5 -0
- office365/directory/security/attacksimulations/report.py +8 -1
- office365/directory/security/attacksimulations/root.py +33 -0
- office365/directory/security/attacksimulations/users/__init__.py +0 -0
- office365/directory/security/attacksimulations/users/details.py +5 -0
- office365/directory/security/hunting_query_results.py +5 -0
- office365/directory/security/incidents/incident.py +8 -13
- office365/directory/security/security.py +20 -3
- office365/directory/serviceprincipals/service_principal.py +3 -4
- office365/directory/synchronization/synchronization.py +2 -0
- office365/directory/users/activities/history_item.py +3 -2
- office365/directory/users/user.py +37 -10
- office365/entity_collection.py +3 -2
- office365/graph_client.py +58 -30
- office365/intune/audit/event.py +1 -3
- office365/intune/audit/event_collection.py +1 -1
- office365/intune/devices/alternative_security_id.py +4 -0
- office365/intune/devices/collection.py +57 -0
- office365/intune/devices/device.py +38 -10
- office365/intune/devices/management/management.py +12 -0
- office365/intune/organizations/organization.py +1 -0
- office365/onedrive/analytics/item_activity_stat.py +9 -0
- office365/onedrive/analytics/item_analytics.py +1 -0
- office365/onedrive/contenttypes/content_type.py +4 -12
- office365/onedrive/driveitems/driveItem.py +9 -10
- office365/onedrive/files/hashes.py +5 -0
- office365/onedrive/lists/collection.py +2 -2
- office365/onedrive/operations/long_running.py +6 -6
- office365/onedrive/operations/rich_long_running.py +4 -3
- office365/onedrive/permissions/collection.py +1 -14
- office365/onedrive/sharepoint_settings.py +6 -6
- office365/onedrive/sites/sites_with_root.py +1 -3
- office365/onedrive/termstore/store.py +2 -4
- office365/onedrive/termstore/terms/collection.py +1 -2
- office365/onedrive/workbooks/comments/comment.py +7 -6
- office365/onedrive/workbooks/filter.py +9 -0
- office365/onedrive/workbooks/filter_criteria.py +5 -0
- office365/onedrive/workbooks/functions/functions.py +6 -3
- office365/onedrive/workbooks/functions/result.py +2 -0
- office365/onedrive/workbooks/operations/workbook.py +7 -10
- office365/onedrive/workbooks/tables/pivot_table.py +9 -9
- office365/onedrive/workbooks/worksheets/collection.py +0 -6
- office365/onedrive/workbooks/worksheets/protection.py +2 -0
- office365/onedrive/workbooks/worksheets/worksheet.py +30 -2
- office365/onenote/notebooks/collection.py +0 -1
- office365/outlook/calendar/events/event.py +24 -46
- office365/outlook/calendar/permissions/permission.py +7 -7
- office365/outlook/calendar/place.py +5 -3
- office365/outlook/mail/attachments/collection.py +6 -1
- office365/outlook/mail/attachments/file.py +9 -16
- office365/outlook/mail/messages/message.py +1 -1
- office365/planner/user.py +3 -7
- office365/reports/root.py +50 -4
- office365/runtime/auth/providers/acs_token_provider.py +10 -7
- office365/runtime/auth/sts_profile.py +0 -1
- office365/runtime/client_object.py +21 -17
- office365/runtime/client_object_collection.py +9 -24
- office365/runtime/client_request_exception.py +1 -3
- office365/runtime/client_result.py +11 -14
- office365/runtime/client_runtime_context.py +20 -32
- office365/runtime/odata/json_format.py +4 -7
- office365/runtime/odata/request.py +3 -3
- office365/runtime/odata/v3/batch_request.py +17 -31
- office365/runtime/odata/v4/batch_request.py +13 -21
- office365/runtime/queries/batch.py +5 -11
- office365/runtime/queries/function.py +5 -6
- office365/runtime/types/event_handler.py +1 -1
- office365/search/entity.py +3 -2
- office365/sharepoint/activities/facets/delete.py +1 -1
- office365/sharepoint/activities/tracked_item_service.py +2 -3
- office365/sharepoint/administration/web_application.py +8 -7
- office365/sharepoint/alerts/alert.py +8 -12
- office365/sharepoint/audit/audit.py +3 -2
- office365/sharepoint/changes/alert.py +4 -3
- office365/sharepoint/changes/collection.py +7 -10
- office365/sharepoint/changes/content_type.py +4 -4
- office365/sharepoint/changes/field.py +4 -5
- office365/sharepoint/changes/item.py +34 -7
- office365/sharepoint/changes/list.py +4 -4
- office365/sharepoint/changes/user.py +5 -6
- office365/sharepoint/client_context.py +20 -20
- office365/sharepoint/clientsidecomponent/component_context_info.py +4 -3
- office365/sharepoint/contentcenter/machinelearning/enabled.py +4 -3
- office365/sharepoint/contentcenter/machinelearning/hub.py +6 -6
- office365/sharepoint/contentcenter/machinelearning/models/collection.py +1 -1
- office365/sharepoint/contenttypes/fieldlinks/collection.py +4 -6
- office365/sharepoint/contenttypes/fieldlinks/field_link.py +14 -22
- office365/sharepoint/entity.py +12 -5
- office365/sharepoint/entity_collection.py +1 -3
- office365/sharepoint/eventreceivers/definition.py +8 -12
- office365/sharepoint/features/collection.py +3 -6
- office365/sharepoint/features/definitions/definition.py +6 -3
- office365/sharepoint/fields/calculated.py +8 -14
- office365/sharepoint/fields/collection.py +42 -10
- office365/sharepoint/fields/computed.py +4 -5
- office365/sharepoint/fields/currency.py +7 -11
- office365/sharepoint/fields/date_time.py +4 -8
- office365/sharepoint/fields/field.py +6 -16
- office365/sharepoint/fields/lookup.py +11 -9
- office365/sharepoint/fields/multi_choice.py +8 -12
- office365/sharepoint/fields/multi_line_text.py +10 -14
- office365/sharepoint/fields/number.py +13 -26
- office365/sharepoint/fields/rating_scale.py +6 -10
- office365/sharepoint/fields/related_field.py +10 -17
- office365/sharepoint/fields/url.py +4 -5
- office365/sharepoint/fields/user.py +10 -9
- office365/sharepoint/files/checked_out_file.py +4 -3
- office365/sharepoint/files/collection.py +17 -15
- office365/sharepoint/files/file.py +33 -27
- office365/sharepoint/folders/collection.py +22 -5
- office365/sharepoint/folders/coloring.py +11 -9
- office365/sharepoint/folders/coloring_information.py +38 -0
- office365/sharepoint/folders/folder.py +26 -30
- office365/sharepoint/likes/liked_by_information.py +7 -10
- office365/sharepoint/likes/user_entity.py +6 -8
- office365/sharepoint/listitems/form_update_value.py +17 -1
- office365/sharepoint/listitems/listitem.py +9 -11
- office365/sharepoint/lists/bloom_filter.py +5 -7
- office365/sharepoint/lists/creatables_info.py +5 -6
- office365/sharepoint/lists/list.py +25 -10
- office365/sharepoint/lists/template.py +7 -4
- office365/sharepoint/lists/template_collection.py +2 -4
- office365/sharepoint/marketplace/app_metadata.py +14 -23
- office365/sharepoint/marketplace/sitecollection/appcatalog/allowed_item.py +6 -8
- office365/sharepoint/navigation/node.py +5 -8
- office365/sharepoint/permissions/irm/effective_settings.py +6 -8
- office365/sharepoint/permissions/irm/file_settings.py +8 -6
- office365/sharepoint/permissions/irm/settings.py +25 -43
- office365/sharepoint/portal/groups/site_manager.py +6 -7
- office365/sharepoint/portal/sites/manager.py +4 -3
- office365/sharepoint/publishing/embed_data_v1.py +8 -15
- office365/sharepoint/publishing/pages/campaign_publication.py +4 -3
- office365/sharepoint/publishing/primary_city_time.py +8 -9
- office365/sharepoint/publishing/video/service_discoverer.py +4 -3
- office365/sharepoint/pushnotifications/subscriber.py +11 -15
- office365/sharepoint/sharing/object_sharing_settings.py +24 -46
- office365/sharepoint/sharing/permission_information.py +5 -5
- office365/sharepoint/sharing/result.py +1 -0
- office365/sharepoint/sitedesigns/run.py +4 -3
- office365/sharepoint/sites/site.py +7 -16
- office365/sharepoint/taxonomy/field.py +32 -21
- office365/sharepoint/taxonomy/groups/group.py +12 -1
- office365/sharepoint/taxonomy/sets/set.py +6 -0
- office365/sharepoint/taxonomy/stores/store.py +4 -2
- office365/sharepoint/teams/channel.py +6 -6
- office365/sharepoint/tenant/administration/endpoints.py +4 -3
- office365/sharepoint/tenant/administration/hubsites/properties.py +4 -5
- office365/sharepoint/tenant/administration/sites/properties.py +0 -1
- office365/sharepoint/tenant/administration/spo_operation.py +4 -4
- office365/sharepoint/tenant/administration/tenant.py +1 -0
- office365/sharepoint/tenant/insights/report.py +11 -0
- office365/sharepoint/tenant/insights/report_manager.py +5 -0
- office365/sharepoint/tenant/insights/report_metadata.py +5 -0
- office365/sharepoint/tenant/settings.py +4 -3
- office365/sharepoint/translation/sync_translator.py +3 -2
- office365/sharepoint/ui/applicationpages/peoplepicker/entity_information.py +4 -4
- office365/sharepoint/usercustomactions/action.py +12 -20
- office365/sharepoint/userprofiles/followed_content.py +6 -10
- office365/sharepoint/userprofiles/people_manager.py +0 -1
- office365/sharepoint/userprofiles/person_properties.py +14 -30
- office365/sharepoint/userprofiles/personal_cache.py +4 -3
- office365/sharepoint/userprofiles/properties_for_user.py +4 -5
- office365/sharepoint/userprofiles/sharedwithme/document.py +12 -21
- office365/sharepoint/utilities/move_copy_util.py +19 -19
- office365/sharepoint/utilities/upload_status.py +7 -10
- office365/sharepoint/views/field_collection.py +9 -14
- office365/sharepoint/views/view.py +43 -64
- office365/sharepoint/webhooks/subscription.py +11 -19
- office365/sharepoint/webparts/webpart.py +3 -1
- office365/sharepoint/webs/modernize_homepage_result.py +4 -3
- office365/sharepoint/webs/regional_settings.py +9 -17
- office365/sharepoint/webs/template.py +18 -18
- office365/sharepoint/webs/theme_info.py +6 -6
- office365/sharepoint/webs/web.py +16 -23
- office365/teams/members/aad_user_conversation.py +4 -4
- office365/teams/operations/async_operation.py +5 -7
- office365/runtime/paths/item.py +0 -8
- {Office365_REST_Python_Client-2.5.4.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/LICENSE +0 -0
- {Office365_REST_Python_Client-2.5.4.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/WHEEL +0 -0
- {Office365_REST_Python_Client-2.5.4.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import datetime
|
|
2
|
+
from typing import Optional
|
|
2
3
|
|
|
3
4
|
from office365.directory.users.activities.activity import UserActivity
|
|
4
5
|
from office365.entity import Entity
|
|
@@ -16,10 +17,10 @@ class ActivityHistoryItem(Entity):
|
|
|
16
17
|
|
|
17
18
|
@property
|
|
18
19
|
def active_duration_seconds(self):
|
|
20
|
+
# type: () -> Optional[int]
|
|
19
21
|
"""
|
|
20
|
-
|
|
22
|
+
The duration of active user engagement. if not supplied, this is calculated from the startedDateTime
|
|
21
23
|
and lastActiveDateTime.
|
|
22
|
-
:rtype: int or None
|
|
23
24
|
"""
|
|
24
25
|
return self.properties.get("activeDurationSeconds", None)
|
|
25
26
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import json
|
|
2
|
+
from datetime import datetime
|
|
2
3
|
from typing import Optional
|
|
3
4
|
|
|
4
5
|
from office365.communications.onlinemeetings.collection import OnlineMeetingCollection
|
|
@@ -445,9 +446,29 @@ class User(DirectoryObject):
|
|
|
445
446
|
self.context.add_query(qry)
|
|
446
447
|
return return_type
|
|
447
448
|
|
|
449
|
+
@property
|
|
450
|
+
def created_datetime(self):
|
|
451
|
+
# type: () -> Optional[datetime]
|
|
452
|
+
"""
|
|
453
|
+
The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time.
|
|
454
|
+
For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z
|
|
455
|
+
"""
|
|
456
|
+
return self.properties.get("createdDateTime", datetime.min)
|
|
457
|
+
|
|
458
|
+
@property
|
|
459
|
+
def created_objects(self):
|
|
460
|
+
"""Directory objects created by this user."""
|
|
461
|
+
return self.properties.get(
|
|
462
|
+
"createdObjects",
|
|
463
|
+
DirectoryObjectCollection(
|
|
464
|
+
self.context, ResourcePath("createdObjects", self.resource_path)
|
|
465
|
+
),
|
|
466
|
+
)
|
|
467
|
+
|
|
448
468
|
@property
|
|
449
469
|
def device_enrollment_limit(self):
|
|
450
470
|
# type: () -> Optional[str]
|
|
471
|
+
""" """
|
|
451
472
|
return self.properties.get("deviceEnrollmentLimit", None)
|
|
452
473
|
|
|
453
474
|
@property
|
|
@@ -630,6 +651,16 @@ class User(DirectoryObject):
|
|
|
630
651
|
ProfilePhoto(self.context, ResourcePath("photo", self.resource_path)),
|
|
631
652
|
)
|
|
632
653
|
|
|
654
|
+
@property
|
|
655
|
+
def photos(self):
|
|
656
|
+
"""The collection of the user's profile photos in different sizes"""
|
|
657
|
+
return self.properties.get(
|
|
658
|
+
"photos",
|
|
659
|
+
EntityCollection(
|
|
660
|
+
self.context, ProfilePhoto, ResourcePath("photos", self.resource_path)
|
|
661
|
+
),
|
|
662
|
+
)
|
|
663
|
+
|
|
633
664
|
@property
|
|
634
665
|
def manager(self):
|
|
635
666
|
"""The user or contact that is this user's manager"""
|
|
@@ -770,7 +801,7 @@ class User(DirectoryObject):
|
|
|
770
801
|
@property
|
|
771
802
|
def managed_devices(self):
|
|
772
803
|
# type: () -> EntityCollection[ManagedDevice]
|
|
773
|
-
""""""
|
|
804
|
+
"""Devices that are managed or pre-enrolled through Intune"""
|
|
774
805
|
return self.properties.get(
|
|
775
806
|
"managedDevices",
|
|
776
807
|
EntityCollection(
|
|
@@ -936,9 +967,7 @@ class User(DirectoryObject):
|
|
|
936
967
|
|
|
937
968
|
@property
|
|
938
969
|
def online_meetings(self):
|
|
939
|
-
"""
|
|
940
|
-
Get a user's online meetings.
|
|
941
|
-
"""
|
|
970
|
+
"""Get a user's online meetings."""
|
|
942
971
|
return self.properties.get(
|
|
943
972
|
"onlineMeetings",
|
|
944
973
|
OnlineMeetingCollection(
|
|
@@ -987,21 +1016,18 @@ class User(DirectoryObject):
|
|
|
987
1016
|
@property
|
|
988
1017
|
def street_address(self):
|
|
989
1018
|
# type: () -> Optional[str]
|
|
990
|
-
"""
|
|
991
|
-
The street address of the user's place of business. Maximum length is 1024 characters.
|
|
992
|
-
"""
|
|
1019
|
+
"""The street address of the user's place of business. Maximum length is 1024 characters."""
|
|
993
1020
|
return self.properties.get("streetAddress", None)
|
|
994
1021
|
|
|
995
1022
|
@property
|
|
996
1023
|
def security_identifier(self):
|
|
997
1024
|
# type: () -> Optional[str]
|
|
998
|
-
"""
|
|
999
|
-
Security identifier (SID) of the user, used in Windows scenarios.
|
|
1000
|
-
"""
|
|
1025
|
+
"""Security identifier (SID) of the user, used in Windows scenarios."""
|
|
1001
1026
|
return self.properties.get("securityIdentifier", None)
|
|
1002
1027
|
|
|
1003
1028
|
@property
|
|
1004
1029
|
def teamwork(self):
|
|
1030
|
+
# type: () -> UserTeamwork
|
|
1005
1031
|
"""A container for the range of Microsoft Teams functionalities that are available per user in the tenant."""
|
|
1006
1032
|
return self.properties.get(
|
|
1007
1033
|
"teamwork",
|
|
@@ -1042,6 +1068,7 @@ class User(DirectoryObject):
|
|
|
1042
1068
|
"businessPhones": self.business_phones,
|
|
1043
1069
|
"calendarGroups": self.calendar_groups,
|
|
1044
1070
|
"contactFolders": self.contact_folders,
|
|
1071
|
+
"createdObjects": self.created_objects,
|
|
1045
1072
|
"employeeExperience": self.employee_experience,
|
|
1046
1073
|
"followedSites": self.followed_sites,
|
|
1047
1074
|
"licenseDetails": self.license_details,
|
office365/entity_collection.py
CHANGED
|
@@ -3,7 +3,6 @@ from typing import TYPE_CHECKING, Any, Optional, Type, TypeVar
|
|
|
3
3
|
from office365.entity import Entity
|
|
4
4
|
from office365.runtime.client_object_collection import ClientObjectCollection
|
|
5
5
|
from office365.runtime.compat import is_string_type
|
|
6
|
-
from office365.runtime.paths.item import ItemPath
|
|
7
6
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
8
7
|
from office365.runtime.paths.v4.entity import EntityPath
|
|
9
8
|
from office365.runtime.queries.create_entity import CreateEntityQuery
|
|
@@ -43,7 +42,9 @@ class EntityCollection(ClientObjectCollection[T]):
|
|
|
43
42
|
def add(self, **kwargs):
|
|
44
43
|
# type: (Any) -> T
|
|
45
44
|
"""Creates an entity and prepares the query"""
|
|
46
|
-
return_type = self.create_typed_object(
|
|
45
|
+
return_type = self.create_typed_object(
|
|
46
|
+
kwargs, EntityPath(None, self.resource_path)
|
|
47
|
+
)
|
|
47
48
|
self.add_child(return_type)
|
|
48
49
|
qry = CreateEntityQuery(self, return_type, return_type)
|
|
49
50
|
self.context.add_query(qry)
|
office365/graph_client.py
CHANGED
|
@@ -6,6 +6,12 @@ from office365.delta_collection import DeltaCollection
|
|
|
6
6
|
from office365.directory.applications.collection import ApplicationCollection
|
|
7
7
|
from office365.directory.applications.template import ApplicationTemplate
|
|
8
8
|
from office365.directory.audit.log_root import AuditLogRoot
|
|
9
|
+
from office365.directory.authentication.method_configuration import (
|
|
10
|
+
AuthenticationMethodConfiguration,
|
|
11
|
+
)
|
|
12
|
+
from office365.directory.certificates.auth_configuration import (
|
|
13
|
+
CertificateBasedAuthConfiguration,
|
|
14
|
+
)
|
|
9
15
|
from office365.directory.directory import Directory
|
|
10
16
|
from office365.directory.domains.domain import Domain
|
|
11
17
|
from office365.directory.extensions.schema import SchemaExtension
|
|
@@ -35,6 +41,7 @@ from office365.directory.users.user import User
|
|
|
35
41
|
from office365.education.root import EducationRoot
|
|
36
42
|
from office365.entity_collection import EntityCollection
|
|
37
43
|
from office365.intune.devices.app_management import DeviceAppManagement
|
|
44
|
+
from office365.intune.devices.collection import DeviceCollection
|
|
38
45
|
from office365.intune.devices.management.management import DeviceManagement
|
|
39
46
|
from office365.intune.organizations.contact import OrgContact
|
|
40
47
|
from office365.intune.organizations.organization import Organization
|
|
@@ -65,19 +72,31 @@ from office365.teams.collection import TeamCollection
|
|
|
65
72
|
from office365.teams.template import TeamsTemplate
|
|
66
73
|
from office365.teams.viva.employee_experience import EmployeeExperience
|
|
67
74
|
|
|
75
|
+
environments_endpoints = {
|
|
76
|
+
"GCCH": {
|
|
77
|
+
"graph_url": "https://graph.microsoft.com",
|
|
78
|
+
"entra_url": "https://login.microsoftonline.com",
|
|
79
|
+
},
|
|
80
|
+
"GCC High": {
|
|
81
|
+
"graph_url": "https://graph.microsoft.us",
|
|
82
|
+
"entra_url": "https://login.microsoftonline.us",
|
|
83
|
+
},
|
|
84
|
+
"DoD": {
|
|
85
|
+
"graph_url": "https://dod-graph.microsoft.us",
|
|
86
|
+
"entra_url": "https://login.chinacloudapi.cn",
|
|
87
|
+
},
|
|
88
|
+
}
|
|
89
|
+
|
|
68
90
|
|
|
69
91
|
class GraphClient(ClientRuntimeContext):
|
|
70
92
|
"""Graph Service client"""
|
|
71
93
|
|
|
72
|
-
def __init__(self, acquire_token_callback):
|
|
73
|
-
# type: (Callable[[], dict]) -> None
|
|
74
|
-
"""
|
|
75
|
-
:param () -> dict acquire_token_callback: Acquire token function
|
|
76
|
-
"""
|
|
94
|
+
def __init__(self, acquire_token_callback, version="v1.0", environment="GCCH"):
|
|
95
|
+
# type: (Callable[[], dict], str, str) -> None
|
|
77
96
|
super(GraphClient, self).__init__()
|
|
78
97
|
self._pending_request = None
|
|
79
|
-
self.
|
|
80
|
-
self.
|
|
98
|
+
self._version = version
|
|
99
|
+
self._environment_endpoints = environments_endpoints.get(environment, None)
|
|
81
100
|
self._acquire_token_callback = acquire_token_callback
|
|
82
101
|
|
|
83
102
|
@staticmethod
|
|
@@ -130,7 +149,7 @@ class GraphClient(ClientRuntimeContext):
|
|
|
130
149
|
:param str client_secret: Client secret
|
|
131
150
|
:param list[str] or None scopes: Scopes requested to access an API
|
|
132
151
|
:param Any token_cache: Default cache is in memory only,
|
|
133
|
-
|
|
152
|
+
Refer https://msal-python.readthedocs.io/en/latest/#msal.SerializableTokenCache
|
|
134
153
|
"""
|
|
135
154
|
if scopes is None:
|
|
136
155
|
scopes = ["https://graph.microsoft.com/.default"]
|
|
@@ -248,7 +267,7 @@ class GraphClient(ClientRuntimeContext):
|
|
|
248
267
|
|
|
249
268
|
def service_root_url(self):
|
|
250
269
|
# type: () -> str
|
|
251
|
-
return "https://graph.microsoft.com/
|
|
270
|
+
return "https://graph.microsoft.com/{0}".format(self._version)
|
|
252
271
|
|
|
253
272
|
def _build_specific_query(self, request):
|
|
254
273
|
# type: (RequestOptions) -> None
|
|
@@ -334,6 +353,11 @@ class GraphClient(ClientRuntimeContext):
|
|
|
334
353
|
"""Directory Objects container"""
|
|
335
354
|
return DirectoryObjectCollection(self, ResourcePath("directoryObjects"))
|
|
336
355
|
|
|
356
|
+
@property
|
|
357
|
+
def devices(self):
|
|
358
|
+
"""Devices container"""
|
|
359
|
+
return DeviceCollection(self, ResourcePath("devices"))
|
|
360
|
+
|
|
337
361
|
@property
|
|
338
362
|
def teams(self):
|
|
339
363
|
"""Teams container"""
|
|
@@ -393,11 +417,29 @@ class GraphClient(ClientRuntimeContext):
|
|
|
393
417
|
self, ApplicationTemplate, ResourcePath("applicationTemplates")
|
|
394
418
|
)
|
|
395
419
|
|
|
420
|
+
@property
|
|
421
|
+
def authentication_method_configurations(self):
|
|
422
|
+
"""Get the list of application templates in this organization."""
|
|
423
|
+
return EntityCollection(
|
|
424
|
+
self,
|
|
425
|
+
AuthenticationMethodConfiguration,
|
|
426
|
+
ResourcePath("authenticationMethodConfigurations"),
|
|
427
|
+
)
|
|
428
|
+
|
|
396
429
|
@property
|
|
397
430
|
def applications(self):
|
|
398
431
|
"""Get the list of applications in this organization."""
|
|
399
432
|
return ApplicationCollection(self, ResourcePath("applications"))
|
|
400
433
|
|
|
434
|
+
@property
|
|
435
|
+
def certificate_based_auth_configuration(self):
|
|
436
|
+
"""Get the list of applications in this organization."""
|
|
437
|
+
return EntityCollection(
|
|
438
|
+
self,
|
|
439
|
+
CertificateBasedAuthConfiguration,
|
|
440
|
+
ResourcePath("certificateBasedAuthConfiguration"),
|
|
441
|
+
)
|
|
442
|
+
|
|
401
443
|
@property
|
|
402
444
|
def service_principals(self):
|
|
403
445
|
"""Retrieve a list of servicePrincipal objects."""
|
|
@@ -429,16 +471,12 @@ class GraphClient(ClientRuntimeContext):
|
|
|
429
471
|
|
|
430
472
|
@property
|
|
431
473
|
def communications(self):
|
|
432
|
-
"""
|
|
433
|
-
Cloud communications API endpoint
|
|
434
|
-
"""
|
|
474
|
+
"""Cloud communications API endpoint"""
|
|
435
475
|
return CloudCommunications(self, ResourcePath("communications"))
|
|
436
476
|
|
|
437
477
|
@property
|
|
438
478
|
def identity_governance(self):
|
|
439
|
-
"""
|
|
440
|
-
The identity governance singleton
|
|
441
|
-
"""
|
|
479
|
+
"""The identity governance singleton"""
|
|
442
480
|
return IdentityGovernance(self, ResourcePath("identityGovernance"))
|
|
443
481
|
|
|
444
482
|
@property
|
|
@@ -503,9 +541,7 @@ class GraphClient(ClientRuntimeContext):
|
|
|
503
541
|
|
|
504
542
|
@property
|
|
505
543
|
def teams_templates(self):
|
|
506
|
-
"""
|
|
507
|
-
Get the list of teams templates.
|
|
508
|
-
"""
|
|
544
|
+
"""Get the list of teams templates."""
|
|
509
545
|
return EntityCollection(self, TeamsTemplate, ResourcePath("teamsTemplates"))
|
|
510
546
|
|
|
511
547
|
@property
|
|
@@ -518,34 +554,26 @@ class GraphClient(ClientRuntimeContext):
|
|
|
518
554
|
|
|
519
555
|
@property
|
|
520
556
|
def permission_grants(self):
|
|
521
|
-
"""
|
|
522
|
-
List all resource-specific permission grants
|
|
523
|
-
"""
|
|
557
|
+
"""List all resource-specific permission grants"""
|
|
524
558
|
return EntityCollection(
|
|
525
559
|
self, ResourceSpecificPermissionGrant, ResourcePath("permissionGrants")
|
|
526
560
|
)
|
|
527
561
|
|
|
528
562
|
@property
|
|
529
563
|
def print(self):
|
|
530
|
-
"""
|
|
531
|
-
Used to manage printers and print jobs within Universal Print.
|
|
532
|
-
"""
|
|
564
|
+
"""Used to manage printers and print jobs within Universal Print."""
|
|
533
565
|
from office365.intune.printing.print import Print
|
|
534
566
|
|
|
535
567
|
return Print(self, ResourcePath("print"))
|
|
536
568
|
|
|
537
569
|
@property
|
|
538
570
|
def search(self):
|
|
539
|
-
"""
|
|
540
|
-
The search endpoint is the entry point for Microsoft Search API to query data.
|
|
541
|
-
"""
|
|
571
|
+
"""The search endpoint is the entry point for Microsoft Search API to query data."""
|
|
542
572
|
return SearchEntity(self, ResourcePath("search"))
|
|
543
573
|
|
|
544
574
|
@property
|
|
545
575
|
def employee_experience(self):
|
|
546
|
-
"""
|
|
547
|
-
An alias to EmployeeExperience
|
|
548
|
-
"""
|
|
576
|
+
"""An alias to EmployeeExperience"""
|
|
549
577
|
return EmployeeExperience(self, ResourcePath("employeeExperience"))
|
|
550
578
|
|
|
551
579
|
@property
|
office365/intune/audit/event.py
CHANGED
|
@@ -17,9 +17,7 @@ class AuditEvent(Entity):
|
|
|
17
17
|
|
|
18
18
|
@property
|
|
19
19
|
def actor(self):
|
|
20
|
-
"""
|
|
21
|
-
AAD user and application that are associated with the audit event.
|
|
22
|
-
"""
|
|
20
|
+
"""AAD user and application that are associated with the audit event."""
|
|
23
21
|
return self.properties.get("actor", AuditActor())
|
|
24
22
|
|
|
25
23
|
@property
|
|
@@ -5,7 +5,7 @@ from office365.runtime.queries.function import FunctionQuery
|
|
|
5
5
|
from office365.runtime.types.collections import StringCollection
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
class AuditEventCollection(EntityCollection):
|
|
8
|
+
class AuditEventCollection(EntityCollection[AuditEvent]):
|
|
9
9
|
def __init__(self, context, resource_path=None):
|
|
10
10
|
super(AuditEventCollection, self).__init__(context, AuditEvent, resource_path)
|
|
11
11
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import random
|
|
2
|
+
import string
|
|
3
|
+
import uuid
|
|
4
|
+
|
|
5
|
+
from office365.delta_collection import DeltaCollection
|
|
6
|
+
from office365.intune.devices.alternative_security_id import AlternativeSecurityId
|
|
7
|
+
from office365.intune.devices.device import Device
|
|
8
|
+
from office365.runtime.client_value_collection import ClientValueCollection
|
|
9
|
+
from office365.runtime.queries.create_entity import CreateEntityQuery
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class DeviceCollection(DeltaCollection[Device]):
|
|
13
|
+
"""Device's collection"""
|
|
14
|
+
|
|
15
|
+
def __init__(self, context, resource_path=None):
|
|
16
|
+
super(DeviceCollection, self).__init__(context, Device, resource_path)
|
|
17
|
+
|
|
18
|
+
def add(
|
|
19
|
+
self,
|
|
20
|
+
display_name,
|
|
21
|
+
operating_system,
|
|
22
|
+
operating_system_version,
|
|
23
|
+
account_enabled=False,
|
|
24
|
+
alternative_security_id=None,
|
|
25
|
+
device_id=None,
|
|
26
|
+
):
|
|
27
|
+
"""Create and register a new device in the organization.
|
|
28
|
+
:param str display_name: The display name for the device
|
|
29
|
+
:param str operating_system:
|
|
30
|
+
:param str operating_system_version:
|
|
31
|
+
:param bool account_enabled:
|
|
32
|
+
:param AlternativeSecurityId alternative_security_id:
|
|
33
|
+
:param str device_id:
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
if alternative_security_id is None:
|
|
37
|
+
key_id = "base64" + "".join(
|
|
38
|
+
random.choice(string.ascii_lowercase + string.digits) for _ in range(10)
|
|
39
|
+
)
|
|
40
|
+
alternative_security_id = AlternativeSecurityId(2, key_id)
|
|
41
|
+
if device_id is None:
|
|
42
|
+
device_id = str(uuid.uuid4())
|
|
43
|
+
|
|
44
|
+
return_type = Device(self.context)
|
|
45
|
+
return_type.set_property("displayName", display_name)
|
|
46
|
+
return_type.set_property("operatingSystem", operating_system)
|
|
47
|
+
return_type.set_property("operatingSystemVersion", operating_system_version)
|
|
48
|
+
return_type.set_property("accountEnabled", account_enabled)
|
|
49
|
+
return_type.set_property("deviceId", device_id)
|
|
50
|
+
return_type.set_property(
|
|
51
|
+
"alternativeSecurityIds",
|
|
52
|
+
ClientValueCollection(AlternativeSecurityId, [alternative_security_id]),
|
|
53
|
+
)
|
|
54
|
+
self.add_child(return_type)
|
|
55
|
+
qry = CreateEntityQuery(self, return_type, return_type)
|
|
56
|
+
self.context.add_query(qry)
|
|
57
|
+
return return_type
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
1
3
|
from office365.directory.object import DirectoryObject
|
|
2
4
|
from office365.directory.object_collection import DirectoryObjectCollection
|
|
5
|
+
from office365.intune.devices.alternative_security_id import AlternativeSecurityId
|
|
6
|
+
from office365.runtime.client_value_collection import ClientValueCollection
|
|
3
7
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
4
8
|
|
|
5
9
|
|
|
@@ -10,16 +14,28 @@ class Device(DirectoryObject):
|
|
|
10
14
|
authentication. These devices can range from desktop and laptop machines to phones and tablets.
|
|
11
15
|
"""
|
|
12
16
|
|
|
13
|
-
def
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
def __repr__(self):
|
|
18
|
+
return self.device_id or self.entity_type_name
|
|
19
|
+
|
|
20
|
+
@property
|
|
21
|
+
def alternative_security_ids(self):
|
|
22
|
+
"""For internal use only."""
|
|
23
|
+
return self.properties.get(
|
|
24
|
+
"alternativeSecurityIds", ClientValueCollection(AlternativeSecurityId)
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
@property
|
|
28
|
+
def device_id(self):
|
|
29
|
+
# type: () -> Optional[str]
|
|
30
|
+
"""Unique identifier set by Azure Device Registration Service at the time of registration.
|
|
31
|
+
This is an alternate key that can be used to reference the device object."""
|
|
32
|
+
return self.properties.get("deviceId", None)
|
|
33
|
+
|
|
34
|
+
@property
|
|
35
|
+
def device_ownership(self):
|
|
36
|
+
# type: () -> Optional[str]
|
|
37
|
+
"""Ownership of the device. This property is set by Intune. Possible values are: unknown, company, personal."""
|
|
38
|
+
return self.properties.get("deviceOwnership", None)
|
|
23
39
|
|
|
24
40
|
@property
|
|
25
41
|
def member_of(self):
|
|
@@ -65,3 +81,15 @@ class Device(DirectoryObject):
|
|
|
65
81
|
self.context, ResourcePath("transitiveMemberOf", self.resource_path)
|
|
66
82
|
),
|
|
67
83
|
)
|
|
84
|
+
|
|
85
|
+
def get_property(self, name, default_value=None):
|
|
86
|
+
if default_value is None:
|
|
87
|
+
property_mapping = {
|
|
88
|
+
"alternativeSecurityIds": self.alternative_security_ids,
|
|
89
|
+
"memberOf": self.member_of,
|
|
90
|
+
"registeredOwners": self.registered_owners,
|
|
91
|
+
"registeredUsers": self.registered_users,
|
|
92
|
+
"transitiveMemberOf": self.transitive_member_of,
|
|
93
|
+
}
|
|
94
|
+
default_value = property_mapping.get(name, None)
|
|
95
|
+
return super(Device, self).get_property(name, default_value)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from office365.directory.rolemanagement.role_permission import RolePermission
|
|
1
2
|
from office365.entity import Entity
|
|
2
3
|
from office365.entity_collection import EntityCollection
|
|
3
4
|
from office365.intune.audit.event_collection import AuditEventCollection
|
|
@@ -8,7 +9,10 @@ from office365.intune.devices.enrollment.configuration import (
|
|
|
8
9
|
)
|
|
9
10
|
from office365.intune.devices.managed import ManagedDevice
|
|
10
11
|
from office365.intune.devices.management.reports.reports import DeviceManagementReports
|
|
12
|
+
from office365.runtime.client_result import ClientResult
|
|
13
|
+
from office365.runtime.client_value_collection import ClientValueCollection
|
|
11
14
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
15
|
+
from office365.runtime.queries.function import FunctionQuery
|
|
12
16
|
|
|
13
17
|
|
|
14
18
|
class DeviceManagement(Entity):
|
|
@@ -18,6 +22,14 @@ class DeviceManagement(Entity):
|
|
|
18
22
|
configuration.
|
|
19
23
|
"""
|
|
20
24
|
|
|
25
|
+
def get_effective_permissions(self, scope=None):
|
|
26
|
+
"""Retrieves the effective permissions of the currently authenticated user"""
|
|
27
|
+
return_type = ClientResult(self.context, ClientValueCollection(RolePermission))
|
|
28
|
+
# params = {"scope": scope}
|
|
29
|
+
qry = FunctionQuery(self, "getEffectivePermissions", None, return_type)
|
|
30
|
+
self.context.add_query(qry)
|
|
31
|
+
return return_type
|
|
32
|
+
|
|
21
33
|
@property
|
|
22
34
|
def audit_events(self):
|
|
23
35
|
""""""
|
|
@@ -65,3 +65,12 @@ class ItemActivityStat(Entity):
|
|
|
65
65
|
ResourcePath("activities", self.resource_path),
|
|
66
66
|
),
|
|
67
67
|
)
|
|
68
|
+
|
|
69
|
+
def get_property(self, name, default_value=None):
|
|
70
|
+
if default_value is None:
|
|
71
|
+
property_mapping = {
|
|
72
|
+
"endDateTime": self.end_datetime,
|
|
73
|
+
"startDateTime": self.start_datetime,
|
|
74
|
+
}
|
|
75
|
+
default_value = property_mapping.get(name, None)
|
|
76
|
+
return super(ItemActivityStat, self).get_property(name, default_value)
|
|
@@ -20,9 +20,7 @@ class ContentType(BaseItem):
|
|
|
20
20
|
columns that must be present on every listItem in a list."""
|
|
21
21
|
|
|
22
22
|
def is_published(self):
|
|
23
|
-
"""
|
|
24
|
-
Check the publishing status of a contentType in a content type hub site.
|
|
25
|
-
"""
|
|
23
|
+
"""Check the publishing status of a contentType in a content type hub site."""
|
|
26
24
|
return_type = ClientResult(self.context, bool())
|
|
27
25
|
qry = FunctionQuery(self, "isPublished", None, return_type)
|
|
28
26
|
self.context.add_query(qry)
|
|
@@ -57,9 +55,7 @@ class ContentType(BaseItem):
|
|
|
57
55
|
return self
|
|
58
56
|
|
|
59
57
|
def unpublish(self):
|
|
60
|
-
"""
|
|
61
|
-
Unpublish a contentType from a content type hub site.
|
|
62
|
-
"""
|
|
58
|
+
"""Unpublish a contentType from a content type hub site."""
|
|
63
59
|
qry = ServiceOperationQuery(self, "unpublish")
|
|
64
60
|
self.context.add_query(qry)
|
|
65
61
|
return self
|
|
@@ -75,9 +71,7 @@ class ContentType(BaseItem):
|
|
|
75
71
|
|
|
76
72
|
@property
|
|
77
73
|
def document_set(self):
|
|
78
|
-
"""
|
|
79
|
-
Document Set metadata.
|
|
80
|
-
"""
|
|
74
|
+
"""Document Set metadata."""
|
|
81
75
|
return self.properties.get("documentSet", DocumentSet())
|
|
82
76
|
|
|
83
77
|
@property
|
|
@@ -115,9 +109,7 @@ class ContentType(BaseItem):
|
|
|
115
109
|
@property
|
|
116
110
|
def read_only(self):
|
|
117
111
|
# type: () -> Optional[bool]
|
|
118
|
-
"""
|
|
119
|
-
If true, the content type cannot be modified unless this value is first set to false.
|
|
120
|
-
"""
|
|
112
|
+
"""If true, the content type cannot be modified unless this value is first set to false."""
|
|
121
113
|
return self.properties.get("readOnly", None)
|
|
122
114
|
|
|
123
115
|
@property
|
|
@@ -209,7 +209,8 @@ class DriveItem(BaseItem):
|
|
|
209
209
|
:param int chunk_size: chunk size
|
|
210
210
|
"""
|
|
211
211
|
|
|
212
|
-
def _start_upload():
|
|
212
|
+
def _start_upload(result):
|
|
213
|
+
# type: (ClientResult[UploadSession]) -> None
|
|
213
214
|
with open(source_path, "rb") as local_file:
|
|
214
215
|
session_request = UploadSessionRequest(
|
|
215
216
|
local_file, chunk_size, chunk_uploaded
|
|
@@ -246,10 +247,10 @@ class DriveItem(BaseItem):
|
|
|
246
247
|
:type content: str or bytes or None
|
|
247
248
|
"""
|
|
248
249
|
return_type = DriveItem(self.context, UrlPath(name, self.resource_path))
|
|
250
|
+
self.children.add_child(return_type)
|
|
249
251
|
qry = ServiceOperationQuery(
|
|
250
252
|
return_type, "content", None, content, None, return_type
|
|
251
253
|
)
|
|
252
|
-
self.children.add_child(qry.return_type)
|
|
253
254
|
|
|
254
255
|
def _modify_query(request):
|
|
255
256
|
# type: (RequestOptions) -> None
|
|
@@ -533,15 +534,13 @@ class DriveItem(BaseItem):
|
|
|
533
534
|
self.context, ItemActivityStat, self.resource_path
|
|
534
535
|
)
|
|
535
536
|
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
}
|
|
542
|
-
return FunctionQuery(self, "getActivitiesByInterval", params, return_type)
|
|
537
|
+
params = {
|
|
538
|
+
"startDateTime": start_dt.strftime("%m-%d-%Y") if start_dt else None,
|
|
539
|
+
"endDateTime": end_dt.strftime("%m-%d-%Y") if end_dt else None,
|
|
540
|
+
"interval": interval,
|
|
541
|
+
}
|
|
543
542
|
|
|
544
|
-
qry =
|
|
543
|
+
qry = FunctionQuery(self, "getActivitiesByInterval", params, return_type)
|
|
545
544
|
self.context.add_query(qry)
|
|
546
545
|
return return_type
|
|
547
546
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from office365.entity_collection import EntityCollection
|
|
2
2
|
from office365.onedrive.lists.list import List
|
|
3
|
-
from office365.runtime.paths.
|
|
3
|
+
from office365.runtime.paths.v4.entity import EntityPath
|
|
4
4
|
from office365.runtime.queries.create_entity import CreateEntityQuery
|
|
5
5
|
|
|
6
6
|
|
|
@@ -17,7 +17,7 @@ class ListCollection(EntityCollection[List]):
|
|
|
17
17
|
:param str display_name: The displayable title of the list.
|
|
18
18
|
:param str list_template: The base list template used in creating the list
|
|
19
19
|
"""
|
|
20
|
-
return_type = List(self.context,
|
|
20
|
+
return_type = List(self.context, EntityPath(None, self.resource_path))
|
|
21
21
|
self.add_child(return_type)
|
|
22
22
|
payload = {
|
|
23
23
|
"displayName": display_name,
|