cancel
Showing results for 
Search instead for 
Did you mean: 

Get lock owner of a checked-out file

sakshik
Star Contributor
Star Contributor

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 ACCEPTED ANSWER

sanjaybandhaniya
Elite Collaborator
Elite Collaborator

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 answer in original post

2 REPLIES 2

sanjaybandhaniya
Elite Collaborator
Elite Collaborator

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

Thanks.

Also, I got the correct property from Node Browser:

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