SharePoint hosted add-in error Failed to get web title Error Access Denied

SharePoint hosted add-in error Failed to get web title Error Access Denied

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:

SharePoint hosted add-in error Failed to get web title Error Access Denied
SharePoint hosted add-in error Failed to get web title Error Access Denied

Solution:
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:

SharePoint hosted add-in error Failed to get web title Error Access Denied
SharePoint hosted add-in error Failed to get web title Error Access Denied

Once you modify this change, when you will deploy the add-in it will ask to trust the add-in like below:

SharePoint hosted add-in error Failed to get web title Error Access Denied
SharePoint hosted add-in error Failed to get web title Error Access Denied

Once you trust the add-in, you will not receive any access denied error. Hope this will be helpful.


You May Also like the Following SharePoint Online Tutorials:

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →