Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Unique Permissions per Document in Document Folder in Document Library set via JavaScript

$
0
0

Hello,

I've got a Document Library with seven Documents I want to set the same unique permissions for each document in it.  I'm trying to make it so that a SharePoint Group, I have created through JavaScript procedures (JSOM), can be given specific rights to full control over the document(s), while everyone else only has ReadOnly rights.

I've looked into try to break Role Permissions.  I found this link, that looked like it might be useful for breaking Inheritance:

http://sharepoint.stackexchange.com/questions/118070/assigning-folder-permissions-with-jsom

but it all seems to go OK, except I get an error once it reaches the

console.log(String.format('Folder {0} has unique permissions',folderItem.get_item('Title')));

saying the item has not been initialized.

I am also having to put these calls into a sp.sod.executefunc('sp.js' 'sp.clientcontext', ... function to get them to execute properly.

Does anyone have any suggestions on a good or better way to do what I am trying to get done?  I also need to know how to go about setting the permissions for the documents.  But I've been trying to break the inheritance first.

I'll be honest, that I am better with REST API/AJAX calls than I am with the executeQueryAsync calls, but I'm willing to try any way to get this done.

Thanks in advance.


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>