Skip to content

Commit 4b68bc9

Browse files
committed
SharePoint API: initial support for syntex, Intune API changes
1 parent 3af062c commit 4b68bc9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1937
-296
lines changed

examples/sharepoint/load_web_fluent_api.py

-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,3 @@
44
ctx = ClientContext(test_site_url).with_credentials(test_client_credentials)
55
target_web = ctx.web.get().execute_query()
66
print(target_web.url)
7-
8-
#ctx.load(ctx.web).execute_query()
9-
#print(ctx.web.url)
10-

generator/metadata/MicrosoftGraph.xml

+1,286-231
Large diffs are not rendered by default.

generator/metadata/SharePoint.xml

+273-5
Large diffs are not rendered by default.

office365/directory/applications/template.py

+16
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,19 @@ def categories(self):
2323
Project management, Telecommunications, Tools, Travel, and Web design & hosting.
2424
"""
2525
return self.properties.get("categories", StringCollection())
26+
27+
@property
28+
def supported_provisioning_types(self):
29+
"""
30+
The list of provisioning modes supported by this application
31+
"""
32+
return self.properties.get("supportedProvisioningTypes", StringCollection())
33+
34+
@property
35+
def supported_single_signon_modes(self):
36+
"""
37+
The list of single sign-on modes supported by this application.
38+
The supported values are oidc, password, saml, and notSupported.
39+
"""
40+
return self.properties.get("supportedSingleSignOnModes", StringCollection())
41+

office365/directory/audit/log_root.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from office365.directory.audit.directory_audit import DirectoryAudit
1+
from office365.directory.audit.directory import DirectoryAudit
22
from office365.directory.audit.provisioning_object_summary import ProvisioningObjectSummary
33
from office365.directory.audit.signIn import SignIn
44
from office365.entity import Entity

office365/directory/object.py

+13-5
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,32 @@ def get_member_groups(self, security_enabled_only=True):
4040
"""Return all the groups that the specified user, group, or directory object is a member of. This function is
4141
transitive.
4242
43-
:type security_enabled_only: bool"""
44-
result = ClientResult(self.context)
43+
:param bool security_enabled_only: true to specify that only security groups that the entity is a member
44+
of should be returned; false to specify that all groups and directory roles that the entity is a member
45+
of should be returned. true can be specified only for users or service principals to return security-enabled
46+
groups.
47+
"""
48+
return_type = ClientResult(self.context, StringCollection())
4549
payload = {
4650
"securityEnabledOnly": security_enabled_only
4751
}
48-
qry = ServiceOperationQuery(self, "getMemberGroups", None, payload, None, result)
52+
qry = ServiceOperationQuery(self, "getMemberGroups", None, payload, None, return_type)
4953
self.context.add_query(qry)
50-
return result
54+
return return_type
5155

5256
def restore(self):
5357
"""
58+
Restore a recently deleted application, group, servicePrincipal, administrative unit, or user object from
59+
deleted items. If an item was accidentally deleted, you can fully restore the item. This is not applicable
60+
to security groups, which are deleted permanently.
5461
62+
A recently deleted item will remain available for up to 30 days. After 30 days, the item is permanently deleted.
5563
"""
5664
qry = ServiceOperationQuery(self, "restore")
5765
self.context.add_query(qry)
5866
return self
5967

6068
@property
6169
def deleted_datetime(self):
62-
"""ETag for the item."""
70+
"""Date and time when this object was deleted. Always null when the object hasn't been deleted."""
6371
return self.properties.get('deletedDateTime', None)

office365/graph_client.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
from office365.directory.resource_specific_permission_grant import ResourceSpecificPermissionGrant
1717
from office365.directory.roles.management import RoleManagement
1818
from office365.directory.roles.role import DirectoryRole
19-
from office365.intune.organizations.org_contact import OrgContact
19+
from office365.intune.devices.app_management import DeviceAppManagement
20+
from office365.intune.devices.management import DeviceManagement
21+
from office365.intune.organizations.contact import OrgContact
2022
from office365.intune.organizations.organization import Organization
2123
from office365.directory.policies.root import PolicyRoot
2224
from office365.directory.subscriptions.subscription import Subscription
@@ -108,6 +110,16 @@ def me(self):
108110
"""The Me endpoint is provided as a shortcut for specifying the current user"""
109111
return User(self, MePath())
110112

113+
@property
114+
def device_management(self):
115+
"""Singleton entity that acts as a container for all device management functionality."""
116+
return DeviceManagement(self, ResourcePath("deviceManagement"))
117+
118+
@property
119+
def device_app_management(self):
120+
"""Singleton entity that acts as a container for all device and app management functionality."""
121+
return DeviceAppManagement(self, ResourcePath("deviceAppManagement"))
122+
111123
@property
112124
def drives(self):
113125
"""Get one drives"""
File renamed without changes.

office365/intune/audit/event.py

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from office365.entity import Entity
2+
from office365.entity_collection import EntityCollection
3+
from office365.runtime.client_result import ClientResult
4+
from office365.runtime.queries.function import FunctionQuery
5+
from office365.runtime.types.collections import StringCollection
6+
7+
8+
class AuditEvent(Entity):
9+
"""A class containing the properties for Audit Event."""
10+
11+
12+
class AuditEventCollection(EntityCollection):
13+
14+
def __init__(self, context, resource_path=None):
15+
super(AuditEventCollection, self).__init__(context, AuditEvent, resource_path)
16+
17+
def get_audit_categories(self):
18+
return_type = ClientResult(self.context, StringCollection())
19+
qry = FunctionQuery(self, "getAuditCategories", None, return_type)
20+
self.context.add_query(qry)
21+
return return_type
22+
23+
def get_audit_activity_types(self, category):
24+
""""""
25+
return_type = ClientResult(self.context, StringCollection())
26+
params = {"category": category}
27+
qry = FunctionQuery(self, "getAuditActivityTypes", params, return_type)
28+
self.context.add_query(qry)
29+
return return_type
30+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.entity import Entity
2+
3+
4+
class DeviceAppManagement(Entity):
5+
"""Singleton entity that acts as a container for all device and app management functionality."""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.entity import Entity
2+
3+
4+
class DeviceConfiguration(Entity):
5+
"""Device Configuration."""
+21-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
from office365.entity import Entity
2+
from office365.intune.audit.event import AuditEventCollection
3+
from office365.runtime.paths.resource_path import ResourcePath
24

35

46
class DeviceManagement(Entity):
5-
pass
7+
"""
8+
The deviceManagement resource represents a tenant's collection device identities that have been pre-staged in
9+
Intune, and the enrollment profiles that may be assigned to device identities that support pre-enrollment
10+
configuration.
11+
"""
12+
13+
@property
14+
def audit_events(self):
15+
""""""
16+
return self.properties.get("auditEvents", AuditEventCollection(self.context,
17+
ResourcePath("auditEvents", self.resource_path)))
18+
19+
def get_property(self, name, default_value=None):
20+
if default_value is None:
21+
property_mapping = {
22+
"auditEvents": self.audit_events
23+
}
24+
default_value = property_mapping.get(name, None)
25+
return super(DeviceManagement, self).get_property(name, default_value)

office365/onedrive/driveitems/driveItem.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ def preview(self, page, zoom=None):
395395
self.context.add_query(qry)
396396
return result
397397

398-
def validate_permission(self, challenge_token, password):
398+
def validate_permission(self, challenge_token=None, password=None):
399399
"""
400400
:type challenge_token: str
401401
:type password: str
@@ -404,8 +404,7 @@ def validate_permission(self, challenge_token, password):
404404
"challengeToken": challenge_token,
405405
"password": password
406406
}
407-
result = ClientResult(self.context, ItemPreviewInfo())
408-
qry = ServiceOperationQuery(self, "validatePermission", None, payload, None, result)
407+
qry = ServiceOperationQuery(self, "validatePermission", None, payload)
409408
self.context.add_query(qry)
410409
return self
411410

office365/sharepoint/client_context.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ def micro_service_manager(self):
347347
@property
348348
def models(self):
349349
"""Alias to collection of SPMachineLearningModel"""
350-
from office365.sharepoint.contentcenter.machinelearning.model_collection import SPMachineLearningModelCollection
350+
from office365.sharepoint.contentcenter.machinelearning.models.collection import SPMachineLearningModelCollection
351351
return SPMachineLearningModelCollection(self, ResourcePath("models"))
352352

353353
@property
@@ -465,7 +465,7 @@ def home_site(self):
465465
@property
466466
def publications(self):
467467
from office365.sharepoint.base_entity_collection import BaseEntityCollection
468-
from office365.sharepoint.contentcenter.machinelearning.publication import SPMachineLearningPublication
468+
from office365.sharepoint.contentcenter.machinelearning.publications.publication import SPMachineLearningPublication
469469
return BaseEntityCollection(self, SPMachineLearningPublication, ResourcePath("publications"))
470470

471471
@property
@@ -499,7 +499,7 @@ def tenant_settings(self):
499499

500500
@property
501501
def work_items(self):
502-
from office365.sharepoint.contentcenter.machinelearning.work_item_collection import \
502+
from office365.sharepoint.contentcenter.machinelearning.workitems.collection import \
503503
SPMachineLearningWorkItemCollection
504504
return SPMachineLearningWorkItemCollection(self, ResourcePath("workitems"))
505505

office365/sharepoint/compliance/tag.py

+8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33

44
class ComplianceTag(ClientValue):
55

6+
def __init__(self, accept_messages_only_from_senders_or_members=None, access_type=None):
7+
"""
8+
:param bool accept_messages_only_from_senders_or_members:
9+
:param str access_type:
10+
"""
11+
self.AcceptMessagesOnlyFromSendersOrMembers = accept_messages_only_from_senders_or_members
12+
self.AccessType = access_type
13+
614
@property
715
def entity_type_name(self):
816
return "SP.CompliancePolicy.ComplianceTag"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from office365.sharepoint.base_entity import BaseEntity
2+
3+
4+
class SPMachineLearningEnabled(BaseEntity):
5+
6+
@property
7+
def entity_type_name(self):
8+
return "Microsoft.Office.Server.ContentCenter.SPMachineLearningEnabled"

office365/sharepoint/contentcenter/machinelearning/hub.py

+52-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
1+
from office365.runtime.client_result import ClientResult
2+
from office365.runtime.client_value_collection import ClientValueCollection
3+
from office365.runtime.paths.resource_path import ResourcePath
14
from office365.runtime.queries.service_operation import ServiceOperationQuery
25
from office365.sharepoint.base_entity import BaseEntity
3-
from office365.sharepoint.contentcenter.machinelearning.model_collection import SPMachineLearningModelCollection
6+
from office365.sharepoint.compliance.tag import ComplianceTag
7+
from office365.sharepoint.contentcenter.machinelearning.enabled import SPMachineLearningEnabled
8+
from office365.sharepoint.contentcenter.machinelearning.models.collection import SPMachineLearningModelCollection
9+
from office365.sharepoint.contentcenter.machinelearning.samples.collection import SPMachineLearningSampleCollection
10+
from office365.sharepoint.contentcenter.syntex_models_landing_info import SyntexModelsLandingInfo
411

512

613
class SPMachineLearningHub(BaseEntity):
714

15+
def get_by_content_type_id(self, content_type_id):
16+
"""
17+
:param str content_type_id:
18+
"""
19+
return_type = SyntexModelsLandingInfo(self.context)
20+
payload = {
21+
"contentTypeId": content_type_id
22+
}
23+
qry = ServiceOperationQuery(self, "GetByContentTypeId", None, payload, None, return_type)
24+
self.context.add_query(qry)
25+
return return_type
26+
827
def get_models(self, list_id=None, model_types=None, publication_types=None,
928
include_management_not_allowed_models=None):
1029
"""
@@ -24,6 +43,20 @@ def get_models(self, list_id=None, model_types=None, publication_types=None,
2443
self.context.add_query(qry)
2544
return return_type
2645

46+
def get_retention_labels(self):
47+
return_type = ClientResult(self.context, ClientValueCollection(ComplianceTag))
48+
qry = ServiceOperationQuery(self, "GetRetentionLabels", None, None, None, return_type)
49+
self.context.add_query(qry)
50+
return return_type
51+
52+
def get_property(self, name, default_value=None):
53+
if default_value is None:
54+
property_mapping = {
55+
"MachineLearningEnabled": self.machine_learning_enabled,
56+
}
57+
default_value = property_mapping.get(name, None)
58+
return super(SPMachineLearningHub, self).get_property(name, default_value)
59+
2760
@property
2861
def is_default_content_center(self):
2962
"""
@@ -38,6 +71,24 @@ def machine_learning_capture_enabled(self):
3871
"""
3972
return self.properties.get("MachineLearningCaptureEnabled", None)
4073

74+
@property
75+
def machine_learning_enabled(self):
76+
return self.properties.get("MachineLearningEnabled",
77+
SPMachineLearningEnabled(self.context,
78+
ResourcePath("MachineLearningEnabled", self.resource_path)))
79+
80+
@property
81+
def models(self):
82+
return self.properties.get("Models",
83+
SPMachineLearningModelCollection(self.context,
84+
ResourcePath("Models", self.resource_path)))
85+
86+
@property
87+
def samples(self):
88+
return self.properties.get("Samples",
89+
SPMachineLearningSampleCollection(self.context,
90+
ResourcePath("Samples", self.resource_path)))
91+
4192
@property
4293
def entity_type_name(self):
4394
return "Microsoft.Office.Server.ContentCenter.SPMachineLearningHub"

office365/sharepoint/contentcenter/machinelearning/models/__init__.py

Whitespace-only changes.

office365/sharepoint/contentcenter/machinelearning/model_collection.py office365/sharepoint/contentcenter/machinelearning/models/collection.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from office365.runtime.paths.service_operation import ServiceOperationPath
22
from office365.sharepoint.base_entity_collection import BaseEntityCollection
3-
from office365.sharepoint.contentcenter.machinelearning.model import SPMachineLearningModel
3+
from office365.sharepoint.contentcenter.machinelearning.models.model import SPMachineLearningModel
44

55

66
class SPMachineLearningModelCollection(BaseEntityCollection):

office365/sharepoint/contentcenter/machinelearning/publications/__init__.py

Whitespace-only changes.

office365/sharepoint/contentcenter/machinelearning/samples/__init__.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from office365.runtime.paths.service_operation import ServiceOperationPath
2+
from office365.sharepoint.base_entity_collection import BaseEntityCollection
3+
from office365.sharepoint.contentcenter.machinelearning.samples.sample import SPMachineLearningSample
4+
5+
6+
class SPMachineLearningSampleCollection(BaseEntityCollection):
7+
8+
def __init__(self, context, resource_path=None):
9+
super(SPMachineLearningSampleCollection, self).__init__(context, SPMachineLearningSample, resource_path)
10+
11+
def get_by_title(self, title):
12+
"""
13+
:param str title: The title of the model to return.
14+
"""
15+
return SPMachineLearningSample(self.context,
16+
ServiceOperationPath("GetByTitle", [title], self.resource_path))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from office365.sharepoint.base_entity import BaseEntity
2+
3+
4+
class SPMachineLearningSample(BaseEntity):
5+
6+
@property
7+
def entity_type_name(self):
8+
return "Microsoft.Office.Server.ContentCenter.SPMachineLearningSample"
9+
10+

office365/sharepoint/contentcenter/machinelearning/workitems/__init__.py

Whitespace-only changes.

office365/sharepoint/contentcenter/machinelearning/work_item_collection.py office365/sharepoint/contentcenter/machinelearning/workitems/collection.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from office365.sharepoint.base_entity_collection import BaseEntityCollection
2-
from office365.sharepoint.contentcenter.machinelearning.work_item import SPMachineLearningWorkItem
2+
from office365.sharepoint.contentcenter.machinelearning.workitems.item import SPMachineLearningWorkItem
33

44

55
class SPMachineLearningWorkItemCollection(BaseEntityCollection):
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from office365.sharepoint.base_entity import BaseEntity
2+
3+
4+
class SyntexModelsLandingInfo(BaseEntity):
5+
6+
@property
7+
def entity_type_name(self):
8+
return "Microsoft.Office.Server.ContentCenter.SyntexModelsLandingInfo"
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
1+
from office365.runtime.client_value_collection import ClientValueCollection
12
from office365.sharepoint.base_entity import BaseEntity
3+
from office365.sharepoint.sharing.shared_with_user import SharedWithUser
24

35

46
class FileVersionEvent(BaseEntity):
57
"""Represents an event object happened on a Microsoft.SharePoint.SPFile."""
68

9+
@property
10+
def event_type(self):
11+
"""Returns the type of the event."""
12+
return self.properties.get("EventType", None)
13+
714
@property
815
def editor(self):
916
"""Returns the name of the user who initiated the event.
1017
1118
:rtype: str or None
1219
"""
1320
return self.properties.get("Editor", None)
21+
22+
@property
23+
def shared_by_user(self):
24+
"""Returns the shared by user Information in sharing action for change log."""
25+
return self.properties.get("SharedByUser", SharedWithUser())
26+
27+
@property
28+
def shared_with_users(self):
29+
"""Returns the array of users that have been shared in sharing action for the change log."""
30+
return self.properties.get("SharedWithUsers", ClientValueCollection(SharedWithUser))

0 commit comments

Comments
 (0)