Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New cmdlet to unlock list item #4457

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

Conversation

reshmee011
Copy link
Contributor

Type

  • New Feature

What is in this Pull Request ?

Files related to new cmdlet to unlock a list item

-src\Commands\Lists\UnlockListItemRecord.cs

  • documentation\Unlock-PnPListItemRecord.md

@gautamdsheth
Copy link
Collaborator

hey @reshmee011 , instead of this CSOM based API request , let's use the graph based one:

https://learn.microsoft.com/en-us/graph/api/driveitem-lockorunlockrecord?view=graph-rest-1.0&tabs=http

Can you modify the PR to do that ?

@reshmee011
Copy link
Contributor Author

@gautamdsheth : Sure I can do that, I will make the changes soon.

@reshmee011
Copy link
Contributor Author

@gautamdsheth : Is there any existing function to retrieve the driveid of the list or library from Graph?
The graph endpoint requires the drive id, if there is already functionality for it, it will help.
https://learn.microsoft.com/en-us/graph/api/driveitem-lockorunlockrecord?view=graph-rest-1.0&tabs=http

@gautamdsheth
Copy link
Collaborator

Hi @reshmee011 , we use PnP Core for this.

Check this :

IFile sourceFile = Connection.PnPContext.Web.GetFileByServerRelativeUrl(serverRelativeUrl, p => p.VroomDriveID, p => p.VroomItemID);

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

@reshmee011
Copy link
Contributor Author

@gautamdsheth : Thanks for the guidance. I have not tested it yet, will Connection.PnPContext.Web.GetFileByServerRelativeUrl work for list item as well? Is there a method to just get List/library driveid within PnP Core?

@reshmee011
Copy link
Contributor Author

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants