kamagra how much to take

SharePoint Timer Jobs And Feature Receivers Accessing the Term Store (Service Applications)

When working with timer jobs, feature receivers, and other SharePoint assets that use the service application architecture components you may encounter the error:

UnauthorizedAccessException: “The current user has insufficient permissions to perform this operation”

even when leveraging a highly privileged accounts such as domain administrators. While the focus of this post is just going to use the Term Store as an example, this can happen with anything that subscribes to the 2010 services architecture.

Consider the below sample code which will attempt instantiating a few objects from the Term Store:

  1. TaxonomySession session = new TaxonomySession(site);
  2. //  can also be a Metadata Term Store Name
  3. TermStore store = session.TermStores[1];
  4.  
  5. // Bad news bear happens here
  6. GroupCollection groups = store.Groups;
  7.  
  8. // Or other actions can cause this error
  9. Group group = store.CreateGroup("Group");
  10. TermSet set = group.CreateTermSet("Term Set 1");
  11. set.CreateTerm("Term 1", 1033);
  12. store.CommitAll();

The second sample is just there for posterity, assume the first example piece of code because it is a pretty simple collection hydration. TaxonomySession is the entry point to accessing all data associated with TermStore objects as can be seen with the use of the TaxonomySession.TermStores property following. You can pretty much do whatever after those proxy objects are set in place.

Due to service application interaction in SharePoint 2010, services architecture process accounts running things like timer jobs and feature event sinks still lean on a proxy for connectivity. In 2007 this was a lot different because it was more blanket, timer process accounts were more liberally leveraged across processes. In 2010, it becomes increasingly important to ensure that accounts are specifically designated for particular services.

Under these pretenses, it is necessary to determine what is being used for the SharePoint\System account (your app pool and farm account, I know you can mask in a similar format ala policies) and add it to the Term Store Administrators or whatever service group you need. Should run just fine afterwards.

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>