In lists or libraries SharePoint 2010 has lot of features added in terms of UI and functionality.

  • Request throttling
  • Referential Integrity
  • Unique columns
  • External lists

Request throttling

In big organizations this is highly possible that the list items in the list grow in huge amount. In that case, when user tries to access the site or list the site will be very slow as it is having huge data. To solve this problem list view threshold feature is added in SharePoint Foundation 2010. What it means is, how many maximum items in the list we have to retrieve from the database. Point to remember here is, if any query result [number of list items] on the list crosses this threshold count then the query will be blocked or cancelled as it effects the complete site. If you want to know more about how to handle huge folders and files please check it here.

To set request throttling for a site, go to Central Administration –> Application Management –> Manage Web Applications –> select site –> General settings menu –> select Resource Throttling.

image

Development side,

  • SPWebApplication has a property to set the request throttling value. MaxItemsPerThrottledOperation – which tells what is the maximum number of items that can be effect by query or bulk updates.
  • SPList has a property EnableThrottling to enable/disable the throttling on a list.
  • SPQuery and SPSiteDataQuery have a property called RequestThrottleOverride.
  • SPFieldIndex class represents the compound index on one or two fields in a list for easy filter or maintain data.

Referential Integrity for list items with lookup fields:

In earlier versions of SharePoint, there is a possibility that the loosely coupled or loosely defined relationship between two lists through look up fields. So, what if I have a requirement where if I delete the Parent list items then it should delete all child list items as well? We have to write custom code for this clean up. But, with this new feature it is a built-in option. While we are creating a new field in the child list and that is look up field you can set the referential integrity on child items by specifying the delete behavior [from UI]. Along with that you can specify what are the additional column I pull from parent list and show it on the child list as shown below.

image

Set Referential Integrity

image

Development side,

  • SPRelatedField class which represents the relationship between fields in two lists.
  • For SPList class there is a new method added called GetRelatedFields() which gives you the list of related field objects.
  • For telling the delete behavior there is enum SPRelationshipDeleteBehavior.
    • Cascade Delete: deleting a parent list item also deletes all related child list items in a single transaction.
    • Restrict Delete: Gives an error message before delete a parent list item.
    • None: Safer and default option.
  • SPFieldLookup has a new property RelationshipDeleteBehavior to represent the delete behavior of the lookup field.

Unique columns:

Wow, what a feature. In earlier versions to achieve this we had written custom code. Now, all is integrated. Cool. We can enable primary key functionality in SharePoint list or library from UI. To enable this we have a feature available called “Unique column constraint”. They key point to remember here is we cannot apply the constraint on all columns. To know what columns are allowed and not read this Enforcing Uniqueness in Column Values.

image

Development side,

  • SPField has a new property called EnforceUniqueValues. It is of type Boolean, so you can get or set depends on requirement. Default value is allow duplicates.

 

Similar Topics:

Tags:

sharepoint 2010 list slowsplist enablethrottling