I want to extract the "lastModifiedDateTime" from a list. I don't want to search the list by ID, but rather from its name. I know you can do it by MS graph, but the examples needs site ID as well as List ID. I want it in this similar form (tested in MS Graph explorer):

const SiteUrl = this.context.current.Web.Url;


Does not work. Notice I want to use the current URL and hardcoded path (since all list have the same ending/name in the URL from provisioning, but the ID is different).

Is there any way I can use MS Graph to get the lastModifiedDateTime by site and list NAME and not ID? Or with Rest.


You could use SP API _api/web/Lists/GetByTitle('listName') endpoint which returns list informations and deal with LastItemDeletedDate and LastItemModifiedDate. Here's a working code:

var requestUri = _spPageContextInfo.webAbsoluteUrl + '/_api/web/Lists/GetByTitle(\'stuff\')';
xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
    if (this.readyState == XMLHttpRequest.DONE) {
        if(this.status == 200) {
            res = JSON.parse(this.responseText);
        else {
            console.log('Err. Could not return data.');

xhr.open('GET', requestUri, true);
xhr.setRequestHeader('accept', 'application/json;odata=verbose');

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.