We have some users we have given access to override check-in on document libraries within SharePoint online, but don't want them to be able to change the configuration of the libraries. Because of this they cannot access the library settings menu, as that requires "Manage Lists" to be included in their permissions, but they can access and use the "Manage files which have no checked in version" if sent a direct link to it.

What I'd like is a simple piece of Javascript I could put into a webpart on a single site for these users, that would:

  1. Let them enter the URL of a document library in their site collection(s) in a field
  2. Get the ListID of that library
  3. Generate a link to (<'SPOL_SITE_URL'>/_layouts/15/ManageCheckedOutFiles.aspx?List=<'LISTID'>), where SPOL Site URL is extracted from the List url in 1.
  4. Attach the link from 4 to a button captioned "Manage Files Never Checked In" if the ID is known, not how to find the id of the list based on a url.

If you can make 2 a function that takes the URL as a parameter, and returns the ListID that would be great as I can then reuse it in other code. So far all my searches I've tried have returned the opposite of getting List URLs when the ID is know, or getting items in the list based on their ID.

Thanks in advance

2 Answers 2


You can make a simple REST api call to get GUID of the libarary. All you have to do is extract library name from the URL given by user in Step 1 and pass it to the REST call as shown below:


If you would like use REST api then I'll advise you to go with Sagar's solution.

Here are few alternative also,

  1. Using Jquery services. (Ref from Atish)

    ExecuteOrDelayUntilScriptLoaded(getListId, "sp.js");
    var list;
    function getListId() {
    var context = new SP.ClientContext.get_current();
    var web = context.get_web();
    list = web.get_lists().getByTitle('Name of the List');
    context.load(list, 'Id');
    context.executeQueryAsync(Function.createDelegate(this, success), 
    Function.createDelegate(this, error));
    function success() {
    listId = list.get_id();
    function error(sender, args) {
    alert('Request failed. ' + args.get_message() + 
        '\n' + args.get_stackTrace());
  2. Use _spPageContextInfo.listId, if you are adding script on List page webpart.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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