0

If I store custom data inside SPContentDatabase.Properties, must I be farm admin to be able to update it? E.g.

SPContentDatabase contentDatabase = GetContentDatabase();
contentDatabase.Properties["CustomKey"] = "Lorem Ipsum Dolor";
contentDatabase.Update(); // could this throw an exception unless I'm farm admin?

I assume the answer is yes, farm admin privileges are needed (unlike for updating e.g. SPWeb.Properties), which means that even running with elevated privileges won't help. Am I correct?

1

Farm admin rights are needed to write to config DB whereas app pool account can write to content DB. That means running the code inside RunWithElevatedPrevileges should be able to write to content DB.

0

When you run with elevated privileges it will use the application pool identity. The application pool identity has full access to the web application.So you need to be farm admin to access content db.

There is other interesting way to look at your question . Below scenario can be considered The property bags are stored under content db. Your current application pool account and Farm account must be same otherwise you'll get the "Access Denied or Unauthorized exception even though you used "RunWithElevated Privilege" delegation.

REFER: http://intelliview.blogspot.com/2013/11/farm-level-property-in-sharepoint.html

  • Given that this directly contradicts the accepted answer, are you absolutely sure that you need to be a farm admin to access (by that you mean write, I assume) the content DB (i.e. not config DB) properties? I don't believe the example you quote applies - it's using SPFarm.Properties, not SPContentDatabase.Properties. – w128 Mar 28 '14 at 9:24
  • Farm admin rights are needed to write to config DB whereas app pool account can write to content DB. – Nikhil J Mar 28 '14 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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