SharePoint list throttling limits to access maximum 5000 items through view/query. However your list can hold as much as 30,000,000 items but you can’t access more than 5000 items at once by view or query. But I’ve seen scenarios where list items goes millions in a year. So accessing large list having more than 5000 items not very rare in real life.
After deploying several event receivers to a variety of lists I found that one of the event receivers did not seem to be working, but instead was firing a old version of the DLL.
So, to check that it was indeed attached, I ran the following PowerShell command.
$spWeb = Get-SPWeb –Identity <SharePointWebUrl>
$spList = $spWeb.Lists["List Display Name"]
$spList.EventReceivers | Select Name, Assembly, Type
After running this I discovered that one of the event receivers had been attached to the list twice! I’m not entirely sure why or how this happened, but my problem was resolved by deleting the duplicate receivers and reattaching it once.
Retrieve List Items using Portal SiteMap Provider
The Class includes a method called GetCachedListItemsByQuery that retrieves data from a list based on an SPQuery object that is provided as a parameter to the method call.
The method then looks in its cache to see if the items already exist. If they do, the method returns the cached results, and if not, it queries the list , store the results in cache and returns them from the method call.
/Get Current Web
SPWeb curWeb = SPControl. GetContextWeb(HttpContext.Current);
//Create the Query
SPQuery curQry = new SPQuery();
curQry.Query = "<Where><Eq><FieldRef Name=\'Category\'/><Value Type=\'Text\'> Sharepoint </Value></Eq></Where>" ;
//Get Portal Map Provider
Portal SiteMapProvider ps = PortalSiteMapProvider.WebSiteMapProvider;
PortalWebSiteMapNode pNode = TryCast (ps.FindSiteMapNode (curWeb. ServerRelativeUrl), PortalWebSiteMapNode);
//Get the items
Pltems = ps.GetCachedListItemsByQuery (pNode, "Dept", curQry, curWeb);
//Enumerate all resulting Items
foreach(PortalListItemSiteMapNode curItem in pItems)
string ResultItemTitle = curItem["Title"]. ToString();
Retrieve SharePoint lookup field
In this post we will discuss how to set or retrieve SharePoint lookup field value in List using SharePoint object model
Here we have a SharePoint list name as Users and Country. Users List has a lookup column name as CountryName and is mapped to the Country List.