How to get the Display Form URL, using REST API in Office 365

Hello SharePointers,

In this blog, we will see how to get the Display Form URL, using REST API in SharePoint online/Office 365.

function getListItemFormUrl(webUrl, listName,listItemId, formTypeId,complete, failure) {
$.ajax({
url: webUrl + “/_api/web/lists/GetByTitle(‘” + listName + “‘)/Forms?$select=ServerRelativeUrl&$filter=FormType eq ” + formTypeId,
method: “GET”,
headers: { “Accept”: “application/json; odata=verbose” },
success: function (data) {
var url = data.d.results[0].ServerRelativeUrl + ‘?ID=’ + listItemId
complete(url);
},
error: function (data) {
failure(data);
}
});
}

Happy SharePointing 🙂

Leave a Reply

Your email address will not be published.