In this post, we will discuss how we can resolve the access denied issue which comes while working with SharePoint hosted add-in in SharePoint online Office 365 site. The error comes when I was developing a SharePoint hosted add-in where I used to get host web site title. You can see the below two articles where I was trying to retrieve host web title and host web lists details using SharePoint hosted add-in.
– How to retrieve all host web lists in add-in web in SharePoint Online Office 365 in SharePoint hosted add-in?
– How to retrieve host website title in add-in web in SharePoint hosted add-in in SharePoint Online Office 365 Site?
Here we were trying to read the host web details. Once you deploy the add-in and try to open the add-in, then it will give the error like below:
To solve the issue we have to give the required permission. Here in this particular example let us give the read permission to the site collection.
If you are new to SharePoint hosted add-in development then you can check the below article on how to develop SharePoint hosted add-in using visual studio 2015.
To do this Open AppManifest.xml file from the solution explorer. Then go to the permissions tab and give the required permissions. Here we have read access to the site collection like below:
Once you modify this change, when you will deploy the add-in it will ask to trust the add-in like below:
Once you trust the add-in, you will not receive any access denied error. Hope this will be helpful.
Download FREE SharePoint 2019 Installation PDF Guide
This FREE PDF contains, Steps by step guide to install SharePoint 2019 Preview, prerequisites, hardware and software new features. First impression to SharePoint Server 2019 new modern site, modern lists and modern document libraries.