2

I want to change the default forms for lists with CSOM C#, which is already working fine:

using (var ctx = new ClientContext(url))
{
    ctx.Credentials = new SharePointOnlineCredentials(Username, Password);

    List spList = ctx.Web.Lists.GetByTitle(list);
    ctx.Load(spList);
    ctx.ExecuteQuery();

    spList.DefaultEditFormUrl = "_forms/EditForm2.aspx";

    var group = ctx.Web.AssociatedOwnerGroup;
    ctx.Load(group);
    ctx.ExecuteQuery();

    spList.AddPermissionLevelToGroup(group.Title, RoleType.Administrator);
}

However, even if I add permissions to the owner group, I can't manage to access the edit form after setting the new one this way

1

I found out what was the issue, it's not that permissions were removed from setting the URL, but that my user did not have permissions to access _forms/EditForm2.aspx.

If the file is instead located in Lists/list2/EditForm2.aspx, everything works just fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.