New cmdlet to update retention label on file#4457
Conversation
|
hey @reshmee011 , instead of this CSOM based API request , let's use the graph based one: Can you modify the PR to do that ? |
|
@gautamdsheth : Sure I can do that, I will make the changes soon. |
|
@gautamdsheth : Is there any existing function to retrieve the driveid of the list or library from Graph? |
|
Hi @reshmee011 , we use PnP Core for this. Check this : Maybe we can use the VroomDriveId I think. Also, I think the value is same as list GUID value AFAIK, need to check , so list.ID or list.GUID might work |
|
@gautamdsheth : Thanks for the guidance. I have not tested it yet, will |
|
@gautamdsheth : I have used the REST API endpoint /_api/SP.CompliancePolicy.SPPolicyStoreProxy.UnlockRecordItem() which works for both a file and list item. The Graph endpoint works against a driveitem which from my understanding is applicable only to a file. I bet another cmdlet Unlock-PnPFile would work for the Graph endpoint https://learn.microsoft.com/en-us/graph/api/driveitem-lockorunlockrecord?view=graph-rest-1.0&tabs=http |
|
Hmm, need to check this a bit about how to fetch driveId via PnP Core. Will get back to you asap. |
|
@reshmee011 - we can fetch the Drive ID and Drive ItemID as below: We can then use these values in the Graph patch request |
|
@gautamdsheth :Thank you. Shall I also update the cmdlet to Unlock-PnPFileRecord to reflect that it will be applicable to files and not to list items.? |
|
Maybe lets call it |
|
@gautamdsheth : There is another endpoint to update retention label https://learn.microsoft.com/en-us/graph/api/driveitem-setretentionlabel?view=graph-rest-1.0&tabs=http, I can implement is as Update-PnPFileRetentionLabel. For this one which refers , shall I keep as Unlock-PnPFileRecord with a switchparameter to lock the record? |
|
Both of them are point to the same Graph endpoint with different payloads. |
|
Sounds good, I will have a go at it and reiterate with further changes. |
c6c5e9a to
89edb71
Compare
|
@gautamdsheth : sorry about the delay. I finally updated the PR to use the MS Graph and applies only to file retention label updates. |
Removing as this is no longer a separate cmdlet
|
Thanks @reshmee011 ! |
Type
What is in this Pull Request ?
Files related to new cmdlet to unlock a list item
-src\Commands\Lists\UnlockListItemRecord.cs