This SharePoint tutorial explains how to resolve issue Microsoft.SharePoint.Client.ServerUnauthorizedAccessException. Access Denied, You do not have permission to perform this action or access this resource.
The error comes in while creating a term store using PnP CSOM in SharePoint Online Office 365. The error looks like below:
I wrote the below code to create groups, term sets, terms etc using SharePoint CSOM using PnP SharePoint Office 365.
if (termStore != null)
{
// Create group, termset, and terms.
//TermStore store = taxonomySession.GetDefaultKeywordsTermStore();
TermGroup myGroup = termStore.CreateGroup("TSInfo Group", Guid.NewGuid());
TermSet myTermSet = myGroup.CreateTermSet("Brand", Guid.NewGuid(), 1033);
myTermSet.CreateTerm("TV", 1033, Guid.NewGuid());
myTermSet.CreateTerm("Camera", 1033, Guid.NewGuid());
myTermSet.CreateTerm("Fridge", 1033, Guid.NewGuid());
myTermSet.CreateTerm("Washing Machine", 1033, Guid.NewGuid());
cc.ExecuteQuery();
}
Microsoft.SharePoint.Client.ServerUnauthorizedAccessException. Access Denied, You do not have permission to perform this action or access this resource
I am a global administrator in Office 365 tenant. But still, the error was coming.
For this, you need to be a member of “Term Store Administrators”.
Open SharePoint Online Admin site and click on Term Store from
There you will see Term Store Administrator, add the user name here.
Now if you will run the code the error “Microsoft.SharePoint.Client.ServerUnauthorizedAccessException. Access Denied, You do not have permission to perform this action or access this resource” will not come and you can able to create groups, term sets or terms.
Note: Even if you are a global administrator, you can add terms unless you are in Term Store Administrator group.
You may like following SharePoint Tutorials:
- How to Backup Office 365 Mailboxes Emails and Data – eDiscovery Tool
- Content query web part SharePoint Online or SharePoint 2013/2016
- Add SharePoint 2016/2013 List/Library Columns to view programmatically using the server object model in Visual Studio 2017
- Create Site Columns programmatically in SharePoint 2016/2013 using Server Object Model in Visual Studio 2017
- Create a Document Library with Columns programmatically in SharePoint 2016/2013 using Visual Studio 2017
- Create Bulk Users in Office 365 (from CSV File)
- Add a Link to web part title in SharePoint Online/2013/2016
- Customize SharePoint online list forms like new, edit and display form using Microsoft PowerAppshttps://www.spguides.com/the-list-is-too-large-to-save-as-a-template/
- increase maximum size of list template SharePoint 2013
- Rename SharePoint List Title Column Programmatically using PnP CSOM
I hope this SharePoint Online tutorial helps to resolve error Microsoft.SharePoint.Client.ServerUnauthorizedAccessException. Access Denied, You do not have permission to perform this action or access this resource.
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 EnjoySharePoint.com