none
I would like to know how to use the list REST API GeyByTitle method when the list is in the following format <string>space/space<string>, for example: test / list RRS feed

  • Question

  • I would like to know how to use the list REST API GeyByTitle method when the list is in the following format <string>space/space<string>, for example: test / list

    The List URL is: https://mysite.sharepoint.com/sites/PSdevelopment/TEst%20Project%20for%20Data%20Store/Lists/Issues%20%20Risks/AllItems.aspx 

    Using the same encoded name as in the URL: https://mysite.sharepoint.com/sites/PSdevelopment/TEst%20Project%20for%20Data%20Store/_api/Web/Lists/GetByTitle('Issues%20%20Risks') - gives 404

    Using the list title: https://mysite.sharepoint.com/sites/PSdevelopment/TEst%20Project%20for%20Data%20Store/_api/Web/Lists/GetByTitle('Issues / Risks') - give error in application

    I tried  to use the %2F and gives also an aplication error:
    https://mysite.sharepoint.com/sites/PSdevelopment/TEst%20Project%20for%20Data%20Store/_api/Web/Lists/GetByTitle('Issues%202F%20Risks')

    I also tested changing the name to test/ list and the method works fine, it seems it doesn't like the 1st <space>

    Does any one have any idea?


    Friday, March 31, 2017 1:44 PM

All replies

  • Hi Pedro,

    For most of the list names, we can use the “getbytitle()” to query a list.

    However, in this case, seems that SharePoint converts the list name to some format which can’t be accessed via REST API.

    In such situation, I would suggest you use the GUID of it to query this list instead, like:

    /_api/web/lists(guid'e6324907-a0e5-4e29-bd49-7dc032e91892')/Items

    Best regards,

    Patrick 

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Monday, April 3, 2017 5:53 AM
    Moderator
  • Hi Patrick,

    We have the same issue. Do you see this as a bug or limitation? Is this something that requires fix from Microsoft or something we just have to accept? Is there any documented limits for the GetByTitle method such as this one here?

    Many thanks

    Paul


    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS | MVP | Downloads

    Tuesday, April 4, 2017 3:39 PM
  • From List Settings > List name, description and navigation : you can get the list title and it will work.

    Thanks, Amit Kumar, LinkedIn Profile ** My Blog

    Friday, April 7, 2017 7:34 AM
  • Hi Pedro

    I created a list with title "Issues  Risks". The URL is same as yours <siteURL>/Projects/EDRMS/Lists/Issues%20%20Risks/AllItems.aspx

    The GetByTitle works

    <siteURL>/_api/Web/Lists/getByTitle('Issues%20%20Risks')

    As Amit mentions , check List Settings > List name, description and navigation also for correct title as it might not match the list url after subsequent updates of the name. Also make sure the correct case of the title is used.


    • Edited by reshmee011 Friday, April 7, 2017 11:13 AM
    Friday, April 7, 2017 10:59 AM
  • Hi Pedro,

    It seems "/" is not allowed in the REST API call. So, you can change the title to get this worked or you can get it by guid.

    Thanks,

    Venkat Konjeti

    Saturday, April 8, 2017 5:45 AM
  • Hi Reshmee and Amit,

    The issue is the / in the list name - easily reproducible. For example, create a list called "Test / Test" and you will see the issue. Any list name with the format of <string><space>/<space><string> will have the issue. For a list with this title format, looking at the list settings page, copy and paste the web address provided under the List Information into the browser and you will get a 404.

    Paul


    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS | MVP | Downloads

    Monday, April 10, 2017 4:09 PM
  • Hi Paul,

    I will check this type of list name and get back to you.


    Thanks, Amit Kumar, LinkedIn Profile ** My Blog
    Please click "Mark As Answer" if this post solves your problem or "Vote As Helpful" if it was useful

    Tuesday, April 11, 2017 5:43 AM
  • The slash and space in the list name still works with getByTitle method on both SP online and on premises/

    https://reshmee.sharepoint.com/sites/test1/_api/Web/Lists/getByTitle('Issues/%20Risks')

    Tuesday, April 11, 2017 9:43 AM
  • your list is called "Issues/ Risks" try a list called "Issues / Risks" - notice the space after Issues but before the /.

    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS | MVP | Downloads

    Tuesday, April 11, 2017 9:45 AM
  • Interesting, I have tried with list name "Issues /Risks", I get the 404 error. Space after forward slash works , however space before the forward slash fails with 404.
    Tuesday, April 11, 2017 3:58 PM