0

I want to share a document with JavaScript and get its share_id programatically. There is a REST API that can do that but I didn't know how to call it from script.

Any clues?

1

1 Answer 1

1

The following hack will do the trick. (edit: Must be executed from the classpath in the repository)

var ctx = Packages.org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext();
var qsService = ctx.getBean("QuickShareService");
var sId = document.properties['qshare:sharedId'];
if (!sId) {
    sId = qsService.shareContent(document.nodeRef).id;
}

PS: It looks even more ugly on 5.0.a due to rhino-1.7.

Sign up to request clarification or add additional context in comments.

3 Comments

Hin thanx for the answer. I used your script but i get this error: "QuickShareService is not defined"
Now it tells me that Packages is not defined !!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.