Microsoft SharePoint and .NET Technology Insight

SharePoint, .NET, Office365, Windows Azure, TFS, Project Server and SQL Server Technology Insights

Leave a comment

SharePoint 2013 What’s New

SharePoint Foundation 2013 Preview

SharePoint Server 2013 Preview

SharePoint Preview Site

SharePoint 2013 Requirements

SharePoint Designer 2013

SharePoint Server 2013 SDK

Office Web Apps Preview


Leave a comment

WCF MaxItemsInObjectGraph quota

The following errors often show up when trying to return a large number of items in a generic List<T> from a WCF service:

WCF System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly

Maximum number of items that can be serialized or deserialized in an object graph is ‘65536’. Change the object graph or increase the MaxItemsInObjectGraph quota.

The  resolution for this issue is ensuring following behaviour for the dataContractSerializer in both the client and service configuration files..

<dataContractSerializer maxItemsInObjectGraph=”2147483646″/>

Use the MaxItemsInObjectGraph property set a limit on the number of items in an object graph that are serialized. You can also set this property using the <dataContractSerializer> element in an application configuration file.

The following provides an example of settings in the service layer and client layer:

Settings in the service layer:

<behavior name=”DefaultBehavior” MaxItemsInObjectGraph=”2147483647″>
<dataContractSerializer maxItemsInObjectGraph=”2147483647″ />
<serviceMetadata httpGetEnabled=”true” />
<serviceDebug includeExceptionDetailInFaults=”true” />
<service behaviorConfiguration=”DefaultBehavior” name=”MyService”>
<endpoint address=”” binding=”wsHttpBinding” bindingConfiguration=”WSHttpBinding_MyService” contract=”IMyService”>
<dns value=”localhost” />
<endpoint address=”mex” binding=”mexHttpBinding” contract=”IMetadataExchange” />

Settings in the client layer:

<behavior name=”ClientBehavior”>
<dataContractSerializer maxItemsInObjectGraph=”2147483647″/>

<endpoint address=http://localhost/MyService.svc
binding=”wsHttpBinding” bindingConfiguration=”WSHttpBinding_MyServiceConfiguration”
contract=”ServiceReferences.IMyService” name=”WSHttpBinding_MyService”
<dns value=”localhost” />

See the article below for additional information on the ServiceBehaviorAttribute.MaxItemsInObjectGraph Property:

See the article below for additional information on extending WCF wit Custom Behaviors:

1 Comment

SharePoint 2010 Storage Planning and Performance

SharePoint is unique in that it serves a broad range of use cases. This single platform can function as a relatively static content management system with modest storage requirements, a collaboration system with significant storage requirements, or even a large-scale document repository with extreme storage requirements, all in the same farm implementation! It only takes one of these functional requirements to get the SharePoint movement started in an organization. Problems can arise, however, when storage requirements are not properly planned for and the business begins to expand the original purpose of the SharePoint implementation. Storage performance is particularly important in the SharePoint ECM solution due to document archive requirements. It is often necessary to store documents for seven years or more. This can be a challenge for organizations that have high document volumes resulting from business processes with partners, vendors, and customers.

A good rule of thumb for large content repositories that have a high request per second (RPS) requirement of several hundred or more is to have 2 IOs per second (IOPS) per GB of content. For example, if the content database size is around 1.5 TB, the IOPS requirement would be approximately 3,072. If the content storage requirement were lower or the RPS requirement is lower, then the rule of thumb or “starting point” IOPS guidance could be adjusted downward.

Sample scenario:

  • Consider a scenario with around 1.5 TB of SharePoint 2010 content that have an RPS of around 2500 to 2800 which needs to be managed on a shared SAN:


  1. If the content is managed on five 15,000 RPM SAS drives, each 600GB in size, to build a 2.4TB RAID 5 disk array in the shared storage area network (SAN), the drives would provide between 700 and 1,000 IOPS depending on the caching capabilities of the SAN. The content storage requirements are adequately provided by this configuration but performance is impacted due to the low IOPS.


  1. If the content is managed on sixteen 15,000 RPM SAS drives that are 146GB in size, the infrastructure team can build two, eight-drive RAID 5 arrays and divide the content databases between them. This would theoretically yield two 1TB arrays with something like 2,500 to 2,800 combined IOPS capability providing adequate performance for the SharePoint environment.


The above solution recommendation of having the additional disks is significantly more expensive than using fewer, larger disks, but it will be more expensive in the long run if end users are waiting for content retrieval or, worse, they tire of waiting and stop using the system entirely. The significant architecture point to remember here is that given the same size disk array, the array with more disks of a smaller size will significantly outperform an array with fewer disks of a larger size. However, another key consideration is the use of Shared SAN or Direct Attached Storage as outlined below.

The SharePoint 2010 platform disk requirements go far beyond the content database to include application service databases like those used by the Enterprise Search service applications, which require extensive IOPS support. Shared SAN storage is often difficult to properly allocate because each of the systems that use the shared storage often have peak usage times that coincide. A Shared SAN can impact SharePoint performance as the SAN solution may be set up with a large storage base consisting of numerous disks intended for use as shared storage for several products including Microsoft Exchange, Microsoft SharePoint, other Microsoft SQL Servers and file shares impacting the overall IOPS. The allure of the SAN is cost, which can be shared across cost centers. It is typically easier to justify the purchase of a single large SAN that would service multiple departments than it is to justify a quality DAS system that serves only SharePoint.


Direct-attached storage (DAS) is any storage that is directly attached to the server, typically by SCSI connection or Fibre Channel. The biggest benefit of DAS is the guarantee of unshared storage and direct control over configuration of the disk array. This usually results in a much more predictable performance pattern in terms of supplying SharePoint with all the IOPS it needs to efficiently serve users. While DAS vs. SAN pros and cons can always be debated, in most cases DAS is the preferred storage technology for SharePoint — regardless of whether it is installed on physical servers or in a virtual machine environment.

See links below for additional information on SharePoint 2010 Storage architecture:

Requests Per Second Required for SharePoint Products and Technologies:

Storage and SQL Server capacity planning and configuration

Leave a comment

Programmatically adding images on SharePoint WebPart Pages

There are multiple ways you can add images programmatically on the SharePoint web part pages from the code. This article will provide you couple of code snippets to add images using Image Web Part and Content Editor Web Part. One of the benefits of adding images using web parts are end-users can specify different images.

Image Web Part
If you want to add non-clickable image as a place holder on the web part pages, use “ImageWebPart” to add image programmatically using following code snippet.

Content Editor Web Part with Hyperlink HTML
If you want to add clickable image on the web part pages, unfortunately “ImageWebPart” wouldn’t work. As a workaround, you can add “ContentEditorWebPart” programmatically and add hyperlink HTML as shown in following code snippet.

Leave a comment

SharePoint 2010 Events Framework

The SharePoint Event Receiver Framework has been one of the most widely used features by SharePoint Developers providing the ability to add custom functionality to SharePoint Web Applications. The list of available events is significantly increased in SharePoint 2010. There are new events to capture operations of the workflow engine, of the provisioning and of the enabled incoming mail list.

All event receivers provides two events Before and After.

Before events ( Synchronous) are triggered just after the event occurred, but before SharePoint writes any data to the SharePoint content database. These events are useful for custom validation, rules checking, and cancelation of users’ actions. Before events run in the same process and thread as the current action.

Example: ItemAdding Occurs before an item is going to be added to a list.

After events (Asynchronous) are triggered after SharePoint commits the data to the SharePoint content database After events by default run in a background thread; however, you can force them to run synchronously.

Example: ItemAdded Occurs after an item has been added to a list.

Event Receiver Base Classes:


All of these receiver base classes (except for SPEmailEventReceiver and SPFeatureReceiver) inherit from a common base class named SPEventReceiverBase,

Here are the events available within SharePoint 2010.

List events (SPListEventReceiver class)

With regard to operations on list instances of lists, 4 new custom events were added useful to carry out operations against an addition or a deletion of a new listing.

– FieldAdded – A field was added
– FieldAdding – A field is being added
– FieldDeleted – A field was removed
– FieldDeleting – A field is being removed
– FieldUpdated – A field was updated
– FieldUpdating – A field is being updated
– ListAdding – A list is being added
– ListDeleting – A list is being deleted
– ListAdded – A list was added
– ListDeleted – A list was deleted

List item events (SPItemEventReceiver class)

However, with regard to operations on individual elements, the SharePoint team added a single event on the reaction from the single element to a call from the context. Simply, this event is triggered when invoked within the class SPContext occurrences ever for the item.

– ItemAdding – An item is being added
– ItemUpdating – An item is being updated
– ItemDeleting – An item is being deleted
– ItemCheckingIn – An item is being checked in
– ItemCheckingOur – An item is being checked out
– ItemUncheckingOut –  An item is being unchecked out
– ItemAttachmentAdding – An attachment is being added to the item
– ItemAttachmentDeleting – An attachment is being removed from the item
– ItemFileMoving – A file is being moved
– ItemAdded – An item was added
– ItemUpdated – An item was updated
– ItemDeleted – An item was deleted
– ItemCheckedIn – An item was checked in
– ItemCheckedOut – An item was checked out
– ItemUncheckedOut – An item was unchecked out
– ItemAttachmentAdded – An attachment was added to the item
– ItemAttachmentDeleted – An attachment was removed from the item
– ItemFileMoved – A file was moved
– ItemFileConverted – A file was converted
– ContextEvent – The list received a context event

List e-mail events (SPEmailEventReceiver class)

A specific event for handling behavior around lists configured to receive e-mails. In SharePoint 2007, it was necessary to handle ItemAdding or ItemAdded events, then parse the mail and manually check the attachments.

– EmailReceived – The list received an e-mail message

Workflow events (SPWorkflowEventReceiver class)

Events to manage the start and the end operations of one or more workflow.

– WorkflowStarting – A workflow is starting
– WorkflowSterted – A workflow was started
– WorkflowPostponed – A workflow was postponed
– WorkflowCompleted – A workflow was completed

Web events (SPWebEventReceiver class)

On the other hand, regarding sites and site collection, two events have been added (the respective synchronous and asynchronous) to launch custom actions against the provision of a new SharePoint 2010 site.

– SiteDeleting – A site collection is being deleted
– WebDeleting – A site is being deleted
– WebMoving – A site is being moved
– WebProvisioning – A site is being provisioned
– SiteDeleted A site collection was deleted
– WebDeleted – A site was deleted
– WebMoved – A site was moved
– WebProvisioned – A site was provisioned