App Installed Event Receiver -> Access Denied

I am using AppInstalled event receiver to create a list in host web and then breaking its role inheritance. The list is created successfully but I am getting "Access Denied" while breaking role inheritance. The host web is MySite. The code is as follows:

using (ClientContext clientContext = TokenHelper.CreateAppEventClientContext(properties, useAppWeb: false))
                if (clientContext != null)
                    Web hostWeb = clientContext.Web;

                    var listCollection = hostWeb.Lists;
                    _spService.CreateListInHostWeb(Constants.LIBRARY_NAME, Constants.TEMPLATEID_DOCUMENTLIBRARY, listCollection);
                    //code to break role inheritance
                    List library = hostWeb.Lists.GetByTitle(Constants.LIBRARY_NAME);
                    submissionLibrary.BreakRoleInheritance(false, false);
                    clientContext.ExecuteQuery(); //error here

I have assigned the following permission

<AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="Manage" />
<AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web/list" Right="FullControl" >
  <Property Name="BaseTemplateId" Value="101" />

SharePoint Asked by Garima on January 8, 2021

1 Answers

One Answer

I'm not 100% sure, but from what i see, i guess you should not use


but add library to




Answered by Evlo on January 8, 2021

Add your own answers!

Related Questions

Replace Source query string value without redirecting

1  Asked on November 28, 2021 by leonidasfett


Workflow on Survey list not starting?

2  Asked on November 25, 2021 by dylan-cristy


Sharepoint Foundation 2013: single cpu

1  Asked on November 25, 2021 by woef


Double click on ribbon save button

1  Asked on November 23, 2021 by jonata-ornelli


Imported Excel Spreadsheet not Filtering Column

1  Asked on November 23, 2021 by bhav


Ask a Question

Get help from others!

© 2022 All rights reserved.