Read/Write from/to Hierarchical Object Store - SharePoint 2007

旧街凉风 提交于 2019-12-19 04:40:09

问题


I've created a custom timer job which has requires some configurations to run. I'm trying to save the configurations as an SPPersistedObject in hierarchical object store.

Hierarchical object store is saved in the SharePoint configuration database and hence I'm getting 'Security Error' while trying to save it with a SPWebApplication as the parent.

I've even tried elevating the privileges but it dint help because it is just the application pool account for the current web application and it is not necessary for it to have the access to the SharePoint config database.

Any ideas?


回答1:


As you've found the hierarchical object store (HOS) is stored in the configuration database, not the content database.

If you're running in the context of a site other than the central admin then the user account the application pool uses may not have permissions to Write to the configuration database.

This is a bit of a doozy as you probably won't see this on a developer installation (as you probably won't have it setup with domain level accounts for app pools, only NETWORK SERVICE) and you will only trip up when you get to production.

Note - Using SPSecurity.RunWithElevatedPrivileges will not change this as that just eleveates from the restricted user account to the application pool account and not the central admin app pool account.

The article Managing Application State gives a breakdown of the options and it says about the HOS

Security model - Users need administrator privileges to access the related SharePoint object (such as SPFarm or SPWebApplication).

For these reasons I think the HOS is very limited in real world usage and you're better off using the Property Bag Storage model which can store settings at the Farm/WebApp/Site and List Levels :-

Advantages - It is probably the most light-weight and easy to use of all the configuration storage options.

There are also reported performance and stability benefits.

In fact the MSDN SharePoint Guidance Library also uses the Property Bag storage for their implementation of a hierarchical Configuration Manager.




回答2:


Kindly follow the below article that may be help for you http://www.bluedoglimited.com/SharePointThoughts/ViewPost.aspx?ID=271

as well a project on codeplex

http://features.codeplex.com/



来源:https://stackoverflow.com/questions/4561976/read-write-from-to-hierarchical-object-store-sharepoint-2007

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!