Getting document title when you don't have permission

Hi people :) I need to take the title of a document using java code even when the user doesn't have permission to see it.Can someone tell me if this is possible?

0 votes

1 answers

1489 views

ANSWER



Use a privileged session:

DocumentRef ref = doc.getRef();
String title = CoreInstance.doPrivileged(doc.getCoreSession(), 
    (CoreSession privilegedSession) -> (String) privilegedSession.getDocument(ref).getPropertyValue("dc:title")
);
0 votes



Thank you Florent,but i found another way using UnrestrictedSessionRunner.I think this is better because i have to iterate through the parents of a document too.
11/17/2017

It's equivalent but UnrestrictedSessionRunner is more verbose.
11/17/2017