4

You could try to add the following before your if (if (t.Name == "SPGroup" || t.Name == "SPUser")) statement: if (roleAssignmentSingle.Member.LoginName == properties.UserLoginName) continue;


3

Try the following: if (roleAssignmentSingle.Member.ID != SPContext.Current.Web.CurrentUser.ID) { SPRoleAssColn.Remove(i); }


2

I've developed some code to perform this task. Hope it helps somebody. foreach (SPRoleAssignment roleAssignment in listItem.RoleAssignments) { if (roleAssignment.Member.LoginName != user.LoginName) { continue; } foreach (SPRoleDefinition roleDefinitionBinding in roleAssignment.RoleDefinitionBindings) { if (...


2

Have you tried using web.EnsureUser(loginName) to add the user? Also, I stumbled on this other article that seems to be saying that if you are using claims, you do need to include the claims prefix as part of the login name.


2

Try using the following code: Note: change the data within "<>" to your information. Ensure you are using latest SharePoint Online SDK (Microsoft.SharePointOnline.CSOM). using System; using System.Collections.Generic; using System.Configuration; using System.Security; using Microsoft.SharePoint.Client; namespace ConnectingToO365 { public ...


2

The value from a multi-user field is actually a user object. You should be able to do the following to ensure the user from login name and add role assignments: if (!(Add-PSSnapin microsoft.sharepoint.powershell -EA SilentlyContinue)) { Add-PSSnapin microsoft.sharepoint.powershell -EA SilentlyContinue } # get web $web = Get-SPWeb http://myintranet # get ...


2

This is because your function getCurrentUser() has an async operation (executeQueryAsync). JS does not wait for it to complete and executes the next line i.e. console.log(user). You need write the subsequent code from getCurrentUser() inside the function onQuerySucceededGetCurrentUser then only you will get the current user.


2

I figured it out The below code worked for me Folder sourceFolder = oWeb.GetFolderByServerRelativeUrl("Affaires/Test Affaire/Mails"); ctx.Load(sourceFolder); ctx.ExecuteQuery(); Folder destinationFolder = folder.Folders.Add("Demo"); destinationFolder.ListItemAllFields.BreakRoleInheritance(false, false); RoleAssignmentCollection roleAssignments = ...


1

Change the breakroleinheritance rest endpoint from /_api/web/GetFolderByServerRelativeUrl('/<library>/<folder url>')/breakroleinheritance(copyRoleAssignments=true, clearSubscopes=true) to the following rest endpoint /_api/web/GetFolderByServerRelativeUrl('/<library>/<folder url>')/ListItemAllFields/breakroleinheritance(...


1

Please use below code: for(int i = newFile.Item.RoleAssignments.Count - 1; i >= 0; i--) { newFile.Item.RoleAssignments.Remove("Pass your SPUser Object"); } Hope it works for you.


Only top voted, non community-wiki answers of a minimum length are eligible