Skip to content

Commit

Permalink
Intune new types, SharePoint API sharing namespace updates
Browse files Browse the repository at this point in the history
  • Loading branch information
vgrem committed Aug 19, 2023
1 parent 47e1eb0 commit fd4cbb8
Show file tree
Hide file tree
Showing 31 changed files with 418 additions and 30 deletions.
5 changes: 0 additions & 5 deletions examples/sharepoint/folders/coloring_information.py

This file was deleted.

2 changes: 1 addition & 1 deletion examples/sharepoint/listitems/delete_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from tests import test_team_site_url, test_client_credentials

ctx = ClientContext(test_team_site_url).with_credentials(test_client_credentials)
items_count = 2
items_count = 100

# 1. Load existing list items
list_tasks = ctx.web.lists.get_by_title("Tasks")
Expand Down
21 changes: 21 additions & 0 deletions generator/metadata/MicrosoftGraph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20343,6 +20343,7 @@
<Property Name="provisionedPlans" Type="Collection(graph.provisionedPlan)" Nullable="false"/>
<Property Name="proxyAddresses" Type="Collection(Edm.String)" Nullable="false"/>
<Property Name="securityIdentifier" Type="Edm.String"/>
<Property Name="serviceProvisioningErrors" Type="Collection(graph.serviceProvisioningError)"/>
<Property Name="showInAddressList" Type="Edm.Boolean"/>
<Property Name="signInSessionsValidFromDateTime" Type="Edm.DateTimeOffset"/>
<Property Name="state" Type="Edm.String"/>
Expand Down Expand Up @@ -20482,6 +20483,11 @@
<Property Name="provisioningStatus" Type="Edm.String"/>
<Property Name="service" Type="Edm.String"/>
</ComplexType>
<ComplexType Name="serviceProvisioningError" Abstract="true">
<Property Name="createdDateTime" Type="Edm.DateTimeOffset"/>
<Property Name="isResolved" Type="Edm.Boolean"/>
<Property Name="serviceInstance" Type="Edm.String"/>
</ComplexType>
<EntityType Name="appRoleAssignment" BaseType="graph.directoryObject">
<Property Name="appRoleId" Type="Edm.Guid" Nullable="false"/>
<Property Name="createdDateTime" Type="Edm.DateTimeOffset"/>
Expand Down Expand Up @@ -21502,6 +21508,7 @@
<Property Name="modifiedDateTime" Type="Edm.DateTimeOffset"/>
<Property Name="sessionControls" Type="graph.conditionalAccessSessionControls"/>
<Property Name="state" Type="graph.conditionalAccessPolicyState" Nullable="false"/>
<Property Name="templateId" Type="Edm.String"/>
</EntityType>
<EntityType Name="conditionalAccessTemplate" BaseType="graph.entity">
<Property Name="description" Type="Edm.String" Nullable="false"/>
Expand Down Expand Up @@ -22016,6 +22023,7 @@
<Property Name="renewedDateTime" Type="Edm.DateTimeOffset"/>
<Property Name="securityEnabled" Type="Edm.Boolean"/>
<Property Name="securityIdentifier" Type="Edm.String"/>
<Property Name="serviceProvisioningErrors" Type="Collection(graph.serviceProvisioningError)"/>
<Property Name="theme" Type="Edm.String"/>
<Property Name="visibility" Type="Edm.String"/>
<Property Name="allowExternalSenders" Type="Edm.Boolean"/>
Expand Down Expand Up @@ -22639,6 +22647,9 @@
<Property Name="servicePlanId" Type="Edm.Guid"/>
<Property Name="servicePlanName" Type="Edm.String"/>
</ComplexType>
<ComplexType Name="serviceProvisioningXmlError" BaseType="graph.serviceProvisioningError">
<Property Name="errorDetail" Type="Edm.String"/>
</ComplexType>
<ComplexType Name="settingTemplateValue">
<Property Name="defaultValue" Type="Edm.String"/>
<Property Name="description" Type="Edm.String"/>
Expand Down Expand Up @@ -22976,6 +22987,7 @@
<Property Name="onPremisesSyncEnabled" Type="Edm.Boolean"/>
<Property Name="phones" Type="Collection(graph.phone)"/>
<Property Name="proxyAddresses" Type="Collection(Edm.String)" Nullable="false"/>
<Property Name="serviceProvisioningErrors" Type="Collection(graph.serviceProvisioningError)"/>
<Property Name="surname" Type="Edm.String"/>
<NavigationProperty Name="directReports" Type="Collection(graph.directoryObject)"/>
<NavigationProperty Name="manager" Type="graph.directoryObject"/>
Expand Down Expand Up @@ -31004,6 +31016,15 @@
<Parameter Name="bindingParameter" Type="graph.user" Nullable="false"/>
<ReturnType Type="graph.user"/>
</Action>
<Action Name="retryServiceProvisioning" IsBound="true">
<Parameter Name="bindingParameter" Type="graph.user" Nullable="false"/>
</Action>
<Action Name="retryServiceProvisioning" IsBound="true">
<Parameter Name="bindingParameter" Type="graph.group" Nullable="false"/>
</Action>
<Action Name="retryServiceProvisioning" IsBound="true">
<Parameter Name="bindingParameter" Type="graph.orgContact" Nullable="false"/>
</Action>
<Action Name="revokeSignInSessions" IsBound="true">
<Parameter Name="bindingParameter" Type="graph.user" Nullable="false"/>
<ReturnType Type="Edm.Boolean"/>
Expand Down
18 changes: 17 additions & 1 deletion office365/communications/calls/invitation_participant_info.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
from office365.directory.permissions.identity_set import IdentitySet
from office365.runtime.client_value import ClientValue


class InvitationParticipantInfo(ClientValue):
"""This resource is used to represent the entity that is being invited to a group call."""
pass

def __init__(self, hidden=None, identity=IdentitySet(), participant_id=None,
remove_from_default_audio_routing_group=None, replaces_call_id=None):
"""
:param bool hidden: Optional. Whether to hide the participant from the roster.
:param IdentitySet identity: The identitySet associated with this invitation.
:param str participant_id: Optional. The ID of the target participant.
:param bool remove_from_default_audio_routing_group: Optional. Whether to remove them from the main mixer.
:param str replaces_call_id: Optional. The call which the target identity is currently a part of.
For peer-to-peer case, the call will be dropped once the participant is added successfully.
"""
self.hidden = hidden
self.identity = identity
self.participantId = participant_id
self.removeFromDefaultAudioRoutingGroup = remove_from_default_audio_routing_group
self.replacesCallId = replaces_call_id
9 changes: 9 additions & 0 deletions office365/communications/calls/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,12 @@

class CallOptions(ClientValue):
"""Represents an abstract base class that contains the optional features for a call."""

def __init__(self, hide_bot_after_escalation=None, is_content_sharing_notification_enabled=None):
"""
:param bool hide_bot_after_escalation: Indicates whether to hide the app after the call is escalated.
:param bool is_content_sharing_notification_enabled: Indicates whether content sharing notifications should be
enabled for the call.
"""
self.hideBotAfterEscalation = hide_bot_after_escalation
self.isContentSharingNotificationEnabled = is_content_sharing_notification_enabled
9 changes: 9 additions & 0 deletions office365/directory/authentication/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ class Authentication(Entity):
for users.
"""

@property
def email_methods(self):
"""The email address registered to a user for authentication."""
from office365.directory.authentication.methods.email import EmailAuthenticationMethod
return self.properties.get('emailMethods',
EntityCollection(self.context, EmailAuthenticationMethod,
ResourcePath("emailMethods", self.resource_path)))

@property
def fido2_methods(self):
"""Represents the FIDO2 security keys registered to a user for authentication."""
Expand Down Expand Up @@ -45,6 +53,7 @@ def methods(self):
def get_property(self, name, default_value=None):
if default_value is None:
property_mapping = {
"emailMethods": self.email_methods,
"fido2Methods": self.fido2_methods,
"passwordMethods": self.password_methods,
"phoneMethods": self.phone_methods
Expand Down
16 changes: 16 additions & 0 deletions office365/directory/authentication/methods/email.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from office365.directory.authentication.methods.method import AuthenticationMethod


class EmailAuthenticationMethod(AuthenticationMethod):
"""
Represents an email address registered to a user. Email as an authentication method is available only for
self-service password reset (SSPR). Users may only have one email authentication method.
"""

@property
def email_address(self):
"""
The email address registered to this user.
:rtype: str
"""
return self.properties.get("emailAddress", None)
2 changes: 2 additions & 0 deletions office365/directory/identities/governance.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ class IdentityGovernance(Entity):
- App consent
- Terms of use
"""


16 changes: 15 additions & 1 deletion office365/directory/insights/shared.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from office365.directory.insights.resource_reference import ResourceReference
from office365.directory.insights.sharing_detail import SharingDetail
from office365.entity import Entity
from office365.runtime.client_value_collection import ClientValueCollection
from office365.runtime.paths.resource_path import ResourcePath


Expand All @@ -12,6 +14,11 @@ class SharedInsight(Entity):
that users share as a links in an email.
"""

@property
def last_shared(self):
"""Details about the shared item. Read-only"""
return self.properties.get("lastShared", SharingDetail())

@property
def resource_reference(self):
"""Reference properties of the used document, such as the url and type of the document. Read-only"""
Expand All @@ -24,10 +31,17 @@ def resource(self):
return self.properties.get('resource',
Entity(self.context, ResourcePath("resource", self.resource_path)))

@property
def sharing_history(self):
"""Details about the sharing history. Read-only"""
return self.properties.get("sharingHistory", ClientValueCollection(SharingDetail))

def get_property(self, name, default_value=None):
if default_value is None:
property_mapping = {
"resourceReference": self.resource_reference
"lastShared": self.last_shared,
"resourceReference": self.resource_reference,
"sharingHistory": self.sharing_history
}
default_value = property_mapping.get(name, None)
return super(SharedInsight, self).get_property(name, default_value)
8 changes: 8 additions & 0 deletions office365/directory/rolemanagement/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,11 @@
class DirectoryRoleTemplate(DirectoryObject):
"""Represents a directory role template. A directory role template specifies the property values of a directory
role (directoryRole). """

@property
def display_name(self):
"""
The display name to set for the directory role
:rtype: str
"""
return self.properties.get("displayName", None)
96 changes: 93 additions & 3 deletions office365/directory/users/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from office365.directory.permissions.grants.oauth2 import OAuth2PermissionGrant
from office365.directory.profile_photo import ProfilePhoto
from office365.directory.users.activities.collection import UserActivityCollection
from office365.directory.users.password_profile import PasswordProfile
from office365.directory.users.settings import UserSettings
from office365.entity_collection import EntityCollection
from office365.intune.devices.data import DeviceAndAppManagementData
Expand Down Expand Up @@ -353,6 +354,13 @@ def translate_exchange_ids(self, input_ids, source_id_type=None, target_id_type=
self.context.add_query(qry)
return return_type

@property
def device_enrollment_limit(self):
"""
:rtype: str
"""
return self.properties.get('deviceEnrollmentLimit', None)

@property
def sign_in_activity(self):
"""Get the last signed-in date and request ID of the sign-in for a given user. Read-only."""
Expand Down Expand Up @@ -459,6 +467,11 @@ def other_mails(self):
"""
return self.properties.get('otherMails', StringCollection())

@property
def interests(self):
"""A list for the user to describe their interests."""
return self.properties.get("interests", StringCollection())

@property
def identities(self):
"""Represents the identities that can be used to sign in to this user account.
Expand Down Expand Up @@ -614,10 +627,29 @@ def oauth2_permission_grants(self):
DeltaCollection(self.context, OAuth2PermissionGrant,
ResourcePath("oauth2PermissionGrants", self.resource_path)))

@property
def on_premises_distinguished_name(self):
"""
Contains the on-premises Active Directory distinguished name or DN. The property is only populated for
customers who are synchronizing their on-premises directory to Azure Active Directory via Azure AD Connect
:rtype: str
"""
return self.properties.get('onPremisesDistinguishedName', None)

@property
def on_premises_domain_name(self):
"""
Contains the on-premises domainFQDN, also called dnsDomainName synchronized from the on-premises directory.
The property is only populated for customers who are synchronizing their on-premises directory to
Azure Active Directory via Azure AD Connect.
:rtype: str
"""
return self.properties.get('onPremisesDomainName', None)

@property
def owned_devices(self):
"""Devices that are owned by the user. Read-only. Nullable. Supports $expand and $filter
(/$count eq 0, /$count ne 0, /$count eq 1, /$count ne 1). """
"""Devices that are owned by the user. Read-only. Nullable.
Supports $expand and $filter (/$count eq 0, /$count ne 0, /$count eq 1, /$count ne 1). """
return self.properties.get('ownedDevices',
DirectoryObjectCollection(self.context,
ResourcePath("ownedDevices", self.resource_path)))
Expand All @@ -629,6 +661,18 @@ def owned_objects(self):
DirectoryObjectCollection(self.context,
ResourcePath("ownedObjects", self.resource_path)))

@property
def proxy_addresses(self):
"""
For example: ["SMTP: [email protected]", "smtp: [email protected]"]. Changes to the mail property will
also update this collection to include the value as an SMTP address. For more information, see mail and
proxyAddresses properties. The proxy address prefixed with SMTP (capitalized) is the primary proxy address
while those prefixed with smtp are the secondary proxy addresses. For Azure AD B2C accounts, this
property has a limit of ten unique addresses. Read-only in Microsoft Graph; you can update this property
only through the Microsoft 365 admin center. Not nullable.
"""
return self.properties.get('proxyAddresses', StringCollection())

@property
def transitive_member_of(self):
"""Get groups, directory roles that the user is a member of. This API request is transitive, and will also
Expand Down Expand Up @@ -693,6 +737,26 @@ def online_meetings(self):
OnlineMeetingCollection(self.context,
ResourcePath("onlineMeetings", self.resource_path)))

@property
def password_policies(self):
"""
Specifies password policies for the user. This value is an enumeration with one possible value being
DisableStrongPassword, which allows weaker passwords than the default policy to be specified.
DisablePasswordExpiration can also be specified. The two may be specified together; for example:
DisablePasswordExpiration, DisableStrongPassword.
:rtype: str
"""
return self.properties.get('passwordPolicies', None)

@property
def password_profile(self):
"""
Specifies the password profile for the user. The profile contains the user's password.
This property is required when a user is created. The password in the profile must satisfy minimum
requirements as specified by the passwordPolicies property. By default, a strong password is required.
"""
return self.properties.get('passwordProfile', PasswordProfile())

@property
def presence(self):
"""Get a user's presence information."""
Expand All @@ -701,11 +765,27 @@ def presence(self):

@property
def registered_devices(self):
"""Get the devices that are retistered for the user from the registeredDevices navigation property."""
"""Get the devices that are registered for the user from the registeredDevices navigation property."""
return self.properties.get('registeredDevices',
DirectoryObjectCollection(self.context,
ResourcePath("registeredDevices", self.resource_path)))

@property
def street_address(self):
"""
The street address of the user's place of business. Maximum length is 1024 characters.
:rtype: str
"""
return self.properties.get('streetAddress', None)

@property
def security_identifier(self):
"""
Security identifier (SID) of the user, used in Windows scenarios.
:rtype: str
"""
return self.properties.get('securityIdentifier', None)

@property
def teamwork(self):
"""A container for the range of Microsoft Teams functionalities that are available per user in the tenant."""
Expand All @@ -718,6 +798,15 @@ def todo(self):
return self.properties.get('todo',
Todo(self.context, ResourcePath("todo", self.resource_path)))

@property
def usage_location(self):
"""
A two letter country code (ISO standard 3166). Required for users that will be assigned licenses due to
legal requirement to check for availability of services in countries. Examples include: US, JP, and GB.
:rtype: str
"""
return self.properties.get('usageLocation', None)

def get_property(self, name, default_value=None):
if default_value is None:
property_mapping = {
Expand All @@ -739,6 +828,7 @@ def get_property(self, name, default_value=None):
"oauth2PermissionGrants": self.oauth2_permission_grants,
"ownedDevices": self.owned_devices,
"ownedObjects": self.owned_objects,
"passwordProfile": self.password_profile,
"registeredDevices": self.registered_devices,
"signInActivity": self.sign_in_activity
}
Expand Down
Loading

0 comments on commit fd4cbb8

Please sign in to comment.