I'm extremly new with Sharepoint 2010. In my masterpage, I display a list of news. I'd like to create a permanant "Add news" at the bottom of the list (programmatically) but I can't find the ListId. I've seen on the web I have to use {ListId} token, but I can only do this in XSLT files.

Here is a piece of my masterpage's code :

<a class="ms-addnew" id="idHomePageNewAnnouncement" href="http://thisWebsite/_layouts/listform.aspx?PageType=8&amp;ListId={ListId}&amp;RootFolder=" onclick="javascript:NewItem2(event, &quot;http://thisWebsite/_layouts/listform.aspx?PageType=8&amp;ListId={ListId}&amp;RootFolder=&quot;);javascript:return false;" target="_self">Add news</a>

I tried to replace ListId by ListID, List, $List etc... the generated link is always the same :


Obviously, it didn't work because {ListId} is not replaced by its value...

Can somebody tell me where I'm wrong ? Thanks in advance :-)

1 Answer 1


You can build a URL using the name of the list for your Add News link like so:

  • Richard, I tried your solution, but I'm facing with this issue : When I click on "List", then "News" (the name of my list), an "Add news" is generated by Sharepoint, and it works. I looked at the GUID and try to write it directly in my code using List={GUID}. But when I re-deploy my website, my "Add news" still doesn't work inspite of the "good" GUID. When I re-reclic on "List", then "News"... The GUID of the "Add news" generated by Sharepoint has changed !! The only working link is the one generated by SP, and it changes each time I deploy ! I don't really understand why ... ?
    – AlexB
    Apr 3, 2013 at 16:00
  • How have you created the web site? Is it in visual studio or did you create a template through the UI?
    – Richard
    Apr 3, 2013 at 16:03
  • I created it with VS 2010.
    – AlexB
    Apr 4, 2013 at 6:56
  • Every time you deploy your solution, a new GUID will be generated for your list, unless you add a List Instance to the project. You can also create a url using the name of the list. I have modified the answer to reflect that.
    – Richard
    Apr 4, 2013 at 14:10
  • Your modified answer perfectly works ! It was so easy... Thank you very much RIchard !!
    – AlexB
    Apr 4, 2013 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.