Skip to content

Commit fc2705d

Browse files
committed
#956: fix GetComments method
1 parent eccc660 commit fc2705d

File tree

4 files changed

+101
-9
lines changed

4 files changed

+101
-9
lines changed

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: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6845,12 +6845,21 @@
68456845
<Annotations Target="microsoft.graph.educationRubric/lastModifiedDateTime">
68466846
<Annotation Term="Org.OData.Core.V1.Computed" Bool="true"/>
68476847
</Annotations>
6848+
<Annotations Target="microsoft.graph.educationSubmission/assignmentId">
6849+
<Annotation Term="Org.OData.Core.V1.Computed" Bool="true"/>
6850+
</Annotations>
68486851
<Annotations Target="microsoft.graph.educationSubmission/excusedBy">
68496852
<Annotation Term="Org.OData.Core.V1.Computed" Bool="true"/>
68506853
</Annotations>
68516854
<Annotations Target="microsoft.graph.educationSubmission/excusedDateTime">
68526855
<Annotation Term="Org.OData.Core.V1.Computed" Bool="true"/>
68536856
</Annotations>
6857+
<Annotations Target="microsoft.graph.educationSubmission/lastModifiedBy">
6858+
<Annotation Term="Org.OData.Core.V1.Computed" Bool="true"/>
6859+
</Annotations>
6860+
<Annotations Target="microsoft.graph.educationSubmission/lastModifiedDateTime">
6861+
<Annotation Term="Org.OData.Core.V1.Computed" Bool="true"/>
6862+
</Annotations>
68546863
<Annotations Target="microsoft.graph.educationSubmission/reassignedBy">
68556864
<Annotation Term="Org.OData.Core.V1.Computed" Bool="true"/>
68566865
</Annotations>
@@ -25916,6 +25925,19 @@ within the time frame of their original request."/>
2591625925
<Property Name="roles" Type="Collection(Edm.String)"/>
2591725926
<Property Name="shareId" Type="Edm.String"/>
2591825927
</EntityType>
25928+
<EntityType Name="copilotAdmin" BaseType="graph.entity">
25929+
<NavigationProperty Name="settings" Type="graph.copilotAdminSetting" ContainsTarget="true"/>
25930+
</EntityType>
25931+
<EntityType Name="copilotAdminSetting" BaseType="graph.entity">
25932+
<NavigationProperty Name="limitedMode" Type="graph.copilotAdminLimitedMode" ContainsTarget="true"/>
25933+
</EntityType>
25934+
<EntityType Name="copilotAdminLimitedMode" BaseType="graph.entity">
25935+
<Property Name="groupId" Type="Edm.String"/>
25936+
<Property Name="isEnabledForGroup" Type="Edm.Boolean"/>
25937+
</EntityType>
25938+
<EntityType Name="copilotRoot">
25939+
<NavigationProperty Name="admin" Type="graph.copilotAdmin" ContainsTarget="true"/>
25940+
</EntityType>
2591925941
<ComplexType Name="apiAuthenticationConfigurationBase" Abstract="true"/>
2592025942
<ComplexType Name="assignmentOrder">
2592125943
<Property Name="order" Type="Collection(Edm.String)"/>
@@ -27265,8 +27287,11 @@ within the time frame of their original request."/>
2726527287
<Property Name="qualities" Type="Collection(graph.rubricQuality)"/>
2726627288
</EntityType>
2726727289
<EntityType Name="educationSubmission" BaseType="graph.entity">
27290+
<Property Name="assignmentId" Type="Edm.String"/>
2726827291
<Property Name="excusedBy" Type="graph.identitySet"/>
2726927292
<Property Name="excusedDateTime" Type="Edm.DateTimeOffset"/>
27293+
<Property Name="lastModifiedBy" Type="graph.identitySet"/>
27294+
<Property Name="lastModifiedDateTime" Type="Edm.DateTimeOffset"/>
2727027295
<Property Name="reassignedBy" Type="graph.identitySet"/>
2727127296
<Property Name="reassignedDateTime" Type="Edm.DateTimeOffset"/>
2727227297
<Property Name="recipient" Type="graph.educationSubmissionRecipient"/>
@@ -34225,7 +34250,9 @@ within the time frame of their original request."/>
3422534250
<EntityType Name="attendanceRecord" BaseType="graph.entity">
3422634251
<Property Name="attendanceIntervals" Type="Collection(graph.attendanceInterval)"/>
3422734252
<Property Name="emailAddress" Type="Edm.String"/>
34253+
<Property Name="externalRegistrationInformation" Type="graph.virtualEventExternalRegistrationInformation"/>
3422834254
<Property Name="identity" Type="graph.identity"/>
34255+
<Property Name="registrationId" Type="Edm.String"/>
3422934256
<Property Name="role" Type="Edm.String"/>
3423034257
<Property Name="totalAttendanceInSeconds" Type="Edm.Int32"/>
3423134258
</EntityType>
@@ -34255,6 +34282,7 @@ within the time frame of their original request."/>
3425534282
<Property Name="participants" Type="Collection(graph.invitationParticipantInfo)" Nullable="false"/>
3425634283
</EntityType>
3425734284
<EntityType Name="meetingAttendanceReport" BaseType="graph.entity">
34285+
<Property Name="externalEventInformation" Type="Collection(graph.virtualEventExternalInformation)"/>
3425834286
<Property Name="meetingEndDateTime" Type="Edm.DateTimeOffset"/>
3425934287
<Property Name="meetingStartDateTime" Type="Edm.DateTimeOffset"/>
3426034288
<Property Name="totalParticipantCount" Type="Edm.Int32"/>
@@ -36426,6 +36454,10 @@ within the time frame of their original request."/>
3642636454
<Parameter Name="bindingParameter" Type="graph.educationModule"/>
3642736455
<ReturnType Type="graph.educationModule"/>
3642836456
</Action>
36457+
<Function Name="getRecentlyModifiedSubmissions" IsBound="true">
36458+
<Parameter Name="bindingParameter" Type="graph.educationClass"/>
36459+
<ReturnType Type="Collection(graph.educationSubmission)"/>
36460+
</Function>
3642936461
<Action Name="enable" IsBound="true">
3643036462
<Parameter Name="bindingParameter" Type="graph.backupRestoreRoot"/>
3643136463
<Parameter Name="appOwnerTenantId" Type="Edm.String" Nullable="false" Unicode="false"/>
@@ -41265,6 +41297,7 @@ within the time frame of their original request."/>
4126541297
<NavigationPropertyBinding Path="threatIntelligence/hostSslCertificates/sslCertificate" Target="security/microsoft.graph.security.threatIntelligence/threatIntelligence/sslCertificates"/>
4126641298
</Singleton>
4126741299
<Singleton Name="compliance" Type="microsoft.graph.compliance"/>
41300+
<Singleton Name="copilot" Type="microsoft.graph.copilotRoot"/>
4126841301
<Singleton Name="identity" Type="microsoft.graph.identityContainer"/>
4126941302
<Singleton Name="directory" Type="microsoft.graph.directory">
4127041303
<NavigationPropertyBinding Path="administrativeUnits/members" Target="directoryObjects"/>

office365/sharepoint/listitems/listitem.py

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33

44
from office365.runtime.client_result import ClientResult
55
from office365.runtime.client_value_collection import ClientValueCollection
6+
from office365.runtime.http.http_method import HttpMethod
7+
from office365.runtime.http.request_options import RequestOptions
68
from office365.runtime.paths.resource_path import ResourcePath
9+
from office365.runtime.paths.service_operation import ServiceOperationPath
710
from office365.runtime.paths.v3.entity import EntityPath
811
from office365.runtime.queries.service_operation import ServiceOperationQuery
912
from office365.sharepoint.attachments.collection import AttachmentCollection
@@ -396,9 +399,16 @@ def set_compliance_tag_with_hold(self, compliance_tag):
396399

397400
def get_comments(self):
398401
"""Retrieve ListItem comments"""
399-
return_type = CommentCollection(self.context)
402+
return_type = CommentCollection(
403+
self.context, ServiceOperationPath("GetComments", [], self.resource_path)
404+
)
400405
qry = ServiceOperationQuery(self, "GetComments", [], None, None, return_type)
401-
self.context.add_query(qry)
406+
407+
def _create_request(request):
408+
# type: (RequestOptions) -> None
409+
request.method = HttpMethod.Get
410+
411+
self.context.add_query(qry).before_query_execute(_create_request)
402412
return return_type
403413

404414
def override_policy_tip(self, user_action, justification):
@@ -495,6 +505,17 @@ def effective_base_permissions(self):
495505

496506
return self.properties.get("EffectiveBasePermissions", BasePermissions())
497507

508+
@property
509+
def effective_base_permissions_for_ui(self):
510+
"""Specifies the effective base permissions for the current user, as they SHOULD be displayed in the user
511+
interface (UI). If the list is not in read-only UI mode, the value of EffectiveBasePermissionsForUI
512+
MUST be the same as the value of EffectiveBasePermissions (section 3.2.5.87.1.1.2).
513+
If the list is in read-only UI mode, the value of EffectiveBasePermissionsForUI MUST be a subset of the
514+
value of EffectiveBasePermissions."""
515+
from office365.sharepoint.permissions.base_permissions import BasePermissions
516+
517+
return self.properties.get("EffectiveBasePermissionsForUI", BasePermissions())
518+
498519
@property
499520
def field_values(self):
500521
# type: () -> Optional[dict]
@@ -513,12 +534,41 @@ def file_system_object_type(self):
513534
"""Gets a value that specifies whether the list item is a file or a list folder"""
514535
return self.properties.get("FileSystemObjectType", None)
515536

537+
@property
538+
def icon_overlay(self):
539+
# type: () -> Optional[str]
540+
"""This is an overlay icon for the item. If the parent list of the item does not already have the IconOverlay
541+
field and The user setting the property does not have rights to add the field to the list then the property
542+
will not be set for the item."""
543+
return self.properties.get("IconOverlay", None)
544+
516545
@property
517546
def id(self):
518547
# type: () -> Optional[int]
519548
"""Gets a value that specifies the list item identifier."""
520549
return self.properties.get("Id", None)
521550

551+
@property
552+
def server_redirected_embed_uri(self):
553+
# type: () -> Optional[str]
554+
"""Returns the path for previewing a document in the browser, often in an interactive way, if
555+
that feature exists."""
556+
return self.properties.get("ServerRedirectedEmbedUri", None)
557+
558+
@property
559+
def server_redirected_embed_url(self):
560+
# type: () -> Optional[str]
561+
"""Returns the URL for previewing a document in the browser, often in an interactive way, if that feature
562+
exists. This is currently used in the hovering panel of search results and document library.
563+
"""
564+
return self.properties.get("ServerRedirectedEmbedUri", None)
565+
566+
@property
567+
def client_title(self):
568+
# type: () -> Optional[str]
569+
""" """
570+
return self.properties.get("Client_Title", None)
571+
522572
@property
523573
def compliance_info(self):
524574
return self.properties.get("ComplianceInfo", ListItemComplianceInfo())
@@ -589,6 +639,7 @@ def get_property(self, name, default_value=None):
589639
"ComplianceInfo": self.compliance_info,
590640
"OData__dlc_DocIdUrl": self.doc_id_url,
591641
"EffectiveBasePermissions": self.effective_base_permissions,
642+
"EffectiveBasePermissionsForUI": self.effective_base_permissions_for_ui,
592643
"GetDlpPolicyTip": self.get_dlp_policy_tip,
593644
"FieldValuesAsHtml": self.field_values_as_html,
594645
"LikedByInformation": self.liked_by_information,

tests/sharepoint/test_listItem.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
class TestSharePointListItem(SPTestCase):
1515
target_list = None # type: List
1616
target_item = None # type: ListItem
17+
deleted_item_guid = None # type: str
1718

1819
@classmethod
1920
def setUpClass(cls):
@@ -115,15 +116,22 @@ def test_13_enable_comments(self):
115116
).execute_query()
116117
self.assertIsNotNone(comments.resource_path)
117118

118-
# def test_10_get_comments(self):
119-
# comments = self.__class__.target_item.get_comments().execute_query()
120-
# self.assertIsNotNone(comments.resource_path)
119+
def test_10_get_comments(self):
120+
comments = self.__class__.target_item.get_comments().execute_query()
121+
self.assertIsNotNone(comments.resource_path)
121122

122123
def test_14_recycle_item(self):
123-
pass
124+
item_to_recycle = self.__class__.target_item
125+
result = item_to_recycle.recycle().execute_query()
126+
self.assertIsNotNone(result.value)
127+
self.__class__.deleted_item_guid = result.value
124128

125129
def test_15_restore_item(self):
126-
pass
130+
recycle_item = self.client.web.recycle_bin.get_by_id(
131+
self.__class__.deleted_item_guid
132+
)
133+
recycle_item.restore().execute_query()
134+
self.assertIsNotNone(recycle_item.resource_path)
127135

128136
def test_16_set_rating(self):
129137
result = self.__class__.target_item.set_rating(1).execute_query()

0 commit comments

Comments
 (0)