Skip to content

Commit 93c400d

Browse files
committed
updates for sharepoint model
1 parent 011287d commit 93c400d

File tree

32 files changed

+435
-12
lines changed

32 files changed

+435
-12
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
from office365.graph_client import GraphClient
42
from tests import (
53
test_client_id,
@@ -11,8 +9,10 @@
119
test_client_id, test_client_secret
1210
)
1311

14-
resource = client.service_principals.get_by_app_id("00000003-0000-0ff1-ce00-000000000000")
15-
#principal = client.service_principals.get_by_app_id(test_client_id).get().execute_query()
12+
resource = client.service_principals.get_by_app_id(
13+
"00000003-0000-0ff1-ce00-000000000000"
14+
)
15+
# principal = client.service_principals.get_by_app_id(test_client_id).get().execute_query()
1616
result = resource.get_application_permissions(test_client_id).execute_query()
1717
for app_role in result.value:
1818
print(app_role)
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"""
2+
3+
"""
4+
5+
from office365.sharepoint.client_context import ClientContext
6+
from tests import test_admin_credentials, test_admin_site_url, test_team_site_url
7+
8+
client = ClientContext(test_admin_site_url).with_credentials(test_admin_credentials)
9+
site_props = client.tenant.get_site_properties_by_url(
10+
test_team_site_url, True
11+
).execute_query()
12+
print(site_props)

generator/import_metadata.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ def export_to_file(path, content):
2626
"--endpoint",
2727
dest="endpoint",
2828
help="Import metadata endpoint",
29-
default="sharepoint",
29+
default="graph",
3030
)
3131
parser.add_argument(
3232
"-p",
3333
"--path",
3434
dest="path",
35-
default="./metadata/SharePoint.xml",
35+
default="./metadata/Graph.xml",
3636
help="Import metadata endpoint",
3737
)
3838

generator/metadata/Graph.xml

+32
Original file line numberDiff line numberDiff line change
@@ -29474,6 +29474,20 @@ within the time frame of their original request."/>
2947429474
<NavigationProperty Name="incompatibleAccessPackages" Type="Collection(graph.accessPackage)"/>
2947529475
<NavigationProperty Name="incompatibleGroups" Type="Collection(graph.group)" ContainsTarget="true"/>
2947629476
<NavigationProperty Name="resourceRoleScopes" Type="Collection(graph.accessPackageResourceRoleScope)" ContainsTarget="true"/>
29477+
<Annotation Term="Org.OData.Core.V1.AlternateKeys">
29478+
<Collection>
29479+
<Record Type="Org.OData.Core.V1.AlternateKey">
29480+
<PropertyValue Property="Key">
29481+
<Collection>
29482+
<Record Type="Org.OData.Core.V1.PropertyRef">
29483+
<PropertyValue Property="Alias" String="uniqueName"/>
29484+
<PropertyValue Property="Name" PropertyPath="uniqueName"/>
29485+
</Record>
29486+
</Collection>
29487+
</PropertyValue>
29488+
</Record>
29489+
</Collection>
29490+
</Annotation>
2947729491
</EntityType>
2947829492
<EntityType Name="accessPackageAssignmentPolicy" BaseType="graph.entity">
2947929493
<Property Name="allowedTargetScope" Type="graph.allowedTargetScope"/>
@@ -29483,6 +29497,7 @@ within the time frame of their original request."/>
2948329497
<Property Name="displayName" Type="Edm.String"/>
2948429498
<Property Name="expiration" Type="graph.expirationPattern"/>
2948529499
<Property Name="modifiedDateTime" Type="Edm.DateTimeOffset"/>
29500+
<Property Name="notificationSettings" Type="graph.accessPackageNotificationSettings"/>
2948629501
<Property Name="requestApprovalSettings" Type="graph.accessPackageAssignmentApprovalSettings"/>
2948729502
<Property Name="requestorSettings" Type="graph.accessPackageAssignmentRequestorSettings"/>
2948829503
<Property Name="reviewSettings" Type="graph.accessPackageAssignmentReviewSettings"/>
@@ -29528,6 +29543,20 @@ within the time frame of their original request."/>
2952829543
<NavigationProperty Name="resourceRoles" Type="Collection(graph.accessPackageResourceRole)" ContainsTarget="true"/>
2952929544
<NavigationProperty Name="resources" Type="Collection(graph.accessPackageResource)" ContainsTarget="true"/>
2953029545
<NavigationProperty Name="resourceScopes" Type="Collection(graph.accessPackageResourceScope)" ContainsTarget="true"/>
29546+
<Annotation Term="Org.OData.Core.V1.AlternateKeys">
29547+
<Collection>
29548+
<Record Type="Org.OData.Core.V1.AlternateKey">
29549+
<PropertyValue Property="Key">
29550+
<Collection>
29551+
<Record Type="Org.OData.Core.V1.PropertyRef">
29552+
<PropertyValue Property="Alias" String="uniqueName"/>
29553+
<PropertyValue Property="Name" PropertyPath="uniqueName"/>
29554+
</Record>
29555+
</Collection>
29556+
</PropertyValue>
29557+
</Record>
29558+
</Collection>
29559+
</Annotation>
2953129560
</EntityType>
2953229561
<EntityType Name="connectedOrganization" BaseType="graph.entity">
2953329562
<Property Name="createdDateTime" Type="Edm.DateTimeOffset"/>
@@ -29991,6 +30020,9 @@ within the time frame of their original request."/>
2999130020
<Property Name="removeAccessWhenTargetLeavesAllowedTargets" Type="Edm.Boolean"/>
2999230021
<Property Name="requestAccessForAllowedTargets" Type="Edm.Boolean"/>
2999330022
</ComplexType>
30023+
<ComplexType Name="accessPackageNotificationSettings">
30024+
<Property Name="isAssignmentNotificationDisabled" Type="Edm.Boolean" Nullable="false"/>
30025+
</ComplexType>
2999430026
<ComplexType Name="accessPackageResourceAttribute">
2999530027
<Property Name="destination" Type="graph.accessPackageResourceAttributeDestination"/>
2999630028
<Property Name="isEditable" Type="Edm.Boolean"/>

office365/sharepoint/administration/sitemove/service.py

+32
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
from typing import TYPE_CHECKING
22

3+
from office365.runtime.client_result import ClientResult
4+
from office365.runtime.client_value import ClientValue
35
from office365.runtime.paths.service_operation import ServiceOperationPath
6+
from office365.runtime.queries.service_operation import ServiceOperationQuery
47
from office365.sharepoint.entity import Entity
58

69
if TYPE_CHECKING:
710
from office365.sharepoint.client_context import ClientContext
811

912

13+
class SystemSiteLockExpirationResult(ClientValue):
14+
""""""
15+
16+
def __init__(self, error=None, expiration=None):
17+
self.Error = error
18+
self.Expiration = expiration
19+
20+
1021
class SiteMoveService(Entity):
1122
""" """
1223

@@ -31,6 +42,27 @@ def __init__(
3142
)
3243
super(SiteMoveService, self).__init__(context, static_path)
3344

45+
def acquire_system_site_lock(
46+
self, lock_requestor, lock_type, lease_duration_in_minutes
47+
):
48+
""""""
49+
return_type = ClientResult(self.context, SystemSiteLockExpirationResult())
50+
payload = {
51+
"lockRequestor": lock_requestor,
52+
"lockType": lock_type,
53+
"leaseDurationInMinutes": lease_duration_in_minutes,
54+
}
55+
qry = ServiceOperationQuery(
56+
self,
57+
"AcquireSystemSiteLock",
58+
None,
59+
payload,
60+
None,
61+
return_type,
62+
)
63+
self.context.add_query(qry)
64+
return return_type
65+
3466
@property
3567
def entity_type_name(self):
3668
return "Microsoft.SharePoint.Administration.SiteMove.Service.SiteMoveService"

office365/sharepoint/changes/item.py

+15
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ def content_type_id(self):
2020
"""Specifies an identifier for the content type"""
2121
return self.properties.get("ContentTypeId", ContentTypeId())
2222

23+
@property
24+
def editor(self):
25+
"""Specifies the editor of the changed item."""
26+
return self.properties.get("Editor", None)
27+
28+
@property
29+
def editor_email_hint(self):
30+
"""Returns the email corresponding to Editor."""
31+
return self.properties.get("EditorEmailHint", None)
32+
33+
@property
34+
def editor_login_name(self):
35+
"""Returns login name of the Editor."""
36+
return self.properties.get("EditorLoginName", None)
37+
2338
@property
2439
def file_type(self):
2540
# type: () -> Optional[str]

office365/sharepoint/client_context.py

+10
Original file line numberDiff line numberDiff line change
@@ -675,8 +675,17 @@ def publications(self):
675675
self, SPMachineLearningPublication, ResourcePath("publications")
676676
)
677677

678+
@property
679+
def server_settings(self):
680+
"""Provides methods for obtaining server properties"""
681+
682+
from office365.sharepoint.server_settings import ServerSettings
683+
684+
return ServerSettings(self)
685+
678686
@property
679687
def social_following_manager(self):
688+
""" """
680689
from office365.sharepoint.social.following.manager import SocialFollowingManager
681690

682691
return SocialFollowingManager(self)
@@ -711,6 +720,7 @@ def tenant_settings(self):
711720

712721
@property
713722
def viva_site_manager(self):
723+
""""""
714724
from office365.sharepoint.viva.site_manager import VivaSiteManager
715725

716726
return VivaSiteManager(self)

office365/sharepoint/directory/user.py

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from typing import Optional
2+
13
from office365.runtime.client_result import ClientResult
24
from office365.sharepoint.directory.my_groups_result import MyGroupsResult
35
from office365.sharepoint.entity import Entity
@@ -6,7 +8,20 @@
68
class User(Entity):
79
"""Represents a user in the SharePoint Directory"""
810

11+
@property
12+
def about_me(self):
13+
# type: () -> Optional[str]
14+
"""Stores a short description or bio of the user."""
15+
return self.properties.get("aboutMe", None)
16+
17+
@property
18+
def account_enabled(self):
19+
# type: () -> Optional[bool]
20+
"""Gets weather the account is active (user can log in and access services) or not"""
21+
return self.properties.get("accountEnabled", None)
22+
923
def is_member_of(self, group_id):
24+
# type: (str) -> ClientResult[bool]
1025
return_type = ClientResult(self.context)
1126

1227
def _user_loaded():

office365/sharepoint/files/publish/__init__.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from office365.sharepoint.entity import Entity
2+
3+
4+
class FileStatus(Entity):
5+
""""""
6+
7+
@property
8+
def entity_type_name(self):
9+
return "Microsoft.SharePoint.FilePublish.Model.FileStatus"

office365/sharepoint/ir/__init__.py

Whitespace-only changes.

office365/sharepoint/ir/migration.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.sharepoint.entity import Entity
2+
3+
4+
class IRMigration(Entity):
5+
""""""

office365/sharepoint/marketplace/corporatecuratedgallery/available_addins_response.py

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class SPAvailableAddinsResponse(ClientValue):
99
def __init__(self, addins=None):
1010
self.addins = ClientValueCollection(SPAddinInstanceInfo, addins)
1111

12-
1312
@property
1413
def entity_type_name(self):
1514
return "Microsoft.SharePoint.Marketplace.CorporateCuratedGallery.SPAvailableAddinsResponse"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from office365.runtime.client_value import ClientValue
2+
3+
4+
class CardDesign(ClientValue):
5+
""""""
6+
7+
@property
8+
def entity_type_name(self):
9+
return "Microsoft.SharePoint.Marketplace.CorporateCuratedGallery.CardDesign"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.runtime.client_value import ClientValue
2+
3+
4+
class DomainRestrictionSettings(ClientValue):
5+
""""""

office365/sharepoint/sharing/information.py

+11
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
from office365.sharepoint.entity import Entity
33
from office365.sharepoint.sharing.abilities import SharingAbilities
44
from office365.sharepoint.sharing.access_request_settings import AccessRequestSettings
5+
from office365.sharepoint.sharing.domain_restriction_settings import (
6+
DomainRestrictionSettings,
7+
)
58
from office365.sharepoint.sharing.links.default_templates_collection import (
69
SharingLinkDefaultTemplatesCollection,
710
)
@@ -27,6 +30,13 @@ def anonymous_link_expiration_restriction_days(self):
2730
"""Tenant's anonymous link expiration restriction in days."""
2831
return self.properties.get("anonymousLinkExpirationRestrictionDays", None)
2932

33+
@property
34+
def domain_restriction_settings(self):
35+
"""Whether DomainRestrictionSettings is used to limit the external Users set by Admin."""
36+
return self.properties.get(
37+
"anonymousLinkExpirationRestrictionDays", DomainRestrictionSettings()
38+
)
39+
3040
@property
3141
def permissions_information(self):
3242
"""
@@ -62,6 +72,7 @@ def get_property(self, name, default_value=None):
6272
if default_value is None:
6373
property_mapping = {
6474
"accessRequestSettings": self.access_request_settings,
75+
"domain_restriction_settings": self.domain_restriction_settings,
6576
"permissionsInformation": self.permissions_information,
6677
"pickerSettings": self.picker_settings,
6778
"sharingAbilities": self.sharing_abilities,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.runtime.client_value import ClientValue
2+
3+
4+
class CopyJobProgress(ClientValue):
5+
""""""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.runtime.client_value import ClientValue
2+
3+
4+
class CopyMigrationInfo(ClientValue):
5+
""""""

office365/sharepoint/sites/site.py

+25
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from office365.sharepoint.sites.azure_container_Info import (
2828
ProvisionedTemporaryAzureContainerInfo,
2929
)
30+
from office365.sharepoint.sites.copy_job_progress import CopyJobProgress
3031
from office365.sharepoint.sites.home.site import SPHSite
3132
from office365.sharepoint.sites.html_field_security_setting import (
3233
HTMLFieldSecuritySetting,
@@ -153,6 +154,18 @@ def get_migration_status(self):
153154
self.context.add_query(qry)
154155
return return_type
155156

157+
def get_copy_job_progress(self, copy_job_info=None):
158+
"""
159+
:param copy_job_info: Optional copyJobInfo object.
160+
"""
161+
payload = {"copyJobInfo": copy_job_info}
162+
return_type = ClientResult(self.context, CopyJobProgress())
163+
qry = ServiceOperationQuery(
164+
self, "GetCopyJobProgress", None, payload, None, return_type
165+
)
166+
self.context.add_query(qry)
167+
return return_type
168+
156169
def get_site_logo(self):
157170
"""Downloads a site logo"""
158171
return_type = ClientResult(self.context)
@@ -265,6 +278,18 @@ def _site_loaded():
265278
self.ensure_property("Id", _site_loaded)
266279
return return_type
267280

281+
def get_web_path(self, site_id, web_id):
282+
"""
283+
:param int site_id: The site identifier
284+
:param int web_id: The web identifier
285+
"""
286+
params = {"siteId": site_id, "webId": web_id}
287+
return_type = ClientResult(self.context, SPResPath())
288+
289+
qry = ServiceOperationQuery(self, "GetWebPath", params, None, None, return_type)
290+
self.context.add_query(qry)
291+
return return_type
292+
268293
def get_web_templates(self, lcid=1033, override_compat_level=0):
269294
"""
270295
Returns the collection of site definitions that are available for creating

office365/sharepoint/tenant/administration/app_service_principal_public.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ class SPOWebAppServicePrincipalPublic(Entity):
66
""" """
77

88
def __init__(self, context):
9-
"""
10-
"""
9+
""" """
1110
static_path = ResourcePath(
1211
"Microsoft.Online.SharePoint.TenantAdministration.SPOWebAppServicePrincipalPublic"
1312
)

office365/sharepoint/tenant/administration/copilot/__init__.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from office365.runtime.client_value import ClientValue
2+
3+
4+
class AdaptiveCardConfig(ClientValue):
5+
""""""
6+
7+
@property
8+
def entity_type_name(self):
9+
return (
10+
"Microsoft.SharePoint.Administration.TenantAdmin.Copilot.AdaptiveCardConfig"
11+
)

office365/sharepoint/tenant/administration/insights/onedrive_site_sharing.py

+4
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@
33

44
class OneDriveSiteSharingInsights(ClientValue):
55
""""""
6+
7+
@property
8+
def entity_type_name(self):
9+
return "Microsoft.Online.SharePoint.TenantAdministration.OneDriveSiteSharingInsights"

0 commit comments

Comments
 (0)