Skip to content

Commit 98d7a5d

Browse files
committed
new types & methods for Teams API
1 parent 1a2e6d6 commit 98d7a5d

File tree

23 files changed

+359
-12
lines changed

23 files changed

+359
-12
lines changed

examples/reports/get_user_mfa_status.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
"""
2+
Get a list of the authentication methods registered for a user as defined in the userRegistrationDetails object.
3+
This method doesn't work for disabled users.
4+
5+
"""
16
from office365.graph_client import GraphClient
27
from tests import test_client_id, test_client_secret, test_tenant
38

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.runtime.client_value import ClientValue
2+
3+
4+
class BroadcastMeetingSettings(ClientValue):
5+
"""Represents settings related to a live event in Microsoft Teams."""

office365/communications/onlinemeetings/online_meeting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def video_teleconference_id(self):
124124
@property
125125
def recordings(self):
126126
# type: () -> EntityCollection[CallRecording]
127-
"""he recordings of an online meeting"""
127+
"""The recordings of an online meeting"""
128128
return self.properties.get(
129129
"recordings",
130130
EntityCollection(

office365/directory/audit/directory.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
from typing import Optional
33

44
from office365.directory.audit.activity_initiator import AuditActivityInitiator
5+
from office365.directory.audit.target_resource import TargetResource
56
from office365.entity import Entity
7+
from office365.runtime.client_value_collection import ClientValueCollection
68

79

810
class DirectoryAudit(Entity):
@@ -25,6 +27,14 @@ def activity_display_name(self):
2527
"""
2628
return self.properties.get("activityDisplayName", None)
2729

30+
@property
31+
def additional_details(self):
32+
# type: () -> Optional[dict]
33+
"""
34+
Indicates additional details on the activity.
35+
"""
36+
return self.properties.get("additionalDetails", None)
37+
2838
@property
2939
def category(self):
3040
# type: () -> Optional[str]
@@ -69,6 +79,14 @@ def logged_by_service(self):
6979
"""
7080
return self.properties.get("loggedByService", None)
7181

82+
@property
83+
def result(self):
84+
# type: () -> Optional[str]
85+
"""
86+
Indicates the result of the activity. Possible values are: success, failure, timeout, unknownFutureValue.
87+
"""
88+
return self.properties.get("result", None)
89+
7290
@property
7391
def result_reason(self):
7492
# type: () -> Optional[str]
@@ -77,11 +95,24 @@ def result_reason(self):
7795
"""
7896
return self.properties.get("resultReason", None)
7997

98+
@property
99+
def target_resources(self):
100+
# type: () -> Optional[str]
101+
"""
102+
Indicates information on which resource was changed due to the activity. Target Resource Type can be User,
103+
Device, Directory, App, Role, Group, Policy or Other. Supports $filter (eq) for id and displayName;
104+
and $filter (startswith) for displayName.
105+
"""
106+
return self.properties.get(
107+
"targetResources", ClientValueCollection(TargetResource)
108+
)
109+
80110
def get_property(self, name, default_value=None):
81111
if default_value is None:
82112
property_mapping = {
83113
"activityDateTime": self.activity_datetime,
84114
"initiatedBy": self.initiated_by,
115+
"targetResources": self.target_resources,
85116
}
86117
default_value = property_mapping.get(name, None)
87118
return super(DirectoryAudit, self).get_property(name, default_value)

office365/directory/audit/signins/signin.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33

44
from office365.directory.audit.signins.location import SignInLocation
55
from office365.directory.audit.signins.status import SignInStatus
6+
from office365.directory.policies.applied_conditional_access import (
7+
AppliedConditionalAccessPolicy,
8+
)
69
from office365.entity import Entity
710
from office365.intune.devices.detail import DeviceDetail
11+
from office365.runtime.client_value_collection import ClientValueCollection
812

913

1014
class SignIn(Entity):
@@ -24,6 +28,15 @@ def app_id(self):
2428
"""Unique GUID representing the app ID in the Azure Active Directory."""
2529
return self.properties.get("appId", None)
2630

31+
@property
32+
def applied_conditional_access_policies(self):
33+
# type: () -> Optional[str]
34+
"""Provides a list of conditional access policies that the corresponding sign-in activity triggers."""
35+
return self.properties.get(
36+
"appliedConditionalAccessPolicies",
37+
ClientValueCollection(AppliedConditionalAccessPolicy),
38+
)
39+
2740
@property
2841
def client_app_used(self):
2942
# type: () -> Optional[str]
@@ -122,6 +135,7 @@ def status(self):
122135
def get_property(self, name, default_value=None):
123136
if default_value is None:
124137
property_mapping = {
138+
"appliedConditionalAccessPolicies": self.applied_conditional_access_policies,
125139
"createdDateTime": self.created_datetime,
126140
"deviceDetail": self.device_detail,
127141
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.runtime.client_value import ClientValue
2+
3+
4+
class TargetResource(ClientValue):
5+
"""Represents target resource types associated with audit activity."""
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from office365.directory.identitygovernance.accessreview.stages import AccessReviewStageCollection
2+
from office365.entity import Entity
3+
from office365.runtime.paths.resource_path import ResourcePath
4+
5+
6+
class AccessReviewInstance(Entity):
7+
"""
8+
Represents a Microsoft Entra access review recurrence. If the parent accessReviewScheduleDefinition is a
9+
recurring access review, instances represent each recurrence. A review that does not recur will have exactly
10+
one instance. Instances also represent each unique group being reviewed in the schedule definition.
11+
If a schedule definition reviews multiple groups, each group will have a unique instance for each recurrence.
12+
13+
Every accessReviewInstance contains a list of decisions that reviewers can take action on.
14+
There is one decision per identity being reviewed.
15+
"""
16+
17+
@property
18+
def stages(self):
19+
# type: () -> AccessReviewStageCollection
20+
"""If the instance has multiple stages, this returns the collection of stages.
21+
A new stage will only be created when the previous stage ends"""
22+
return self.properties.get(
23+
"stages",
24+
AccessReviewStageCollection(
25+
self.context, ResourcePath("stages", self.resource_path)
26+
),
27+
)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from office365.entity import Entity
2+
3+
4+
class AccessReviewStage(Entity):
5+
"""
6+
Represents a stage of a Microsoft Entra access review. If the parent accessReviewScheduleDefinition has defined
7+
the stageSettings property, the accessReviewInstance is comprised of up to three subsequent stages.
8+
Each stage may have a different set of reviewers who can act on the stage decisions, and settings determining
9+
which decisions pass from stage to stage.
10+
11+
Every accessReviewStage contains a list of decision items for reviewers.
12+
There's only one decision per identity being reviewed.
13+
"""
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from office365.directory.identitygovernance.accessreview.stage import AccessReviewStage
2+
from office365.entity_collection import EntityCollection
3+
4+
5+
class AccessReviewStageCollection(EntityCollection[AccessReviewStage]):
6+
"""AccessReviewStage collection"""
7+
8+
def __init__(self, context, resource_path=None):
9+
super(AccessReviewStageCollection, self).__init__(context, AccessReviewStage, resource_path)

office365/directory/insights/trending.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
from datetime import datetime
2+
from typing import Optional
3+
4+
from office365.directory.insights.resource_reference import ResourceReference
15
from office365.entity import Entity
26
from office365.runtime.paths.resource_path import ResourcePath
37

@@ -8,10 +12,31 @@ class Trending(Entity):
812
OneDrive files, and files stored on SharePoint team sites can trend around the user.
913
"""
1014

15+
@property
16+
def last_modified_datetime(self):
17+
# type: () -> Optional[datetime]
18+
"""Gets date and time the item was last modified."""
19+
return self.properties.get("lastModifiedDateTime", datetime.min)
20+
21+
@property
22+
def resource_reference(self):
23+
# type: () -> ResourceReference
24+
"""Reference properties of the trending document, such as the url and type of the document."""
25+
return self.properties.get("resourceReference", ResourceReference())
26+
1127
@property
1228
def resource(self):
1329
"""Used for navigating to the trending document."""
1430
return self.properties.get(
1531
"resource",
1632
Entity(self.context, ResourcePath("resource", self.resource_path)),
1733
)
34+
35+
def get_property(self, name, default_value=None):
36+
if default_value is None:
37+
property_mapping = {
38+
"lastModifiedDateTime": self.last_modified_datetime,
39+
"resourceReference": self.resource_reference,
40+
}
41+
default_value = property_mapping.get(name, None)
42+
return super(Trending, self).get_property(name, default_value)

0 commit comments

Comments
 (0)