On SharePoint 2010, I have a site template solution created by saving a site as a template. Recently I modified the template in Visual Studio - I needed to change the markup for several XsltListViewWebParts (changed the BaseViewId from 0 to 1) on the default.aspx page. I found that the markup that I needed to change actually lived in the elements.xml file associated with the default.aspx file.

I would like to make the same change to hundreds of sites that have already been created from this site template. I have figured out how to get at the default.aspx file from the SPWeb.Files collection, but I cannot figure out how to get at the elements.xml file.

Any help is appreciated!

1 Answer 1


Once created, the pages really have no connection to the elements file anymore.

You could probably open a SPLimitedWebPartManager with the URL to the page, find the correct webpart and change a property on it though! More of that here: http://www.kentd.com/2013/03/06/update-web-part-on-a-page-using-powershell-in-sharepoint-2010/

  • This put me on the right path - found what I needed in the XsltListViewWebPart.XmlDefinition property.
    – Ken Green
    Nov 21, 2013 at 22:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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