Category Archives: JSOM

Permissions list

var list = web.get_lists().getByTitle(titleList); list.breakRoleInheritance(false, true); var roleDefBindingAdmin = SP.RoleDefinitionBindingCollection.newObject(context); roleDefBindingAdmin.add(web.get_roleDefinitions().getByType(SP.RoleType.administrator)); var roleDefBindingColl = SP.RoleDefinitionBindingCollection.newObject(context); roleDefBindingColl.add(web.get_roleDefinitions().getByType(SP.RoleType.contributor)); var roleDefBindingRead = SP.RoleDefinitionBindingCollection.newObject(context); roleDefBindingRead.add(web.get_roleDefinitions().getByType(SP.RoleType.reader)); list.get_roleAssignments().add(groupCollection.getByName(Gr_Owner), roleDefBindingAdmin); list.get_roleAssignments().add(groupCollection.getByName(Gr_PPM_Corportate), roleDefBindingColl); list.get_roleAssignments().add(groupCollection.getByName(Gr_PPM_Network), roleDefBindingRead); context.executeQueryAsync(function () { SuccessMessage(‘permissions of list <strong>’ + titleList + ‘</strong> was updated’); … Continue reading

Posted in JSOM, sharepoint online | Leave a comment

Create groups

var arrayGroups = [{ name:”gr1″, desc: “” }, { name: “gr2”, desc: “” }, ] var syncGroup = new Synchronizer(Phase_CreateGroups); function CreateGroups() { //Get all groups in site var groupCollection = web.get_siteGroups(); context.load(groupCollection); arrayGroups.forEach(function (item) { // Create Group information … Continue reading

Posted in JSOM, sharepoint online | Leave a comment

Manage List sp.js

//récupère ma liste des éléments d’une liste dans un dossier Utilities.GetListItemsByFolder = function (webUrl, ListTitle, query, folderName, success, error) { var clientContext = new SP.ClientContext(webUrl); var oList = clientContext.get_web().get_lists().getByTitle(ListTitle); var rootFolder = oList.get_rootFolder(); clientContext.load(rootFolder); //charger le root folder clientContext.executeQueryAsync(function (sender, … Continue reading

Posted in JSOM, sharepoint online | Leave a comment