How can I get default display form url of sharepoint list item via Rest or JSOM. I found the result by link: How to get the Display Form URL, using REST

But the XML returns all of the display form url, I don't know how to specify where is the default URL?

I need to get it dynamically!


You could also use

_api/Web/Lists/GetByTitle('List title')/DefaultDisplayFormUrl

If you want for all lists do


Note that the property is not visible when visiting List directly, need full path or $select.

  • Hi again, how can I get the results. I use data.d.results[0].DefaultDisplayFormUrl, but it doesn't work
    – tbbt
    Nov 17 '14 at 7:03
  • Try data.value. It could alter if you use SPO, on premise or through an app. What you can do is to call console.log(data) and you will see the object structure in say Chrome dev tools. Another option is to view it in Dev tools network tab. Yet another is to set break point and inspect data variable.
    – eirikb
    Nov 17 '14 at 7:10
  • Thanks guy, console.log(data) work perfect then I can inspect the object. Great!
    – tbbt
    Nov 17 '14 at 7:14

Use DefaultDisplayFormUrl at the time of loading the list in Javacript client object model. Example:

var clientContext = new SP.ClientContext.get_current();
var list = clientContext.get_web().get_lists().getByTitle(listTitle);
clientContext.load(list, 'DefaultDisplayFormUrl');

Then while enumerating the listitemcollection use get_defaultDisplayFormUrl() to create the Url. Example:

while (listItemEnumerator.moveNext()) {
    var listItem = listItemEnumerator.get_current();
    var listItemId = listItem.get_item('ID');
    var href = list.get_defaultDisplayFormUrl() + "?ID=" + listItemId;
  • i also used the same one but it gives mi url like href="/sites/appdev/Lists/Students" List dispform.aspx?id="14"></a> and my list name is "Students List" and this is my code var web = context.get_web(); //Get the Site ListName = "Students List"; ListName = ListName.trim(); var list = web.get_lists().getByTitle(ListName); var query = new SP.CamlQuery(); var items = list.getItems(query); ctx.load(list, "DefaultDisplayFormUrl"); ctx.load(items);
    – Madhav
    Sep 30 '16 at 5:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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