SharePoint - Configuration for debugging

by 28. August 2008 12:59

Configuring SharePoint for Debugging was quite the adventure, particularly since you have to sift through tons of information on the topic...   I have two different ways that do work (both relatively easy); I'll provide the details below.

The following screen is what started the adventure:

From Visual Studio 2008 I clicked on Debug, Attach to Process and sorted by process - I found I had two w3wp.exe processes; I need to attach to one of them.  I should note that my Google research resulted in varying ideas on the topic, one site I read noted that if you select more than one process *only the first will run*; if the first isn't yours then it won't work, most sites will have you locate the applicable ID using IISApp.vbs, which was not to be found on my system - I later learned it is an IIS 6 file (more on this below).   The SharePoint Training Management Application Documentation notes that you should select them all - indicating that they will all be debugged (which makes sense).   But just in case.... below is the steps to run your specific process.

I clicked on Start and typed in CMD

From the command prompt I did the following:

cd \Windows\System32\Inetsrv

appcmd list wps

I found that I needed to attach to w3wp.exe with ID 3856.  Note AppCmd.exe is used with IIS 7.0, I understand that with IIS 6.0 you'll have to use the following:
cscript c:\windows\system32\iisapp.vbs /a "SharePointDefaultAppPool" /r

I deleted the Training*.* files from C:\Windows\Assembly (GAC), attached to process 3856 and ran the site to see what would blow up - I got the following error: 

I used this opportunity to find where the Bin folder was by getting a reference to the context (see image below on line 38)

Note above that I got past the error  - it was because I added the following statement to all of the projects that need to be in the GAC - after a successful build the DLL files would be copied to the Bin folder for the site:

However, I was being stopped by a different Error:

At first I thought I'd take the easy route, all the research on CASPOL (much of which hasn't worked for me in the past) wasn't a path I have the time to take and I was the only developer placing code on my server (I'm rationalizing because I know this isn't the right way).  I changed the Web.Config to use "Full Trust" as shown below so I wouldn't have to deal with Partial Trust:

As well as it was working (breakpoints being hit) I was not happy with the Full Trust and Bin folder solution.  I deleted the files from the Bin folder, set trust back to WSS_Minimal and updated my Post-Build events as follows - Note: the colon on the first column of the second line is a REMARK statement (line is ignored); the first line installs my DLL into the GAC.  I did this for each Project that needed to be in the GAC

I then complied with the following steps:

1.  Compiled all of the projects (post-build updated GAC)
2.  Deployed the applicable sites
3.  Clicked Start | Command => IISRESET / RESTART
4.  Attached to the W3wp.exe process
5.  Loaded the site and all of my breakpoints were hit - everytime I accessed the page

Debugging worked as well with the files in the GAC and partial trust as they did with the files in the Bin folder w/Full trust.

Note: I didn't have to put my .PDB files in the GAC (many sites suggest this)

Something worth noting is that during my Google Adventure to Debug SharePoint I ran into something that said if you went to Tools | Options and unchecked "Enable Just My Code (Managed only)" that this was all that was required.  At the time I tried this it worked but as you see below it is currently checked and it is still working.  Just in case it could make a difference I'll note it here.

Disclaimer: I develop on Windows Server 2008, .NET 3.5 SP1, Visual Studio 2008 - don't know how well these tips will work in other environments.


SharePoint - Large list

by 21. August 2008 12:39

SharePoint lists consist of records that are stored in a SQL Server database and managed by SharePoint - the alternative to using list is to write to a custom database.  

A key decision that needs to be made when architecting a SharePoint solution is whether to store data in a list or a database; the following is important to know when considering storage requirements:

Benefits of lists follows:

  • SharePoint Web parts provide simple methods for managing the data
  • Workflow/event handlers can easily be registered to them.


  • Cannot be used if business logic requires transactions
  • Cannot store complex data models with intricate relationships
  • Limit of 2,000 items for each list container (recommendation by SharePoint Product team)

The following link references a white paper regarding "Working with Large Lists in Office SharePoint Server 2007"

An excerpt from the above link follows:

There is documented guidance for Microsoft® Office SharePoint® Server 2007 regarding the maximum size of lists and list containers. For typical customer scenarios in which the standard Office SharePoint Server 2007 browser-based user interface is used, the recommendation is that a single list should not have more than 2,000 items per list container. A container in this case means the root of the list, as well as any folders in the list — a folder is a container because other list items are stored within it. A folder can contain items from the list as well as other folders, and each subfolder can contain more of each, and so on. For example, that means that you could have a list with 1,990 items in the root of the site, 10 folders that each contain 2,000 items, and so on. The maximum number of items supported in a list with recursive folders is 5 million items.

White Paper available in above link: SharePoint-LargeList.doc (619.50 kb)

The Baseline test  

Milliseconds to seconds Calculator 

An excerpt from the white paper followsThe goal for the next set of tests was to establish our baseline numbers. Here are the results of the different data access methods against a list with 1,500 items. Only the most common data access methods were included in the baseline testing, so test results for the PortalSiteMapProvider class were not included.

What stands out clearly in this set of results is that viewing the data using the predefined Office SharePoint Server 2007 browser interface is the slowest data access method by far. This is one of the reasons why guidance has been delivered to restrict list sizes to no more than 2,000 items per container. It’s also why we recommend that you don’t consider going above the 2,000 items per container unless you are developing an alternative interface to work with the data.

Deletes can range from 30 to 80 seconds:

More statistics available in white paper

SharePoint - Installation of Guidance

by 7. August 2008 09:32

NOTE: In hindsight, now that I have successfully deployed the projects per steps outlined below, I now see (in my inexperience) that the steps below are to install a Template that can be used to create a site.  I didn't know what I it was that I was deploying which complicated matters for me, I assumed it to be a site. 

 The P&P SharePoint Guidance has the following instructions for installation:

Installation Instructions

  1. Download and unzip source code.
  2. Open TrainingManagement.sln in Visual Studio 2008.
  3. In Visual Studio, go to the properties of the Training Management project and, in the Debug section, specify the URL of the SharePoint site collection to deploy the project in the Start browser with URL field.
  4. In Visual Studio, right click on the Training Management project and click Deploy.
  5. In Visual Studio, right click on the Training Management Registration Approval workflow project and specify the same SharePoint URL to deploy the workflow to in the SharePoint Debug Settings. (Do not automatically associate the workflow.)

    Was doing great up to this point - then I received an error on step 6 "value cannot be null" Parameter name: uriString

  6. In Visual Studio, right click on the Training Management Registration Approval workflow project and click Deploy.
  7. In Visual Studio, Build the Accounting Management and HR Management projects and place the DLLs into the Global Assembly Cache.
  8. Run iisreset
  9. Go to the SharePoint site collection URL and create a site using the Training Management template.
  10. Create local Windows users "spgmanager" and "spgemployee". Add those users to the Training Management SharePoint site with Reader permissions.
  11. Associate the Registration Approval Workflow with the Registration list. (Create a new task list as part of the association and specify the workflow to start when a new item is added to the list.)

Performing the following for step 5 resulted in a successful deploy:

When I attempted to comply with the above for the TrainingManagement.RegistrationApproval project I receved the noted "Value cannot be null" error.   After trying different things I stumbled upon the "Target Site" property of the TrainingManagement.RegistrationApproval project.   The following properties are not present in the TrainingManagement project which has me assuming they are related to WorkFlow (you'll see why below):

Upon inputting my URL, which worked for deploying the TrainingManagement project - I received the following message (something I could work with).  I ASSUMED that the process would generate a site during deployment - the following gave me a clue to the problem; I was confused because the deployment for TrainingManagement reported that it was successful???

I create a TrainingManagement site and once again the Target Site setting in the project properties list reveals that I must have Document, Task or history list.   This is more like it - not an obscure "value cannot be null".

At this point I attempt to launch my SharePoint site (to create the required list) and it is down for the count - it appears the above crashed it into the ground.  Nothing a START | IISRESET /RESTART couldn't fix, after it was done my SharePoint site was back online. 

I added a Document Library (assuming it was a Document List) and still got the above error, tried a custom list - still no luck.   I then found "Tasks" under tracking and after creating it - Walla!, I was at the next step :)

Now I can understand the comment at the end of step 5 ==> (Do not automatically associate the workflow.)  I unchecked the checkbox, clicked on Finish and the TrainingManagement.RegistrationApproval project's properties were now populated with values.  The "Target List" property being populated with my "Customer List" makes me wonder if I would have encountered more complaints had I not created it....

I then right clicked on TrainingManagement.RegistrationApproval and DEPLOYMENT WAS SUCCESSFUL!

Step 7. notes that we have to update the GAC with the AccountingManagement and HRManagement DLLs.  If you are not comfortable with the Command prompt then you can take advantage of the project property page's Build Events tab - specifically the Post-Build, to do the work for you:

For your convenience I have the statement below so you can copy/paste it - the quotes are important!  Verify that you have the v6.1 sdk (you may have the 6.0) and update the path as applicable.

"C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\gacutil" -I "$(TargetPath)"

I then completed step 10 and did the following in Step 11:



SharePoint - Links List

by 26. July 2008 14:54

SharePoint site: 

Visual Studio 2008 Extensions Version 1.2 

Popular Virtual Labs for SharePoint Developers

Examine the options, process, and benefits of adding support for SharePoint workflows to your application, and for breaking that support into components that clients can use to build their own workflows. Download the sample code: Delivering Modular Workflow Functionality in SharePoint Server 2007.
Part two of this article about delivering modular workflow functionality in SharePoint Server 2007 focuses on creating a custom action for SharePoint Designer.
Learn how to use the Exchange Server Protocols documentation to create a contact item in Outlook 2007 using the Messaging Application Programming Interface (MAPI). Download the sample code: Using MAPI to Create Outlook 2007 Items.
Discover how to develop a basic Microsoft Silverlight Web Part in ASP.NET that hosts a canvas and that can be used with SharePoint Server 2007 and Windows SharePoint Services 3.0. Download the sample code: Basic Silverlight Web Part for Office SharePoint Server 2007.

SharePoint Visual How Tos

How Do I: Create Workflows to Transfer Records Upon Expiration in SharePoint Server 2007
Learn how you can create a workflow to transfer records and then associate the workflow as the action of an expiration policy in SharePoint Server 2007.
How Do I: Prevent Document Modification using Windows SharePoint Services
Allow users to modify metadata but not file contents in Windows SharePoint Services 3.0 by using event handlers and by handling short-term and long-term check-out processes.
How Do I: Prevent Record Modification in Windows SharePoint Services
Use a custom Upload page to ensure that an existing file is not accidentally overwritten during the upload process in Windows SharePoint Services 3.0.
How Do I: Build State Machine Document Approval Workflows for SharePoint Server 2007 Using Visual Studio 2008
State machine workflows enable you to model real-world events and business processes. Learn how Visual Studio 2008 makes creating and debugging these workflows easier than ever.
How Do I: Build an Expense Report Approval Workflow for SharePoint Server 2007 Using Visual Studio 2008
Learn how to create a sequential workflow for SharePoint Server 2007 to manage an expense report approval process.
How Do I: Configure and Deploy Workflows to SharePoint Server 2007 Using a Solution Package
Learn how to configure and deploy a workflow to SharePoint Server 2007 using a solution package.
How Do I: Create Custom Workflow Activities for SharePoint Server 2007 Using Visual Studio 2008
Use Visual Studio 2008 to create custom activities in SharePoint Server 2007 that let you automatically send e-mail messages with attachments.
How Do I: Create a Custom Approval Workflow for SharePoint Server 2007 Using SharePoint Designer 2007
Use SharePoint Designer to create codeless workflows for SharePoint Server 2007 that can be attached to SharePoint lists.


SharePoint 2007 - Initial installation and setup

by 25. July 2008 11:11

Contrary to what this link implied, the MOSS 2007 SP1 package installed without issue in Windows 2008; I suspect that Windows Server 2008 Release (or installation package I used) met the WSS 3.0 requirement; the article was based on Windows 2008 beta. The only adventure with this install will be in configuration - not so much because it isn't documented as much as there are so many options (trying to find configurations in Central Administration).

The first time running SharePoint Central Administration a task list will be displayed.  While launching "Incoming e-mail settings" I received a dialog indicating that SMTP services was not installed.  To Install SMTP I had to do the following:


  1. Load Server Manager
  2. Select Features
  3. Add Features
  4. Select SMTP

In IIS 7.0 Manager I had to do the following to configure it

  1. Select SharePoint - 80 site
  2. Double-click SMTP E-mail
  3. I configured the E-mail information as applicable

To configure my Window Server 2008 SharePoint for access to my Solution Development Management System (SDMS) from the internet I did the following:


  1. Central Administration
  2. Application Management
  3. Authentication Providers (under Application Security)
  4. Select the applicable "Web Application"
  5. Select applicable zone
  6. Check "Enable anonymous access"


  1. Central Administration
  2. Alternate access Mappings (under Global Configuration)
  3. Select sharepoint site from "Alternate Access Mapping Collection" dropdown
  4. Edit Public URLs
  5. Input and save your public Internet address


To be continued....


SharePoint 2007 - MOSS 2007 Developer Edition won't install on Windows Server 2008

by 24. July 2008 19:56

As soon as Windows Server 2008 became available on my MSDN subscription I installed it - I had installed the beta and was very impressed with the "Vista" look and feel (I've been developing under Vista since it was in beta) but was more impressed with the Remote Desktop services.  MOSS 2007 will be the first application I will be installing under it.

Microsoft Office SharePoint Server 2007 (MOSS) is on the top of my list to learn (along with WPF and Unity).   I downloaded the MOSS 2007 Developer Trial version (271 meg) and was disappointed to receive the following prompt:

I googled SharePoint Office Server 2007 Trial and found that the Standard and Enterprise Trials offer you the option to download two versions - I'm now downloading the version that has SP1.

I don't recall the developer edition offering the option to download a version with SP1 - after registration I just had a download button.

I believe the download information suggested that Windows SharePoint Services (WSS) 3.0 was a prerequisite for installation.  The following link suggested that installing WSS on Windows Server 2008 may be an adventure in itself - we'll see....


Blog videos and references to CodePlex projects are no longer valid