SP Insider - A SharePoint Blog

SharePoint Limits

These are some limits found in the 2007 version of SharePoint, specifically Windows SharePoint Services 3.0.


Site object
Guidelines for acceptable performance
Scope of impact when performance degrades

Site collection
50,000 per content database
Total farm throughput degrades as the number of site collections increases.

Site collection
150,000 per Web application
This limit is theoretical, and is dependent largely upon:

Performance of the database server on which the configuration database resides.
Performance of the Web servers in the farm.
Network bandwidth between the Web servers and the database server.

This is not a hard limit, and assumes a single database server. Your environment may not be able to host this many site collections per Web application. Distributing content databases across additional database servers can increase the effective limit of the number of site collections per Web application. You should perform testing to determine the actual effective limit in your environment.

Web site

SharePoint AuditData table is too large- Powershell script to schedule STSADM -o TrimAuditLog

If you have turned on Audit logging in SharePoint 2007, you will wake up some day with a nasty surprise of a bloated SQL server database.  The data is all being stored in the AuditData table in the content database.

Luckily, there is an STSADM command for this, “stsadm -o trimauditlog”
After some research, the general consensus is to not truncate the table directly, although no specific reason is ever given except “Not Supported.”

As I always prefer to use a standard API, I found that you must do this command in very small chunks or else you could lock up your SQL server and effectively crash your SharePoint installation (found out the hard way).

I found 800,000 records to take approximately 15 minutes on a 2 Web Front end 1 Index Server, SQL Cluster type SharePoint farm.  To be safe, I wrote a PowerShell script to take care of these bite [...]

Pull users and groups from a SP list that allows multiple users and groups.

This is a follow up post from a previous post :


When examining a User field on a SharePoint list, you need to see whether the list setting allows for multiple users as well as both Users and Groups.

The key to pulling both the groups and the users is to be able to test for a group as opposed to a user object.  In this case, I found that the fieldUser.User object is null for groups, but not for Users.  So, as you iterate through the fieldUser objects in the SPFieldUserValueCollection, you’ll find a group when the fieldUser is not null, but the fieldUser.User object is null.  That way, you know you have a SPGroup at that point, and can loop through the users in the group.

After that, you do the normal adding of each fieldUser.User.Email

I [...]

SharePoint Error in Visual Studio Debugging a workflow: Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))

Leave it to Microsoft to break every SharePoint Dev server in the world in one fell swoop.

When you go to debug a workflow from Visual Studio 2008, it builds fine, but on deploy, it fails while trying to attach to the list with this error:

Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))

Causing the Error: Security patch KB2493987

If you have automatic updates set on your dev servers (which many people do), you will automatically get this security patch.  And, it will break all your custom visual studio debugging abilities on all dev servers.

Solution: = Running the SharePoint Products and Technologies Configuration Wizard and doing an IISRESET.

For a full explanation, see this helpful post: http://deinfotech.blogspot.com/2011/09/sharepoint-2007errors-creating-site-and.html

How to find which version of SharePoint 2010 is installed


Go to the registry key:



   SHARED TOOLS-Web Server Extensions – 14.0

           WSS-Installed Products

Then, match the key that is installed in the list below.
“BEED1F75-C398-4447-AEF1-E66E1F0DF91E”, “SharePoint Foundation 2010”
“1328E89E-7EC8-4F7E-809E-7E945796E511”, “Search Server Express 2010”

“B2C0B444-3914-4ACB-A0B8-7CF50A8F7AA0”, “SharePoint Server 2010 Standard Trial”
“3FDFBCC8-B3E4-4482-91FA-122C6432805C”, “SharePoint Server 2010 Standard”

“88BED06D-8C6B-4E62-AB01-546D6005FE97”, “SharePoint Server 2010 Enterprise Trial”
“D5595F62-449B-4061-B0B2-0CBAD410BB51”, “SharePoint Server 2010 Enterprise”

“BC4C1C97-9013-4033-A0DD-9DC9E6D6C887”, “Search Server 2010 Trial”
“08460AA2-A176-442C-BDCA-26928704D80B”, “Search Server 2010”
“84902853-59F6-4B20-BC7C-DE4F419FEFAD”, “Project Server 2010 Trial”
“ED21638F-97FF-4A65-AD9B-6889B93065E2”, “Project Server 2010”
“926E4E17-087B-47D1-8BD7-91A394BC6196”, “Office Web Companions 2010”

By |October 18th, 2011|Uncategorized|0 Comments|

How to add directly to the Workflow History from a custom SharePoint workflow

This one was a little hard to track down. How do you write directly to the SharePoint workflow history? It’s easy enough to add a LogToHistory activity and set the HistoryDescription and HistoryOutcome, but what if you want to create those entries dynamically?

After toying around with different ways of trying this, the answer was pretty easy:

Here’s the code sample:

SPMember usermember = workflowProperties.OriginatorUser;

By |September 12th, 2011|Sharepoint on Premise|7 Comments|

How to pull the email addresses from a SharePoint User field (allow multiple users)

To pull the user information, you first have to convert the field into a SPFieldUser object, and then create a collection of the SPFieldUserValueCollection.

Then, loop through the collection and pull the Email property of the SPFieldUserValue.

code sample:
string sFieldNameTo = “BU Legal To Email”;
string sFieldNameCC = “BU Legal CC Email”;

//Add To and CC based on multiple user field
if (workflowProperties.Item[sFieldNameTo] != null)
SPFieldUser UsersColumn = (SPFieldUser)workflowProperties.Item.Fields.GetField(sFieldNameTo);
SPFieldUserValueCollection Users = (SPFieldUserValueCollection)UsersColumn.GetFieldValue(workflowProperties.Item[sFieldNameTo].ToString());

foreach (SPFieldUserValue fieldUser in Users)
if (fieldUser.User.Email != null && fieldUser.User.Email != string.Empty)


if (workflowProperties.Item[sFieldNameCC] != null)
SPFieldUser UsersColumn = (SPFieldUser)workflowProperties.Item.Fields.GetField(sFieldNameCC);
SPFieldUserValueCollection Users = (SPFieldUserValueCollection)UsersColumn.GetFieldValue(workflowProperties.Item[sFieldNameCC].ToString());

foreach (SPFieldUserValue fieldUser in Users)
if (fieldUser.User.Email != null && fieldUser.User.Email != string.Empty)



Updated 5/11/16

For CSOM use this:

foreach (FieldUserValue userValue in item[“MultiUser”]as FieldUserValue[])




By |September 12th, 2011|Sharepoint on Premise|1 Comment|

Adding MyLinks Programattically in C#

Had a recent issue after migrating our users from one domain to another.  Their MyLinks did not come over after running stsadm migrateuser.  Found the links in the database and wrote a quick winforms app to move them over.  Permissions need to be allowed in Central Admin, Shared Services,  personalization services as well as site col admin on SSP.

Here’s how to populate them:

Extract the MyLinks information from the database
Create a Winforms App
Add a web reference to the webservice
Concatenate the extracted data into a comma separated list in excel
Run the app

1.  In SQL, join the UserLinks table in the SSP database with the UserProfile_Full table to get a list of links:

SELECT     UP.NTName, UP.PreferredName, UP.Email, UL.Id, UL.RecordId, UL.Title, UL.GroupType, UL.GroupTitle, UL.Url, UL.ContentClass, UL.PolicyId, UL.ItemSecurity
FROM         UserLinks AS UL INNER JOIN
                      UserProfile_Full AS UP ON UL.RecordId = UP.RecordID



Sharepoint Site 

Querying Sharepoint List Item Versions using SQL

The request was simple enough, get the total number of days for a status change from one custom list field to another custom list field  in a Sharepoint List Item. There’s a few ways to do this. Assume you have a Sharepoint workflow that changes a list item through various statuses and various fields. A simple way is to create a Date Changed field for each field that you want to track, then to populate it in your workflow as it goes along.

If you don’t have date fields set up in your list, you can take advantage of the version history if version history is turned on. The key here is to loop through your list items, know which field is the field you want, and then take the first version where the value has changed to the desired value. For example, if you are waiting for a “Status” [...]

Creating a new version of a custom Sharepoint workflow

This is more for my benefit as a reminder of steps, but if you use Makecab.exe for your .wsp packages, it is important to install new versions that don’t step on old versions.  I keep old versions set to “No New Instance” and then New versions pick up the new version of the workflow.

New Version of Sharepoint workflow using a .wsp Package
Solution – add Solution folder “Deploy”
Add Manifest.xml (xml)
Add Solution.ddf (text)
1. Manifest.xml – change SolutionID using New Guid
2. Manifest.xml-change Destination Location folder to include version number.
3. Change Assembly version to next version, Properties, Application, Assembly Information
4. Solution.ddf – change CabinetNameTemplate
5. Solution.ddf – increment version on Feature Folder name (2nd name, leave first folder same since this is the source folder).
6. Feature.xml, change feature ID to new GUID.
7. Feature.xml- change Title to include version number
8. Feature.xml-Change Description to include version number
9. Workflow.xml –Change Name  to include [...]