0

I've created some functions that is really about sharing objects with external users via the JSOM api in SharePoint.

var result = SP.Web.shareObject(ctx, urlToDocument,
                                        peoplePickerInput, roleValue, groupId, propageAcl,
                                        sendEmail, includedAnonymousLinkInEmail, emailSubject,
                                        emailBody, useSimplifiedRoles);

The code is working fine while in a scripteditor on a page in the same site as the library I'm sharing objects from. Then I get statuscode 0 and the user gets an email invitation.

But when I try the same code from a page in another site or even a SharePoint Hosted App i get: statuscode -3 and errormessage:

"MountPoint security error: NoScript isn't enabled on the host site

1 Answer 1

0

It was just a matter of creating the "ctx" (ClientContext) from the same location where the object is being shared. So the clientcontext needed to be dynamically created with the object parent url. ex:

Object url: "/sites/intranet/project/Shared Documents/document.aspx" ClientContext: "var ctx = new SP.ClientContext("/sites/intranet/project/")

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.