Domanda

To add a taxonomy-Column to a List I try to add a new TermSet in the default Termstore. This is the code:

TermStore termStore = session.GetDefaultSiteCollectionTermStore();
clientContext.Load(termStore);
TermSetCollection termSets = termStore.GetTermSetsByName(TermSetName, lcid);
clientContext.Load(termSets);
clientContext.ExecuteQuery();
if (termSets==null || termSets.Count==0)
{
var termGroup = termStore.GetTermGroupByName(TaxonomyGroup);
if (termGroup == null)
{
termGroup = termStore.CreateTermGroup(TaxonomyGroup);
}
termSetId = Guid.NewGuid();
TermSet termSetColl = termGroup.CreateTermSet(TermSetName, termSetId, lcid);
}

On CreateTermGroup() I receive a "Permission denied" error for my Add-In.

I already added write-Permissions to the taxonomy in my manifest:

  <AppPermissionRequests AllowAppOnlyPolicy="true">
    <AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web/list" Right="FullControl" />
    <AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="FullControl" />
    <AppPermissionRequest Scope="http://sharepoint/taxonomy" Right="Write"     />
    <AppPermissionRequest Scope="http://sharepoint/content/sitecollection" Right="FullControl" />
  </AppPermissionRequests>

What additional permission do I need?

È stato utile?

Soluzione

Found a solution myself: It does not seem to be possible to create a new Group using CSOM. Nonetheless: This is not neccessary to create a new taxonomy. Instead the default Group of the sitecollection can be used:

termGroup=termStore.GetSiteCollectionGroup(siteCollection, true);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top