Get lock owner of a checked-out file

cancel
Showing results for 
Search instead for 
Did you mean: 
sakshik
Established Member

Get lock owner of a checked-out file

Jump to solution

I am writing a web script to get a list of all the checkout documents and user who has them checked out.

I can use this api to get a Boolean answer of whether a document is checked out or not;

var docNode = search.findNode("workspace://SpacesStore/"+alfid);
model.foo = docNode.hasAspect("cm:workingcopy");

Now, I need to find the lock owner for this docNode, I tried this api but it doesn't return anything:

model.boo = docNode.properties["cm:lockOwner"]

Any suggestions?

1 Solution

Accepted Solutions
sanjaybandhniya
Intermediate

Re: Get lock owner of a checked-out file

Jump to solution

Hi,

You can use alternate solution with java backed webscript.

if (nodeService.hasAspect(nodeRefOriginal,ContentModel.ASPECT_WORKING_COPY)) {
      String docName=(String)nodeService.getProperty(nodeRefOriginal, ContentModel.PROP_NAME);
      String  workingCopyOwner=      (String)nodeService.getProperty(nodeRefOriginal,

                   ContentModel.PROP_WORKING_COPY_OWNER);
}

Thanks,

Sanjay

View solution in original post

2 Replies
sanjaybandhniya
Intermediate

Re: Get lock owner of a checked-out file

Jump to solution

Hi,

You can use alternate solution with java backed webscript.

if (nodeService.hasAspect(nodeRefOriginal,ContentModel.ASPECT_WORKING_COPY)) {
      String docName=(String)nodeService.getProperty(nodeRefOriginal, ContentModel.PROP_NAME);
      String  workingCopyOwner=      (String)nodeService.getProperty(nodeRefOriginal,

                   ContentModel.PROP_WORKING_COPY_OWNER);
}

Thanks,

Sanjay

sakshik
Established Member

Re: Get lock owner of a checked-out file

Jump to solution

Thanks.

Also, I got the correct property from Node Browser:

model.boo = docNode.properties["cm:workingCopyOwner"]