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 would think there's something supersimple I'm missing, but I can't find where I'm going wrong.

I have a feature deploying a default.aspx page with two CQWP webparts. I use the AllUsersWebPart method and specify WebPartZone and WebPartOrder. Even so, the webparts are deployed in seemingly random order.

Here's my relevant XML from the Elements.xml file that deploys the default.aspx page:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="SectionFrontPage" Path="SectionFrontPage" Url="" >
    <File Path="default.aspx" Url="default.aspx" IgnoreIfAlreadyExists="TRUE" >
      <AllUsersWebPart ID="News1" WebPartZoneID="ContentLeft" WebPartOrder="0">
        <![CDATA[
          <?xml version="1.0" encoding="utf-8"?>
          <webParts>
            <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
              <metaData>
                <type name="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart, Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
                <importErrorMessage>Cannot import this Web Part.</importErrorMessage>
              </metaData>
              <data>
                <properties>
                  <property name="Title" type="string">News from this section</property>
                </properties>
              </data>
            </webPart>
          </webParts>
        ]]>
      </AllUsersWebPart>
      <AllUsersWebPart ID="News2" WebPartZoneID="ContentLeft" WebPartOrder="1">
        <![CDATA[
          <?xml version="1.0" encoding="utf-8"?>
          <webParts>
            <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
              <metaData>
                <type name="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart, Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
                <importErrorMessage>Cannot import this Web Part.</importErrorMessage>
              </metaData>
              <data>
                <properties>
                  <property name="Title" type="string">News from subsections</property>
                </properties>
              </data>
            </webPart>
          </webParts>
        ]]>
      </AllUsersWebPart>
    </File>
  </Module>
</Elements>
share|improve this question
    
umh, I have tried that sometime ago, checked it now and it looked just the same, but I didn't use the webParts tag, only webPart. Dunno if that would make any difference –  Anders Aune Dec 5 '11 at 12:49
    
Removing the webparts tag only lead to this error: Web Part Error: Cannot recognize the XML namespace of this Web Part. Show Error Details Hide Error Details [WebPartPageUserException: Cannot recognize the XML namespace of this Web Part.] at Microsoft.SharePoint.WebPartPages.WebPartImporter.CreateXdoc(XmlReader reader)... –  tarjeieo Dec 5 '11 at 15:24
    
I see, I'm no expert on this. But I used content editors only, the code looks roughly like this: <WebPart xmlns:xsi="w3.org/2001/XMLSchema-instance"; xmlns:xsd="w3.org/2001/XMLSchema"; xmlns="schemas.microsoft.com/WebPart/v2">;, then I have tags for <Assembly /><TypeName /><Title /><FrameType /><Content xmlns="schemas.microsoft.com/WebPart/v2/ContentEditor"></…; –  Anders Aune Dec 6 '11 at 7:24
    
What type of web part page? Some web part page has no zone, some had 1 or 2 zone. –  M. Todd Sep 15 '12 at 4:15
add comment

3 Answers

Please make sure you have correct WebPartZoneID, by default it's - Left.

share|improve this answer
    
I've modified the page. ContentLeft is correct. –  tarjeieo Dec 5 '11 at 15:23
add comment

Add another web part zone and split the web parts up.

share|improve this answer
    
That'll work, although it's avoiding the problem, not solving it :) –  tarjeieo Dec 7 '11 at 15:22
add comment

For the WebPartOrder property, try to start the numbering at 1, not 0. I just did a search across the 14 hive for all uses of AllUsersWebPart, and none of them used 0. Just a guess, but worth a shot.

share|improve this answer
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.