locked
Add a content query to Site Definition RRS feed

  • Question

  • Hi all,

    I need to add a content query on an announcement list  to a site definition, to be able to add it on the Homepage of each new site. How is that possible??


    Regards, Khalil A. Kamel
    • Moved by Mike Walsh FIN Tuesday, June 28, 2011 8:16 PM not programming (From:SharePoint - Development and Programming (pre-SharePoint 2010))
    Tuesday, June 28, 2011 5:27 PM

Answers

  • try to perform the following steps

    1. add your web part in Sharepoint site via UI and customize it by your needs

    2. export web part to the .webpart file

    3. create new feature of Site scope which will add web part into Web parts gallery of the site collection

    4. add reference on the created feature to the onet.xml - into <SiteFeatures> section.

    the only thing you need to unsure is that inside exported .webpart file there is no absolute URLs like http://example.com/Lists/Announcements. Try to replace them with relative URLs (/Lists/Announcements). If it won't work try to use placeholders for URLs as shown here: Provisioning Content Query Web Part querying subsites in a structured and repeatable way.


    Blog - http://sadomovalex.blogspot.com
    CAML via C# - http://camlex.codeplex.com
    • Marked as answer by Peng Lei Wednesday, July 6, 2011 7:07 AM
    Tuesday, June 28, 2011 6:18 PM