ListName instead of ListID

This was the chal­lenge.

For a cus­tomer i was cre­at­ing a tem­plate site the need­ed a cus­tom editform.aspx. After edit­ing the cus­tom form.aspx it all worked fine. But after cre­at­ing a new site based upon the new­ly cre­at­ed tem­plate i dis­cov­ered that my cus­tom editform.aspx was not work­ing. The rea­son for this is that the web­part i used was con­nect­ed to a list using the Lis­tID (guid). This was of course point­ing to the list in anoth­er site.

The solu­tion is to use the List­Name instead of Lis­tID. To do this you need to edit the web­part code using Share­Point Design­er.

Open the site in Share­Point design­er. Select the web­part and click on “Split view” to reveal the code.
Now change every occur­rence of Lis­tID in List­Name. And replace the guid with the list­name. See the exam­ples in these screen­shots.

Before
After

In my case i had to replace six occur­rences of Lis­tID.

Save the site and cre­ate a new temm­plate and you’re all set!

Enjoy,
Pieter