1
votes

I'm using the SharePoint 2013 REST API to get and create list items, however the end users of my solution probably won't know how to find the list id, just the URL for one of its views, like http://spsportal/Lists/MyCalendar/calendar.aspx.

Is it possible to find the list ID using this URL?

2
DO you want to extract list name from the specified URL OR you want to get GUID of the specified list ? - Rohit Waghela
I need to extract the GUID (list ID). - Juliano Nunes Silva Oliveira

2 Answers

5
votes

I can see at least two options:

  • GetByTitle REST method : The "MyCalendar" part of the url is the "simplified version" of the Title (meaning, if you had special characters, they'd be encoded).
    With a bit of Regex you should be able to extract the list name from the URL.
  • GetList /_api/web/GetList('/Lists/MyCalendar') The parameter has to be the server relative Url without the form information.

Just that you know, most of the methods available in SSOM are exposed on the REST API.

0
votes

I can see at least three options:

  • GetByTitle REST method : The "MyCalendar" part of the url is the "simplified version" of the Title (meaning, if you had special characters, they'd be encoded). With a bit of Regex you should be able to extract the list name from the URL.
  • GetList /_api/web/GetList('/Lists/MyCalendar') The parameter has to be the server relative Url without the form information.
  • getbyGUID : like this /_api/web/lists('%7B326038AE-D47E-454D-AAD4-5440E6133EF2%7D')