I can retrieve Shared With info from a SharePoint 2013 (On Premisses) List/Library (not an item) using Javascript?
I thought it could be available through SP.ObjectSharingInformation.getObjectSharingInformation
method, but I´m stucked on getSharedWithUsers()
method throwing an error like The collection has not been initialized.
Should I load other properties in context?
My bitcode, trying to get a simple count of shared users/groups:
var ctx = new SP.ClientContext(_spPageContextInfo.webServerRelativeUrl);
var list = ctx.get_web().get_lists().getById(_spPageContextInfo.pageListId);
ctx.load(list);
var su = SP.ObjectSharingInformation.getObjectSharingInformation(ctx, list);
console.log(su.getSharedWithUsers().get_count());
Error:
The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.