Welcome to Atalasoft Community Sign in | Join | Help

Using SPWebConfigModification, Part 4 - Why doesn't this work?

 

Why doesn't this work?

 

My code would step through this XML, and at each node generate a new SPWebConfigModification.  The <location path="_some/path/here"> node, having children, would cause that code to make an EnsureSection type of modification, with a name like “location[@path=\”_some/path/here\”]” and SharePoint will complain about those aforementioned characters.  It is a section, is it not (by a definition of having children)?  And that section requires a unique XPath described by its attributes.  Why, then, can we not add what I think is a properly constructed SPWebConfigModification for that section?

The Microsoft documentation states:

When the type of web.config modification is EnsureChildNode, the Name property refers to an XPath expression that uniquely identifies the node under the parent node, as identified by the Path property. For example, to ensure a child node as a safe control entry, which has two unique attributes (e.g., Assembly and TypeName), the name should match the following XPath expression:

SafeControl[@Assembly=\"Microsoft.Sharepoint\"][@TypeName=\"*\"]

So our Name property looks right to me, but that only works for an EnsureChildNode type.

Let's make some minor changes in Part 5 that should put this all to bed.

 

Published Wednesday, October 08, 2008 1:18 PM by dterrell

Comments

Wednesday, October 08, 2008 1:21 PM by If you build it, They will come

# Using SPWebConfigModification, Part 5

We're in Part 3 of a 6 part blog post about the SPWebConfigModification object and my trials with it.

Wednesday, October 08, 2008 1:23 PM by If you build it, They will come

# Using SPWebConfigModification, Part 6

We're in Part 3 of a 6 part blog post about the SPWebConfigModification object and my trials with it.

Thursday, October 16, 2008 11:55 AM by DotNetKicks.com

# Using SPWebConfigModification, Part 4-Why doesn't this work?

You've been kicked (a good thing) - Trackback from DotNetKicks.com

Anonymous comments are disabled