1

I followed this url to create webpart that reads list from the top site.

How to use SharePoint Designer to display list data from subwebs

It worked great. I can even export the custom web parts (wp Customer Lists.webpart) that I just created using this tutorial.

QUESTION: I now have to take this web parts and deploy to another sharepoint site (test, qc, and production).

What all I need to change with this xml web part so it can be deployed to any sharepoint site....

    3 Answers 3

    1

    It worked.

    1. I did quick replace for weburl from old to new site
    2. I went to new site's list, setttings > "audience targeting settings" right click on this to get the new GUID for the list.

    I did a quick replace for old list guid with the new GUID (ListID)

    1. Went to the new site setting > edit > add web part > Import > "Advance Web Part Gallery and Option" > Browse > Import > Select the filename.webpart file > Upload > finally Import

    That's all.

    Thanks

    2
    • james Love mark your post as an answer.
      – Anonymous
      CommentedMay 26, 2010 at 18:23
    • @JB: Only the person asking the question (you!) can mark an answer as most helpful. Just click the big tick next to the answer that solved your problem. Thanks and welcome! :-)CommentedMay 26, 2010 at 22:44
    1

    The best way I've found to manage this when i want to re-use the same DFWP in multiple sites is to actually replace the ListID parameter in the datasource with ListName parameter

    That way as long as you use the same name for the list in all your sites the one web part definition will work fine. The down side to this is that it uses the list title rather than internal name, so if a user decides to change the name of the list the DFWP will break. So you need to keep this in mind if choosing to use this method.

    Here's an example of what I mean. I've separated out the DataSource and DataFormWebPart controls to make it easier to read, but the syntax is identical if the datasource control is declared using the DataSourceString property of the DFWP, just search for ListID.

    <SharePointWebControls:SPDataSource runat="server" ID="dsSampleDataSource" DataSourceMode="List" UseInternalName="true" selectcommand="[*Your CAML query here*]"> <SelectParameters> <asp:Parameter Name="ListName" DefaultValue="SampleList"/> <asp:Parameter Name="WebURL" DefaultValue="{sitecollectionroot}"/> </SelectParameters><DeleteParameters /><UpdateParameters /><InsertParameters /> </SharePointWebControls:SPDataSource> <WebPartPages:DataFormWebPart runat="server" ID="dfwpSampleDataView" SuppressWebPartChrome="True" ChromeType="None" WebPart="false" NoDefaultStyle="TRUE" DataSourceID="dsSampleDataSource"> <DataFields>additional fields to display here</DataFields> <parameterbindings> <ParameterBinding Name="dvt_apos" Location="Postback;Connection"/> <ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/> <ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/> </parameterbindings> <XSL> <xsl:stylesheet ... </xsl:stylesheet> </XSL> </WebPartPages:DataFormWebPart> 

    Also you can leave the WebURL property empty if you want it to open the list in the current web, rather than the root web.

      0

      You'll need to look up List/Site ID GUIDs in the Code View for the Web Part, and edit as appropriate.

      1
      • So open the webpart file in VS2005 and edit the site Id guid and list ID guid. and that's all. Right. I will try. I thought so but sometimes SP does not co-operate. thanks James for your quick reply. JB
        – Anonymous
        CommentedMay 26, 2010 at 16:32