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
Lines changed: 4 additions & 4 deletions
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)
Lines changed: 12 additions & 0 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 32 additions & 0 deletions
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

Lines changed: 32 additions & 0 deletions
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

Lines changed: 15 additions & 0 deletions
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

Lines changed: 10 additions & 0 deletions
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

Lines changed: 15 additions & 0 deletions
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.
Lines changed: 9 additions & 0 deletions
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"

0 commit comments

Comments
 (0)