Fixing broken links in SharePoint List Forms

Posted: November 16, 2009 in Broken Links, Item Display Error

If you try to edit the any of the sharepoint forms (NewForm.aspx, EditForm.aspx,  DispForm.aspx) in SharePoint designer, then you may face the problem of broken links.

For example if a link to an item in a list should point to http://servername/sites/sitename/Lists/listname/DispForm.aspx?ID=2  but the item will take you to http://servername/ID=2.

The reason is SharePoint operates on a GUID system rather than a file system. So simply replacing the broken file with a backup file won’t work since SharePoint will look for a file with the proper GUID, not just the proper file name. Follow these simple steps.

1) Open the broken form and also another form in the same site which is working properly in the SharePoint designer.

2) Find the <WebPartPages:ListFormWebPart … to </WebPartPages:ListFormWebPart> in the broken form.

3) Replace that code from the form which is working fine.

4) The below code shows the lines that you have to change in the copied code.

<WebPartPages:ListFormWebPart runat="server" __MarkupType="xmlmarkup" WebPart="true" __WebPartId="{[Form GUID]}" ><Title>TITLE HERE</Title><ID>g_[Form GUID]</ID><ListName xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">{[LIST GUID]}</ListName><ControlMode xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">New</ControlMode><FormType xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">8</FormType></WebPartPages:ListFormWebPart>

5) Create a new GUID or copy a GUID from some other form in the site which is working fine and replace it in the code. [In above code it shows as Form GUID.
You have to give this value at two places. First for __WebPartId and second for the <ID>g_[Form GUID]</ID>

Note that this is not the GUID of the list. You can create this GUID from Visual studio or many online tools are available to create one.

6) Provide the GUID of the list in the tag >ListName xmlns=”http://schemas.microsoft.com/WebPart/v2/ListForm”&gt;{[LIST GUID]}</ListName>

7) Now you have to fill the Control Mode and Form type in the following tabs.

<ControlMode xmlns=”http://schemas.microsoft.com/WebPart/v2/ListForm”>%5BControlMode%5D</ControlMode><FormType xmlns=”http://schemas.microsoft.com/WebPart/v2/ListForm”&gt;{FormType]</FormType>

Control mode and Form type differs for each form.

NewForm.aspx : ControlMode = New, FormType = 8
EditForm.aspx : ControlMode = Edit, FormType = 6
DispForm.aspx : ControlMode = Display, FormType = 4

8) Save the page and view the page in the browser. The broken links should be fixed.

About these ads
Comments
  1. Anu says:

    Great post .Thanks a lot .

  2. tmp says:

    A very BIG thanks!!!

    You save my …..

    “you know ;)

  3. Denis says:

    Fantastic!! Worked like a charm. Saved us BIG TIME!

  4. For me it doesn´t work :(

  5. mmleaves says:

    Thanks so much. It save my work.

  6. Johan says:

    Many thanks! You’ve saved me a lot of time and effort – God blessed!..

  7. Nicklas says:

    Many thanks!

  8. Full says:

    a big big thanks from China! broken link restore now! You are god!

  9. ninjaglowskulls says:

    Thank you SOO much. After I read that I had to delete the list and recreate it (700+ items, 50+ different views) my world collapsed. You are a life saver.

  10. This solution didn’t work for us as we destroyed our dispform and lost all links from the list as described above but the above solution didn’t work. We followed this link (same process but much more detailed steps and controls) and it works .. automatically sharepoint restored the links on all list items for viewing (which were going to root site) and now everything works.

    Yours,
    Tarik

    http://www.iamwealthytoday.com

    http://support.microsoft.com/kb/2000861

  11. scarepoint says:

    THANKYOU! You also saved my a!@

    I did have an issue where a multi-select control wouldn’t populate properly afterwards.
    Using underscores instead of dashes in the guid for g_[Form GUID] part seemed to fix it.

  12. [...] 元に戻す方法を探していたら、以下のリンクを発見! Fixing broken links in SharePoint List Forms [...]

  13. radicalpuffdaddy says:

    This saved my a– as well. First article returned in google, gotta love it.

  14. Rahul says:

    HI,

    Many thanks for the post, it has saved lot of my time

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s