Skip to content

Instantly share code, notes, and snippets.

@max-mulawa
Created January 31, 2012 08:13
Show Gist options
  • Save max-mulawa/1709435 to your computer and use it in GitHub Desktop.
Save max-mulawa/1709435 to your computer and use it in GitHub Desktop.
SharePoint Code Review
SPSite site = SPContext.Current.Site;
SPSecurity.RunWithElevatedPrivileges(() =>
{
SPWeb web = site.OpenWeb();
//Task list contains 4000 elements
SPList taskList = web.Lists.TryGetList("Tasks");
if(taskList != null)
{
Label1.Text = "Task list has " + taskList.Items.Count.ToString();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment