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.

The real limit of 5000 items is related to SQL server. I’m not a SQL server expert but let me try to explain as a non-SQL server expert – “If a SQL query returns more than 5000 items, SQL server locks the entire table – which will affect other queries on the table”.

So as a SharePoint expert you might need to be in a situation where you need to work with large list (having more than 5000 items). However, there’s few options you have when you need to access large list. I’ll explain different options with pros and cons.

Option 1: Access less than 5000 items Iteratively
With this approach,  you loop through and access less than 5000 items on each iteration (say, 2000 items per iteration). The following block shows the idea:
The above approach is a good option for querying items through SPQuery. However, for list view, you need to modify your views to make sure the view doesn’t return more than 500 items.
Points to note:

  • You need to modify your existing views so that they don’t return more than 5000 items.
  • Once you modify your list views (as well as change the code to access less than 5000 items), the queries/views will have less affect on other live users.
  • However, you need to modify your existing code (or new code) to use the pattern to access not more than 5000 items.
  • Also for each loop, you will send a SQL query that will return the items.

Option 2: Use ContentIterator

SharePoint Server provides an API to access individual items using ‘ContentIterator’. ContentIterator is kind of complete API for processing large list items.
Points to note:

  • The API has full capabilities of handling different scenarios
  • And the API is available in Office Server version not in Foundation

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.

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.

The script is used to delete was:

And to add it was:

 

In a publishing environment we often create custom page layouts based on our own content types, and of course if we are also creating custom site definitions, we’ll probably want to create pages in the site defs which are based on our custom page laouts – how do we do this?

Again, it’s all done using a CAML module element as shown below

The Property elements are used to set the column values of the new list item which is created in the Pages library for this page.

  1. Title – The page title, this is what is usually displayed at the top of the browser window
  2. ContentType – the listitems contentype (name), which should be the content type used as the basis of the page layout
  3. PublishingPageLayout – this is the important one, this tells SharePoint what page layout to associate with the list item (page), it has a very specific format and a gotcha (see below)
  4. PublishingPageImage, PublishingPageContent etc – you can populate any other columns here.

The PublishingPageLayout property format is;

The gotcha is in the use of the comma (,); either don’t use it and just specify the url of the page layout, or, if you do use it make sure you leave a space character after the comma.

The title value specified after the comma is displayed in the “Page Layout” column in the Pages library.

If you designed a custom master page for your SharePoint 2016 and the ribbon is in your way, SharePoint has a built-in control that lets you hide it from  anonymous users  in few easy steps. Open and check-out your master page, find where your ribbon control starts or look for

wrap your publishing ribbon control in SPSecurityTrimmedControl

Don’t forget to set the correct permissions in the Permissions attribute. Here are few of the choices SPSecurityTrimmedControl allows:

 List Permissions  Site Permissions  Personal Permissions
 ManageLists  ManagePermissions  ManagePersonalViews
 CancelCheckout  ViewUsageData  AddDelPrivateWebParts
 AddListItems  ManageSubwebs  UpdatePersonalWebParts
 EditListItems  ManageWeb  
 DeleteListItems  AddAndCustomizePages  
 ViewListItems  ApplyThemeAndBorder  
 ApproveItems  ApplyStyleSheets  
 OpenItems  CreateGroups  
 ViewVersions BrowseDirectories  
DeleteVersions CreateSSCSite  
CreateAlerts ViewPages  
ViewFormPages EnumeratePermissions  
  BrowseUserInfo  
  ManageAlerts  
  UseRemoteAPIs  
  UseClientIntegration  
  Open  
  EditMyUserInfo  
Close