SharePoint hosted add-in: Error. Access denied. You do not have permission to perform this action or access this resource
Check out Best Alternative to InfoPath -> Try Now
This SharePoint tutorial explains, 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. The full error comes as, Failed to get web title. Error.Access denied. You do not have permission to perform this action or access this resource.
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 host web site title in add-in web in SharePoint hosted add-in in SharePoint Online Office 365 Site?
- How to retrieve all host web lists in add-in web in SharePoint Online Office 365 in SharePoint hosted add-in?
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:
Failed to get web title. Error.Access denied. You do not have permission to perform this action or access this resource.
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:
- Video Tutorial: Create and Deploy SharePoint Hosted Add-in using Visual Studio 2017/2015
- SharePoint Online Develop SharePoint Hosted Add-in using Visual Studio 2015 Demo
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.
You may like following SharePoint hosted add-in tutorials:
- SharePoint Hosted Apps: Create Choice Type Column in SharePoint Online Office 365
- How to debug SharePoint or Provider hosted Add-in in the different browser in visual studio 2015?
- The required version of SharePoint Foundation or SharePoint Server is not installed on this system while developing SharePoint hosted add-in in SharePoint 2016
- Steps to create a provider-hosted add-in in SharePoint Online and host in Microsoft Azure using Microsoft Azure Web Apps method
- Create remote event receiver sharepoint online as provider hosted add-in and deploy into Microsoft Azure step by step tutorial
- Skipping the uninstall step because the SharePoint Add-in is in an invalid state and cannot be uninstalled error in SharePoint hosted add-in
- How to manually Trust SharePoint Add-in developed by visual studio SharePoint online?
- Set up an On-Premise development environment for SharePoint Add-in or Apps development in SharePoint 2016/2013
- How to send email to SharePoint group in visual studio 2015 workflow in SharePoint hosted add in SharePoint online?
- SharePoint Hosted App: Get Data from Host Web
Hope this will be helpful to solve the issue, Failed to get web title. Error. Access denied. You do not have permission to perform this action or access this resource.
Download SharePoint Online Tutorial PDF FREE!
Get update on Webinars, video tutorials, training courses etc.