Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm using SPWebConfigModification to update web.config. I've got the following scenario:

<configuration>
  <configSection>
    <sectionGroup>
      <childnodes />
    </sectionGroup>     
    <sectionGroup>
      <childnodes />
    </sectionGroup>
  </configSection>
</configuration>

When I add a new <sectionGroup> it adds fine but when I add a childnode to it, the child node is adding to the first <sectionGroup> tag. I'm using

Xpath=configuration/configsection/sectionGroup

Does anyone know what I'm doing wrong?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

As there are more then one sectionGroups in the Config..try

configuration/configsection/sectionGroup[index]

or you can select correct sectionGroup by giving name as given below.

configuration/configsection/sectionGroup[@name = 'microsoft.sharepoint.client']

above xPath will return the sectionGroup with name 'Microsoft.sharepoint.client'..

share|improve this answer
    
@sbtahir: Thanks for giving the answer, please mark it as the answer. Thanks :) –  Alex Angas Aug 17 '10 at 5:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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