title: How to get a single listitem field value?
body: <p>I have a SharePoint list with Roles as the columns(Admin, Viewer, Manager) and Document Types as the items (Word docs, PPtx docs, excel docs). I have filled in the corresponding values with the permissions each Role has per Doc Type. </p>
  
  <p>I have built a web part with 2 dropdowns. Dropdown1 has Roles and Dropdown2 has Doc Types.</p>
  
  <p>How can I use the selected value for each dropdown and query the corresponding value from the list?</p>
  
  <p>Do I use CAML or can I use SharePoint object model?</p>
  
  <pre><code>using (SPSite siteCol = new SPSite("http://mySharepoint/"))
  {
      using (SPWeb web = siteCol.RootWeb)
      {
          SPList list = web.GetList("/Lists/PermissionMatrix");
  
          SPListItem item = list.GetItemByIdSelectedFields([*Requires ID*], "Role");
  
          String role1= (String)item["Roles"];
      }
  }
  </code></pre>
  
  <p>Doesn't work because I have to use the Item ID and I could only query the item using CAML</p>
  
  <p>Please help. Thanks</p>