msgraph-sdk-powershell
msgraph-sdk-powershell copied to clipboard
Get-MgDriveItemChild doesn't return retention label information
Describe the bug
I am trying to fetch details of the retention labels assigned to files in a SPO document library. RetentionLabel is the property.
This code workls to fetch items in a folder.
[array]$Data = Get-MgDriveItemChild -DriveId $Drive.id -DriveItemId 'root' -All -Property id, name, createdby, createddatetime, Lastmodifieddatetime, RetentionLabel $file = $data[20] # Points to a Word document with a known directly assigned retention label. However, what's returned is perfectly blank
$File.retentionlabel
Id IsLabelAppliedExplicitly LabelAppliedDateTime Name
Expected behavior
I'd expect to see the RetentionmLanel populated.
How to reproduce
See above.
SDK Version
2.17.0
Latest version known to work for scenario above?
I have found no version to work.
Known Workarounds
None.
Debug output
etime, RetentionLabel -debug DEBUG: [CmdletBeginProcessing]: - Get-MgBetaDriveItemChild begin processing with parameterSet 'List'. DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'CurrentUser', AppName: 'Microsoft Graph Command Line Tools'. DEBUG: [Authentication]: - Scopes: [AccessReview.Read.All, Agreement.Read.All, Analytics.Read, APIConnectors.Read.All, Application.Read.All, Application.ReadWrite.All, AppRoleAssignment.ReadWrite.All, AuditLog.Read.All, AuditLogsQuery.Read.All, Channel.ReadBasic.All, ChannelMessage.Read.All, ChannelMessage.ReadWrite, ChannelMessage.Send, ChannelSettings.Read.All, ChannelSettings.ReadWrite.All, Chat.Create, Chat.ManageDeletion.All, Chat.ReadWrite, Community.ReadWrite.All, Contacts.ReadWrite, CrossTenantUserProfileSharing.Read, CrossTenantUserProfileSharing.Read.All, DelegatedPermissionGrant.ReadWrite.All, Directory.AccessAsUser.All, Directory.Read.All, Directory.ReadWrite.All, DirectoryRecommendations.Read.All, Domain.Read.All, eDiscovery.Read.All, email, EntitlementManagement.Read.All, Group.Read.All, Group.ReadWrite.All, GroupMember.Read.All, GroupMember.ReadWrite.All, IdentityProvider.Read.All, IdentityProvider.ReadWrite.All, IdentityRiskyUser.Read.All, IdentityRiskyUser.ReadWrite.All, IdentityUserFlow.Read.All, Mail.Read, Mail.ReadWrite, Mail.Send, Mail.Send.Shared, OnlineMeetingArtifact.Read.All, OnlineMeetings.Read, openid, Organization.Read.All, PeopleSettings.Read.All, PeopleSettings.ReadWrite.All, Place.Read.All, Policy.Read.All, Policy.Read.PermissionGrant, Policy.ReadWrite.ApplicationConfiguration, Policy.ReadWrite.AuthenticationMethod, Policy.ReadWrite.ConditionalAccess, PrivilegedAccess.Read.AzureAD, PrivilegedAccess.Read.AzureResources, profile, Reports.Read.All, ReportSettings.ReadWrite.All, RoleAssignmentSchedule.Read.Directory, RoleAssignmentSchedule.ReadWrite.Directory, RoleEligibilitySchedule.Read.Directory, RoleManagement.Read.All, RoleManagement.Read.Directory, SecurityActions.ReadWrite.All, SecurityEvents.Read.All, SecurityEvents.ReadWrite.All, ServiceHealth.Read.All, ServiceMessage.Read.All, SharePointTenantSettings.ReadWrite.All, Sites.FullControl.All, Sites.Manage.All, Sites.Read.All, Sites.ReadWrite.All, Tasks.Read, Tasks.ReadWrite, Team.ReadBasic.All, TeamMember.Read.All, TeamSettings.Read.All, TeamsTab.Read.All, TeamworkTag.ReadWrite, User.Read, User.Read.All, User.ReadBasic.All, User.ReadWrite, User.ReadWrite.All, UserAuthenticationMethod.Read.All, UserAuthenticationMethod.ReadWrite.All, User-ConvertToInternal.ReadWrite.All, VirtualEvent.Read, WindowsUpdates.Read.All]. DEBUG: ============================ HTTP REQUEST ============================
HTTP Method: GET
Absolute Uri: https://graph.microsoft.com/beta/drives/b%212HT-rPvtbUOSS-AYZmYF7pehq6IdX2RIosdNrw_2N5t7xp_DBXMQTalVjpKlwdxk/items/root/children?$select=id%2Cname%2Ccreatedby%2Ccreateddatetime%2CLastmodifieddatetime%2CRetentionLabel
Headers: FeatureFlag : 00000043 Cache-Control : no-store, no-cache User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.22631; en-IE),PowerShell/7.4.1 Accept-Encoding : gzip SdkVersion : graph-powershell-beta/2.17.0 client-request-id : e1b5adbf-885d-4068-88dc-23f6b230fbf6
Body:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code: OK
Headers: Cache-Control : no-store, no-cache Vary : Accept-Encoding Strict-Transport-Security : max-age=31536000 request-id : 2efbd942-cde5-4b32-b51a-2ca54015086f client-request-id : e1b5adbf-885d-4068-88dc-23f6b230fbf6 x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"North Europe","Slice":"E","Ring":"4","ScaleUnit":"009","RoleInstance":"DU2PEPF00026069"}} odata-version : 4.0 Date : Sun, 21 Apr 2024 22:40:19 GMT
Body: { "@odata.context": "https://graph.microsoft.com/beta/$metadata#drives('b%212HT-rPvtbUOSS-AYZmYF7pehq6IdX2RIosdNrw_2N5t7xp_DBXMQTalVjpKlwdxk')/items('root')/children(id,name,createdBy,createdDateTime,lastModifiedDateTime,retentionLabel)", "value": [ { "@odata.etag": ""{16B19F0F-6607-4490-8306-D3269DFB6B7E},4"", "createdDateTime": "2022-05-02T09:28:16Z", "id": "01TAGX3UYPT6YRMB3GSBCIGBWTE2O7W236", "lastModifiedDateTime": "2022-08-06T17:54:13Z", "name": "🏴☠️2023 Edition (9th)", "createdBy": { "application": { "id": "cc15fd57-2c6c-4117-a88c-83b1d56b4bbe", "displayName": "Skype Teams Services" }, "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{5EEBD99C-F0A3-46F5-BDB0-95FA0A2F5505},3"", "createdDateTime": "2019-05-02T08:53:14Z", "id": "01TAGX3U443HVV5I7Q6VDL3MEV7IFC6VIF", "lastModifiedDateTime": "2019-08-27T13:09:14Z", "name": "2020 Edition", "createdBy": { "application": { "id": "cc15fd57-2c6c-4117-a88c-83b1d56b4bbe", "displayName": "Skype Teams Services" }, "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{33B44489-8005-4DAE-8A36-533ECC3EE5BC},3"", "createdDateTime": "2020-03-17T18:55:42Z", "id": "01TAGX3U4JIS2DGBMAVZGYUNSTH3GD5ZN4", "lastModifiedDateTime": "2022-05-28T16:36:43Z", "name": "2021 Edition", "createdBy": { "application": { "id": "cc15fd57-2c6c-4117-a88c-83b1d56b4bbe", "displayName": "Skype Teams Services" }, "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{652A81B5-7DD7-406F-AF7F-18C01CE034B9},5"", "createdDateTime": "2021-03-21T22:43:53Z", "id": "01TAGX3U5VQEVGLV35N5AK67YYYAOOANFZ", "lastModifiedDateTime": "2022-08-06T17:54:37Z", "name": "2022 Edition", "createdBy": { "application": { "id": "cc15fd57-2c6c-4117-a88c-83b1d56b4bbe", "displayName": "Skype Teams Services" }, "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{D65D3EC0-BFB2-4929-997A-DB3894CB67F6},2"", "createdDateTime": "2023-04-03T12:58:55Z", "id": "01TAGX3U6AHZO5NMV7FFEZS6W3HCKMWZ7W", "lastModifiedDateTime": "2023-04-03T12:58:55Z", "name": "2024 Edition (10th)", "createdBy": { "application": { "id": "cc15fd57-2c6c-4117-a88c-83b1d56b4bbe", "displayName": "Skype Teams Services" }, "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{73D421ED-B216-40CF-81CB-11DC78777C46},2"", "createdDateTime": "2015-04-14T17:20:21Z", "id": "01TAGX3U7NEHKHGFVSZ5AIDSYR3R4HO7CG", "lastModifiedDateTime": "2023-10-12T19:57:15Z", "name": "Book Files", "createdBy": { "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{E48A0D48-EA43-4BC2-95A7-E481C40268BF},1"", "createdDateTime": "2017-01-19T17:46:21Z", "id": "01TAGX3U2IBWFOIQ7KYJFZLJ7EQHCAE2F7", "lastModifiedDateTime": "2017-01-19T17:46:21Z", "name": "Email attachments", "createdBy": { "application": { "id": "00000002-0000-0ff1-ce00-000000000000", "displayName": "Microsoft.Exchange" }, "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{52F60C00-1485-4CA3-B00C-953DA16F89FC},3"", "createdDateTime": "2018-03-11T20:36:21Z", "id": "01TAGX3UYABT3FFBIUUNGLADEVHWQW7CP4", "lastModifiedDateTime": "2022-06-28T14:03:18Z", "name": "Fifth Edition", "createdBy": { "application": { "id": "cc15fd57-2c6c-4117-a88c-83b1d56b4bbe", "displayName": "Skype Teams Services" }, "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{A7424933-7B8B-4AEA-AF69-304DECCA9998},4"", "createdDateTime": "2015-05-13T12:18:43Z", "id": "01TAGX3UZTJFBKPC335JFK62JQJXWMVGMY", "lastModifiedDateTime": "2023-10-12T19:58:00Z", "name": "First Edition", "createdBy": { "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{0F9959EC-84D3-4551-9617-AF4DD177F3EA},3"", "createdDateTime": "2018-03-15T18:26:50Z", "id": "01TAGX3U7MLGMQ7U4EKFCZMF5PJXIXP47K", "lastModifiedDateTime": "2022-06-28T14:02:32Z", "name": "Fourth Edition", "createdBy": { "application": { "id": "cc15fd57-2c6c-4117-a88c-83b1d56b4bbe", "displayName": "Skype Teams Services" }, "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{ED5EAC58-5133-4C66-9369-7DFAE2B2C8F5},3"", "createdDateTime": "2017-02-14T19:09:00Z", "id": "01TAGX3U2YVRPO2M2RMZGJG2L57LRLFSHV", "lastModifiedDateTime": "2017-02-20T16:10:17Z", "name": "Fourth Edition Files", "createdBy": { "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{BE5B88AD-9267-40C4-ADFC-0FFDBE5FCC73},3"", "createdDateTime": "2016-11-03T23:00:12Z", "id": "01TAGX3U5NRBN34Z4SYRAK37AP7W7F7TDT", "lastModifiedDateTime": "2019-10-01T11:21:29Z", "name": "General", "createdBy": { "application": { "id": "cc15fd57-2c6c-4117-a88c-83b1d56b4bbe", "displayName": "Skype Teams Services" }, "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{9587D2AE-37EF-4231-AB94-C2518FB9D5AC},2"", "createdDateTime": "2014-11-25T12:07:16Z", "id": "01TAGX3U5O2KDZL3ZXGFBKXFGCKGH3TVNM", "lastModifiedDateTime": "2023-10-12T19:57:05Z", "name": "Graphics", "createdBy": { "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{D06E5C5A-D383-4902-A834-7DF4D7D1190D},2"", "createdDateTime": "2022-04-06T12:25:12Z", "id": "01TAGX3U22LRXNBA6TAJE2QND56TL5CGIN", "lastModifiedDateTime": "2023-10-12T19:55:53Z", "name": "😂Office 365 for IT Pros RSS Feed", "createdBy": { "application": { "id": "cc15fd57-2c6c-4117-a88c-83b1d56b4bbe", "displayName": "Skype Teams Services" }, "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{64F43B89-BFA2-487E-838B-1C60FD8732EA},1"", "createdDateTime": "2015-02-03T18:58:11Z", "id": "01TAGX3U4JHP2GJIV7PZEIHCY4MD6YOMXK", "lastModifiedDateTime": "2015-02-03T18:58:11Z", "name": "Old files", "createdBy": { "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{B164666F-D6EB-47C3-B1ED-65FB804F8769},4"", "createdDateTime": "2015-08-31T13:00:21Z", "id": "01TAGX3U3PMZSLD26WYND3D3LF7OAE7B3J", "lastModifiedDateTime": "2023-10-12T19:58:36Z", "name": "Second Edition", "createdBy": { "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{8F0BD2C4-2FAC-48BC-8E6D-9047B83A0238},2"", "createdDateTime": "2021-06-16T11:09:10Z", "id": "01TAGX3U6E2IFY7LBPXREI43MQI64DUARY", "lastModifiedDateTime": "2023-10-12T19:56:06Z", "name": "Stream Videos", "createdBy": { "application": { "id": "cc15fd57-2c6c-4117-a88c-83b1d56b4bbe", "displayName": "Skype Teams Services" }, "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{A2EFF72C-72D8-4215-AD63-63C7530363B8},1"", "createdDateTime": "2015-02-26T10:42:47Z", "id": "01TAGX3UZM67X2FWDSCVBK2Y3DY5JQGY5Y", "lastModifiedDateTime": "2015-02-26T10:42:47Z", "name": "Support files", "createdBy": { "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{A52A10B8-16B3-4648-B649-2179362BB8EF},3"", "createdDateTime": "2016-01-18T10:14:32Z", "id": "01TAGX3U5YCAVKLMYWJBDLMSJBPE3CXOHP", "lastModifiedDateTime": "2016-01-18T12:17:59Z", "name": "Third Edition Files", "createdBy": { "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{88B008B8-3852-4C67-99DC-87A270589D2B},13"", "createdDateTime": "2017-11-16T11:48:57Z", "id": "01TAGX3U5YBCYIQURYM5GJTXEHUJYFRHJL", "lastModifiedDateTime": "2017-11-16T11:48:59Z", "name": "2016 Predictions.docx", "createdBy": { "application": { "id": "09abbdfd-ed23-44ee-a2d9-a627aa1c90f3", "displayName": "ProjectWorkManagement" }, "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{CEF7FB56-E3C4-458E-B6BC-04AD588871B8},247"", "createdDateTime": "2024-04-10T19:36:52Z", "id": "01TAGX3U2W7P345RHDRZC3NPAEVVMIQ4NY", "lastModifiedDateTime": "2024-04-21T12:08:23Z", "name": "Automate Microsoft 365 with PowerShell.docx", "createdBy": { "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{0C8CF8DE-9027-42A3-A922-7EE44573C6EF},4"", "createdDateTime": "2020-06-02T13:07:04Z", "id": "01TAGX3U667CGAYJ4QUNBKSIT64RCXHRXP", "lastModifiedDateTime": "2020-06-02T13:07:05Z", "name": "Exchange Logo Large.jpg", "createdBy": { "application": { "id": "09abbdfd-ed23-44ee-a2d9-a627aa1c90f3", "displayName": "ProjectWorkManagement" }, "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{C8EB9A86-99D7-4EAA-BBF9-A0F5B12CB8B6},4"", "createdDateTime": "2018-05-13T17:31:02Z", "id": "01TAGX3U4GTLV4RV4ZVJHLX6NA6WYSZOFW", "lastModifiedDateTime": "2018-05-13T17:31:09Z", "name": "FifthEditionCompanion.jpg", "createdBy": { "application": { "id": "09abbdfd-ed23-44ee-a2d9-a627aa1c90f3", "displayName": "ProjectWorkManagement" }, "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{BF462B71-F226-4581-8C84-826731C72682},4"", "createdDateTime": "2018-05-13T17:20:05Z", "id": "01TAGX3U3RFNDL6JXSQFCYZBECM4Y4OJUC", "lastModifiedDateTime": "2018-05-13T17:20:11Z", "name": "FifthEditionCover.jpg", "createdBy": { "application": { "id": "09abbdfd-ed23-44ee-a2d9-a627aa1c90f3", "displayName": "ProjectWorkManagement" }, "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{CB8A5F04-3B5C-49AC-BA82-A7391894A8E6},4"", "createdDateTime": "2020-06-28T11:32:28Z", "id": "01TAGX3UYEL6FMWXB3VRE3VAVHHEMJJKHG", "lastModifiedDateTime": "2020-06-28T11:32:30Z", "name": "Front Cover.jpg", "createdBy": { "application": { "id": "09abbdfd-ed23-44ee-a2d9-a627aa1c90f3", "displayName": "ProjectWorkManagement" }, "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{BDFF7EB4-00E2-49CE-8100-AF88DD8CF83C},7"", "createdDateTime": "2018-11-17T13:45:50Z", "id": "01TAGX3U5UP3733YQAZZEYCAFPRDOYZ6B4", "lastModifiedDateTime": "2018-11-17T13:45:51Z", "name": "Office 365 for IT Pros (2019 Edition).xlsx", "createdBy": { "application": { "id": "c9a559d2-7aab-4f13-a6ed-e7e9c52aec87", "displayName": "Microsoft Forms" }, "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{0720404D-A957-401A-A0BC-C6EBD3656FA8},4"", "createdDateTime": "2023-01-30T11:06:24Z", "id": "01TAGX3U2NIAQAOV5JDJAKBPGG5PJWK35I", "lastModifiedDateTime": "2023-01-30T11:06:26Z", "name": "Office 365 for IT Pros.png", "createdBy": { "application": { "id": "09abbdfd-ed23-44ee-a2d9-a627aa1c90f3", "displayName": "ProjectWorkManagement" }, "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{85195D0F-EB3D-4200-BFA9-9522D3618060},5"", "createdDateTime": "2017-08-03T09:53:36Z", "id": "01TAGX3UYPLUMYKPPLABBL7KMVELJWDADA", "lastModifiedDateTime": "2017-08-03T09:53:45Z", "name": "office-365-for-it-pros-3rd-edition.jpg", "createdBy": { "application": { "id": "09abbdfd-ed23-44ee-a2d9-a627aa1c90f3", "displayName": "ProjectWorkManagement" }, "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{A563F8C9-5732-48D8-83AD-9D2625BD9194},5"", "createdDateTime": "2017-08-03T09:40:28Z", "id": "01TAGX3U6J7BR2KMSX3BEIHLM5EYS33EMU", "lastModifiedDateTime": "2017-08-03T09:40:42Z", "name": "office-365-for-it-pros-cover-4th-ed amazon.jpg", "createdBy": { "application": { "id": "09abbdfd-ed23-44ee-a2d9-a627aa1c90f3", "displayName": "ProjectWorkManagement" }, "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{7997B531-746A-485C-9832-CF924FE23C47},3"", "createdDateTime": "2017-06-25T14:08:59Z", "id": "01TAGX3UZRWWLXS2TULREJQMWPSJH6EPCH", "lastModifiedDateTime": "2017-06-25T14:09:01Z", "name": "office-365-for-it-pros-cover-4th-ed.jpg", "createdBy": { "application": { "id": "09abbdfd-ed23-44ee-a2d9-a627aa1c90f3", "displayName": "ProjectWorkManagement" }, "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{97BDD34E-84F8-4905-826D-CEDA77765489},4"", "createdDateTime": "2020-06-23T10:28:14Z", "id": "01TAGX3U2O2O6ZP6EEAVEYE3OO3J3XMVEJ", "lastModifiedDateTime": "2020-06-23T10:28:16Z", "name": "Seventh Edition Cover - Iceland 1.jpg", "createdBy": { "application": { "id": "09abbdfd-ed23-44ee-a2d9-a627aa1c90f3", "displayName": "ProjectWorkManagement" }, "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } } }, { "@odata.etag": ""{6F9D0DC3-B13D-41FC-917F-DF6A2E903D30},4"", "createdDateTime": "2020-06-02T13:01:37Z", "id": "01TAGX3U6DBWOW6PNR7RAZC767NIXJAPJQ", "lastModifiedDateTime": "2020-06-02T13:01:39Z", "name": "Seventh Edition Cover - Iceland.jpg", "createdBy": { "application": { "id": "09abbdfd-ed23-44ee-a2d9-a627aa1c90f3", "displayName": "ProjectWorkManagement" }, "user": { "email": "[email protected]", "id": "eff4cd58-1bb8-4899-94de-795f656b4a18", "displayName": "Tony Redmond" } }
</details>
### Configuration
$PSVersionTable
Name Value
---- -----
PSVersion 7.4.1
PSEdition Core
GitCommitId 7.4.1
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
### Other information
If I am doing somethimng wromg please tell me and then update the documentation...
BTW, the beta cmdlet generates the same results.
Ah, the right thing to do is use the Get Retention Label API. https://learn.microsoft.com/en-us/graph/api/driveitem-getretentionlabel?view=graph-rest-1.0. At least, I guess that's what has to happen. Is an SDK cmdlet available? The documentation makes no mention of the Graph SDK. And seeing I am asking questions, what about a Graph SDK cmdlet to fetch senstivity label data?
To clarify matters. I started this thread by saying that the Get-MgDriveItemChild cmdlet doesn't return retention label information.
The Get-MgSecurityLabelRetentionLabel cmdlet lists the retention labels in an organization, but there doesn't seem to be an SDK cmdlet to fetch the retention label from a file. I can do this with
https://graph.microsoft.com/v1.0/drives/{Drive Id}/items/{file id}/retentionLabel"
but that's an additional call. And if the Graph request can fetch the retention label, why doesn't Get-MgDriveItemChild?
It would also be nive if Get-MgDriveItemChild returned sensitivity label information. This information is available with
https://graph.microsoft.com/v1.0/drives/{drive id}/items/{file id}/retentionLabel
Is there a Graph SDK cmdlet to fetch sensitivity label information for a file?
The API shall support expansion of the retentionLabel property as described in the docs, https://learn.microsoft.com/en-us/graph/api/resources/driveitem?view=graph-rest-1.0
But it is returning error when trying to expand it, both in Graph Explorer and when using for example Get-MgDriveItemChild -DriveId $id -DriveItemId 'root' -All -debug -ExpandProperty retentionLabel
(no difference between v1.0 and Beta)
This appears to be an issue or limitation with the service APIs. Unfortunately, as the Microsoft Graph SDK team, we do not have ownership of the APIs that are causing you issues. We invite you to create a question about the service API to Microsoft Q&A and tagged with one of the [microsoft-graph-*] tags, that way it will get routed to the appropriate team for them to triage:
https://aka.ms/msgraphsupport or directly https://aka.ms/askgraph
I have a working example of getting retention label information in https://github.com/12Knocksinna/Office365itpros/blob/master/Report-SPOFilesDocumentLibrary.PS1 (explained in this article https://practical365.com/sharepoint-online-files-report/).
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.