title: "The property or field 'Id' has not been initialized. It has not been requested..." when trying to access GUID of Library in SharePoint via JavaScript
body: <p>I am trying to access the ID of Library using client-side object model in SharePoint 2013. But I am getting error as:</p>
  
  <blockquote>
    <p>The property or field 'Id' has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.</p>
  </blockquote>
  
  <p>Below is my code:</p>
  
  <pre><code>var context = SP.ClientContext.get_current();
  var web = context.get_web();
  var items = SP.ListOperation.Selection.getSelectedItems(context);
  var currentLibrary = web.get_lists().getById(SP.ListOperation.Selection.getSelectedList(context));
  context.load(currentLibrary, 'id'); // Tried with 'Id' but still throws error
  console.log(currentLibrary);
  console.log("currentLibrary.get_id = " + currentLibrary.get_id()); // THROWS ERROR!
  </code></pre>
  
  <p>What am I doing wrong here?</p>