Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 11th, 2013  |  syntax: None  |  size: 0.61 KB  |  views: 28  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. using (SPSite siteCol = new SPSite("http://mySharepoint/"))
  2. {
  3.     using (SPWeb web = siteCol.RootWeb)
  4.     {
  5.         SPList list = web.GetList("/Lists/PermissionMatrix");
  6.  
  7.         SPListItem item = list.GetItemByIdSelectedFields([*Requires ID*], "Role");
  8.  
  9.         String role1= (String)item["Roles"];
  10.     }
  11. }
  12.        
  13. var sampleQuery = new SPQuery();
  14. sampleQuery.Query = @"<Where>
  15.      <And>
  16.        <FieldRef Name='Status' />
  17.        <Value Type='Text'>Completed</Value>
  18.      </And>
  19.      <Gt>
  20.        <FieldRef Name='Id' />
  21.        <Value Type='Number'>20</Value>
  22.      </Gt>
  23.    </Where>";
  24. var foundItems = list.GetItems(sampleQuery);