0

I have a multi tenant environment. Each tenant has a Content Type Hub site collection and a Root site collection. Using Visual Studio 2013, I created a Content Type and added a managed metadata column in it, which is also created through Visual Studio 2013 feature. In the feature activated event of the Site column, I am connecting the column to the appropriate term set in the Managed Metadata Store of the Content Type Hub site collection.

I am publishing the Content Type, through code in the Feature Activated event. Also, I am trying to run the Content Type Hub Job and the Content Type Subscriber Job through the Content Type's Feature Activated event. But this gives access denied exception.

I tried setting the RemoteAdministrator flag also, but no luck. But, if I publish the content type through UI and then run the jobs also from UI, it is working. Can anyone please explain this? Can anyone please throw some light on whether there is any special way to do this in a multi tenant environment. From UI, if I create a Content Type and publish it, it works, but from code, it doesn't.

Any help will be highly appreciated.

3
  • Did you published content types in Office 365 environment? Can you share the code and some explanation on it please?
    – Asad Refai
    Aug 5, 2015 at 12:36
  • No Asad. It was in On Premise deployment only. The code is pretty straight forward and simple. If you still want it, I can provide it.
    – Ven
    Aug 11, 2015 at 10:01
  • Ah not a problem. I was looking for some work around in O365. Cheers to you.
    – Asad Refai
    Aug 11, 2015 at 10:08

1 Answer 1

0

This turned out to be a permission issue. I tried wrapping the code to publish the content type within SPSecurity.RunWithElevatedPrivileges and it worked. Also, do remember to use a new SPSite instance within this delegate, instead of using it from the context.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.