If I pass in the name of a list is it possible to get the GUID id of that list and return it? I know you can get it on creation of the list, but I am assuming the list is already created.

Assuming i have the name test for a list can I pass test into a function that then returns me the Guid id of that list for use in other aspects?

  • What about using vba (Excel 2010)? Is it possible?
    – user21741
    Commented Jan 5, 2014 at 16:01

4 Answers 4


The name of the list is meaningless as there can be lists by the same name all over a site. You would need the Url to the list in order to be able to resolve it to a Guid. However, the mechanics of this vary wildly depending on what you mean by "programmatically". In PowerShell it would be something like this and the server object model would be similar.

    $site = [Microsoft.SharePoint.SPSite]($UrlTolist)
    $web = $site.OpenWeb()
    $list = $web.GetList($UrlToList)

Getting the ID via Web Services or the client object model would be completely different.


in the Server object model you can use.

SPList list = SPWeb.Lists.TryGetList("YOurListName");

then you would already have the SPList the you can get the guid by using the ID property of the SPList


Using Server Object Model

Guid listGuid = spweb.Lists["ListName"].ID;

If you have the List name I assume u must have the Url of the List as well and you could use it as below:

web.GetListFromUrl("your list url").ID;

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.