0
votes

I have created an app in Sharepoint. It's a Sharepoint hosted app and i'm trying to make the list or app read only. I know with servideside code it's possible but with clientside code i cannot find a solution.

Is this possible with javascript or jquery?

I have searched the web for a solution but can't find one.

Kind Regards,

Kris

2

2 Answers

0
votes

Stop inheriting permissions and give yourself (an admin account) full rights. Remove all other permissions and give everyone read permission.

0
votes

Use JSOM SP.SecurableObject.breakRoleInheritance method to create unique role assignments for the List object and set copyRoleAssignments argument to False in order to clear role assignments for a List.

Example

var listTitle = 'Documents';

var context = new SP.ClientContext.get_current();  
var web = context.get_web();    
var list = web.get_lists().getByTitle(listTitle);
list.breakRoleInheritance(false);
context.executeQueryAsync(
   function () {            

   },
   function (sender, args) {
      console.log(args.get_message());
   }
);