problem with spweb.allProperties

We use a 3rd party add in for forms authentication on our extranet("Extranet Collaboration Manager") - this has been working fine for years, but we have one site where it causes me problems.

What I saw a few weeks ago is that, in SP designer, you can choose "site options" and look at the tab "Parameters" - and this application adds some entries there, in additional to the usual ones.  However for some reason, on one site, all entries in Parameters are missing. When I try to add back in the relevant property I get an error stating "the name <mykeyname> is already defined"

using powershell, I can see values in spweb.allproperties - even though they don't show up in the Site Options page of SP Designer.  Some of those properties have names that look corrupted - names like "?;" ; "?r;" ; "?B" ; "xR;" - but I can't delete them. I've tried spweb.allProperties.clear() - but when I do spweb.update() I get the following error:

Exception calling "Update" with "0" argument(s): "Item has already been added. Key in dictionary: '?r;'  Key being added: '?r;'"

I've tried deleting the keys one at a time, but always get the above error. 

Does anyone have any suggestions on a tricky way I can clear out those values?

Thanks

April 30th, 2015 5:27pm

Hi,

SPWeb exposes two ways of interacting with the property bag:
  SPWeb.Properties exposes a Microsoft.SharePoint.Utilities.SPPropertyBag
  SPWeb.AllProperties exposes a System.Collections.Hashtable

 Apparently the AllProperties is meant to replace Properties, but Properties was left in place for backwards compatibility.While entries added to Properties get propagated to AllProperties with a lowercase key, entries added to AllProperties do not get propagated to Properties.

So, if you want to clear the AllProperties, you need to clear the Properties firstly.

Reference:

http://trentacular.com/2009/06/sharepoint-the-wicked-spwebproperties-propertybag/comment-page-1/

http://blog.johnsworkshop.net/letting-the-cat-out-of-the-sppropertybag-with-sharepoint-designer/

http://pbs2010.codeplex.com/

Best Regards,

Eric

Free Windows Admin Tool Kit Click here and download it now
May 4th, 2015 9:27am

When I looked at the spweb.properties collection, it had no values in it.

I wound up modifying the field "metainfo" in the AllWebs table of the associated content database - I know that isn't supported (directly modifying the content database) - but I couldn't find any other way of changing those values.

References:

http://blogs.technet.com/b/officeasia/archive/2010/11/28/db-trick-to-view-binary-if-the-binary-is-really-just-text.aspx

http://stackoverflow.com/questions/23746126/how-to-set-a-string-value-into-varbinary

Thanks for your help

May 13th, 2015 1:10pm

Hi,

You can try to use the SharePoint Property Bag solution to set the site properties:

https://pbs2013.codeplex.com/

SharePoint Property Bag offers developers to store configurations settings at different levels of the SharePoint hierarchy outside of the application itself.

Best Regards,

Eric

Free Windows Admin Tool Kit Click here and download it now
May 14th, 2015 3:41am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics