Move Data View Webpart to New Site Breaks

You move a Data View Webpart to a new site and it breaks.

This may happen because the list you were referencing moved as well, as in you moved an entire site using export-spweb and import-spweb powershell commands.

This may happen because you developed this webpart in a test or development server and it referenced a list on that system, but when importing it into a production system the list it references in the new production site is going to have a different GUID.

If you open this page in SharePoint designer you will get this error:

The server returned a non-specific error when trying to get data from the data source.  Check the format and content of your query and try again.  If the problem persists, contact the server administrator.

Well yeah, the GUID you are referencing doesn't exist at the location you are accessing it from.

TO FIX:

Very simple.

  1. Visit the list where you wish to pull the data from.
  2. Choose List menu, List settings page.
  3. Look at the URL, see the ListId?  Something with your base url and a query string behind it?
    1. /_layouts/listedit.aspx?List=%7BAE491D2A%2D7C97%2D4F5B%2D894F%2D1779B2D3E004%7D
  4. This is the GUID, with specially interpreted characters:
    1. %7BAE491D2A%2D7C97%2D4F5B%2D894F%2D1779B2D3E004%7D
    2. Hints:
      1. %7B is {
      2. %2D is -
      3. %7D is }
  5. Reformat the GUID into its proper form so you can use it in the SP Designer page code:
    1. {AE491D2A-7C97-4F5B-894F-1779B2D3E004}
  6. Go to the pages you are using this list in data view webparts.
    1. I have some sites where the default.aspx and 10 aspx pages are each using a data view webpart with custom styling and formatting using XSLT stylesheets that I create, with several references in data view webparts to the same list on each page.
  7. Look at the data view webpart in Code view.  Grab the old GUID, easy to find as it is referenced in multiple spots.  You need to understand the code so start learning it.
  8. Here is an example of one spot it will be in:

    <WebPartPages:DataFormWebPart runat="server" Description=..........
      <ParameterBinding Name="dvt_apos" Location="Postback;Connection"/>
        <ParameterBinding Name="ManualRefresh" Location="WPProperty[ManualRefresh]"/>
          <ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/>
            <ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/>
              <ParameterBinding Name="ListID" Location="None" DefaultValue="{E34307C3-5FC6-4877-906D-D03D711884C2}"/>
                <ParameterBinding Name="qsRelease" Location="QueryString(Release)" DefaultValue=""/>
                  </ParameterBindings>


                  1. I have shown you the old GUID location in bold.  You will go to every page where your Data view for this list is broken, and click in the code view, do a Replace, replace the old with your new GUID.
                  2. Note:  Sometimes you have to also change the lowercase version of this GUID, it looks like this in the dataview webpart first line of properties:
                    1. ListId="ae491d2a-7c97-4f5b-894f-1779b2d3e004"
                    2. Notice it is in lowercase, but generally if you do the replace first, the design view will refresh and the data view will just work and it will interpret the lowercase portion.
                  3. I shouldn't have to say this, because you should understand how you are referencing lists, but you need to repeat these procedures for every list that has a new GUID.
                  4. Repeat until all pages using this list render properly in the browser.

                  Comments

                  Popular posts from this blog

                  SharePoint Designer 2013 Approval Workflow with Comments

                  Change SharePoint server hostname and Web Application Names

                  The Timer Service Failed to Recycle