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 have a page with a DataFormWebPart setup to display some data from a subweb. The page is setup ok, the webpart is working. In my solution, I need to create the subweb (that's already working ok) and then place the DataFormWebPart on the default page of the current site.

I was trying to do this declaratively via a module, but that doesn't seem to work. I've tried this approach:

<Module Name="MyOrgPages">
<File Path="MyOrgPages\Home.aspx" Url="SitePages/Home.aspx">
  <AllUsersWebPart WebPartOrder="0" WebPartZoneID="Left">
    <![CDATA[<?xml version="1.0" encoding="utf-8"?>
      <webPart>...</webPart>
    ]]>
  </AllUsersWebPart>
</File>

But SharePoint keeps complaining it doesn't understand the content of the webpart. I got the contents by exporting the webpart to a .webpart file and copying the contents of that file.

So is this actually the correct way to do this, and if so: what could be the cause of my problem?

share|improve this question

1 Answer 1

Ah stupid. You need to include <webParts> </webParts> inside the CDATA bit, otherwise it doesn't work.

share|improve this answer

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.