File Details - Owner

0 votes
asked Feb 6, 2020 by michael-s-4691 (220 points)
I'm working on a process that will be moving files throughout some UNC paths, and I'm needing to keep track of the owner of the document (i.e. the person that created the file) during this process.  Is there a way to get this information within Qvera?

1 Answer

+1 vote
Best answer

With Qvera you can write functions and scripts that take advantage of Java and Javascript. That being said you can take advantage of Java class in order to get properties of a file.

Here is how I would find the document owner:

// First get the path to your file
var path = java.nio.file.Paths.get("C:\\Users\\Michael\\Desktop\\fhir_starter_example.docx");
// Now get a view of the attribute
var ownerAttributeView = java.nio.file.Files.getFileAttributeView(path, java.nio.file.attribute.FileOwnerAttributeView);
// Set the owner
var owner = ownerAttributeView.getOwner();
// Debug out the name of the owner
qie.debug('Owner: ' + owner.getName());

answered Feb 6, 2020 by michael-h-5027 (13,630 points)
selected Feb 7, 2020 by michael-s-4691
commented Feb 7, 2020 by michael-s-4691 (220 points)
Perfect.  Worked flawlessly.