Book description
SharePoint 2007 Development Recipes offers a range of ready--to--use code recipes that provide the building blocks for solving many common SharePoint 2007 programming dilemmas. This practical, hands--on guide categorizes recipes by problem area, for example site management, event handlers, users, lists, and web parts, and source code is provided in both VB and C#. As well as providing an invaluable reference, Mark Gerow also includes clear, supporting guidelines to help you modify the code samples for the broadest range of applications.
For each recipe you will find
Background and design considerations
Source code in both VB and C#
Discussion of variations on the provided examples
Cross--reference to core SharePoint classes
If you find yourself asking, "How do I solve this SharePoint development problem?" you will find all the answers in Mark Gerow's supremely useful book.
Table of contents
- Copyright
- About the Author
- About the Technical Reviewer
- Introduction
-
1. Site Management
- 1.1. Creating a Site Collection by Using the Object Model
-
1.2. Creating a Site Collection by Using Web Services
- 1.2.1. Recipe Type: ASP.NET Web Application
- 1.2.2. Ingredients
- 1.2.3. Special Considerations
- 1.2.4. Process Flow
- 1.2.5. Recipe—ASPX (See Project CreateSiteCollectionWebService-VB, File Default.aspx)
- 1.2.6. Recipe—VB (See CreateSiteCollectionWebService-VB, Class Default.aspx.vb)
- 1.2.7. Recipe—C# (See CreateSiteCollectionWebService-CS, Class Default.aspx.cs)
- 1.2.8. To Run
- 1.2.9. Variations
- 1.3. Creating a Site (or Web) by Using the Object Model
-
1.4. Creating a Site (or Web) by Using a Web Service
- 1.4.1. Recipe Type: ASP.NET Web Application
- 1.4.2. Ingredients
- 1.4.3. Special Considerations
- 1.4.4. Process Flow: Web Service
- 1.4.5. Recipe—VB: Web Service (See Project CreateWebService-VB, Class Service.vb)
- 1.4.6. Recipe—VB: Web Form (See Project CreateWeb-VB, Class Default.aspx.vb)
- 1.4.7. Recipe—C#: Web Service (See Project CreateWebService-CS, Class Service.cs)
- 1.4.8. Recipe—C#: Web Form (See Project CreateWeb-CS, Class Default.aspx.cs)
- 1.4.9. To Run
- 1.4.10. Variations
-
1.5. Adding and Modifying Properties of a Site
- 1.5.1. Recipe Type: ASP.NET Web Application
- 1.5.2. Ingredients
- 1.5.3. Special Considerations
- 1.5.4. Preparation
- 1.5.5. Process Flow
- 1.5.6. Recipe—VB (See Project EditProperties-VB, Class Default.aspx.vb)
- 1.5.7. Recipe—C# (See Project EditSiteProperties, Class Default.aspx.cs)
- 1.5.8. To Run
- 1.5.9. Variations
-
1.6. Adding a Web Part by Using the Object Model
- 1.6.1. Recipe Type: .NET Console Application
- 1.6.2. Ingredients
- 1.6.3. Preparation
- 1.6.4. Process Flow: AddWebPart()
- 1.6.5. Recipe—VB (See Project AddWebPartOM-VB, Module Module1.vb)
- 1.6.6. Recipe—C# (See Project AddWebPartOM-CS, File Program.cs)
- 1.6.7. To Run
- 1.6.8. Variations
- 1.6.9. Related Recipes
- 1.7. Adding a Web Part by Using a .dwp or .webpart File
-
1.8. Calculating Storage for all Document Libraries in a Site
- 1.8.1. Recipe Type: .NET Web Application
- 1.8.2. Ingredients
- 1.8.3. Special Considerations
- 1.8.4. Preparation
- 1.8.5. Process Flow
- 1.8.6. Recipe—VB (See Project DocLibStorage-VB, Class Default.aspx.vb)
- 1.8.7. Recipe—C# (See Project DocLibStorage-CS, Class Default.aspx.cs)
- 1.8.8. To Run
- 1.8.9. Variations
- 1.9. Creating a Script to Back Up All Site Collections by Using STSADM
-
2. Working with Users
-
2.1. Obtaining and Displaying Users of a Site
- 2.1.1. Recipe Type: ASP.NET Web Application
- 2.1.2. Ingredients
- 2.1.3. Special Considerations
- 2.1.4. Preparation
- 2.1.5. Process Flow: GetAllSiteUsers
- 2.1.6. Recipe—VB (See Project ObtainUsersInSite-VB, Class Default.aspx.vb)
- 2.1.7. Recipe—C# (See Project ObtainUsersInSite-CS, Class Default.aspx.cs)
- 2.1.8. To Run
- 2.1.9. Variations
- 2.2. Adding Users to a Site by Using the Object Model
- 2.3. Adding Users and Groups to a Site by Using the Web Services
- 2.4. Adding Groups to a Site by Using the Object Model
- 2.5. Adding Roles to a Web Site by Using the Object Model
-
2.6. Adding Roles to a Web Site by Using the Web Services
- 2.6.1. Recipe Type: ASP.NET Web Application
- 2.6.2. Ingredients
- 2.6.3. Special Considerations
- 2.6.4. Preparation
- 2.6.5. Process Flow: GetPermissionFlags()
- 2.6.6. Recipe—ASPX (See Project AddRoleWS-CS, File Default.aspx)
- 2.6.7. Recipe—VB (See Project AddRoleWS-VB, Class Default.aspx.vb)
- 2.6.8. Recipe—C# (See Project AddRoleWS-CS, Class Default.aspx.cs)
- 2.6.9. To Run
- 2.6.10. Variations
-
2.7. Adding Users to Active Directory
- 2.7.1. Recipe Type: ASP.NET Web Service
- 2.7.2. Ingredients
- 2.7.3. Special Considerations
- 2.7.4. Preparation
- 2.7.5. Process Flow
- 2.7.6. Recipe—VB (See Project AddUserToADService-VB, Class Service.vb)
- 2.7.7. Recipe—C# (See Project AddUserToADService-CS, Class Service.cs)
- 2.7.8. To Run
- 2.7.9. Variations
-
2.1. Obtaining and Displaying Users of a Site
-
3. Working with Lists
-
3.1. Creating a List by Using the Object Model
- 3.1.1. Recipe Type: ASP.NET Web Application
- 3.1.2. Ingredients
- 3.1.3. Special Considerations
- 3.1.4. Preparation
- 3.1.5. Process Flow
- 3.1.6. Recipe—VB (See Project CreateListOM-VB, Form Default.aspx.vb)
- 3.1.7. Recipe—C# (See Project CreateListOM-CS, Form Default.aspx.cs)
- 3.1.8. To Run
- 3.1.9. Variations
- 3.1.10. Related Recipes
-
3.2. Creating a List by Using Web Services
- 3.2.1. Recipe Type: ASP.NET Web Application
- 3.2.2. Ingredients
- 3.2.3. Special Considerations
- 3.2.4. Preparation
- 3.2.5. Process Flow
- 3.2.6. Recipe—VB (See Project CreateListService-VB, Form Default.aspx.vb)
- 3.2.7. Recipe—C# (See Project CreateListOM-CS, Form Default.aspx.cs)
- 3.2.8. To Run
- 3.2.9. Variations
- 3.2.10. Related Recipes
-
3.3. Updating a List by Using the Object Model
- 3.3.1. Recipe Type: ASP.NET Web Application
- 3.3.2. Ingredients
- 3.3.3. Special Considerations
- 3.3.4. Preparation
- 3.3.5. Process Flow
- 3.3.6. Recipe—VB (See Project UpdateListOM-VB Form Default.aspx.vb)
- 3.3.7. Recipe—C# (See Project UpdateListOM-CS Form Default.aspx.cs)
- 3.3.8. To Run
- 3.3.9. Variations
- 3.3.10. Related Recipes
-
3.4. Updating a List by Using Web Services
- 3.4.1. Recipe Type: ASP.NET Web Application
- 3.4.2. Ingredients
- 3.4.3. Special Considerations
- 3.4.4. Preparation
- 3.4.5. Process Flow: UpdateListWS
- 3.4.6. Recipe—VB (See Project UpdateListWS-VB, Form Default.aspx.vb)
- 3.4.7. Recipe—C# (See Project UpdateListWS-CS, Form Default.aspx.cs)
- 3.4.8. To Run
- 3.4.9. Variations
- 3.4.10. Related Recipes
-
3.5. Adding a Document to a Document Library by Using the Object Model
- 3.5.1. Recipe Type: ASP.NET Web Application
- 3.5.2. Ingredients
- 3.5.3. Special Considerations
- 3.5.4. Preparation
- 3.5.5. Process Flow
- 3.5.6. Recipe—VB (See Project FileUploadOM-VB, Form Default.aspx.vb)
- 3.5.7. Recipe—C# (See Project FileUploadOM-CS, Form Default.aspx.cs)
- 3.5.8. To Run
- 3.5.9. Variations
- 3.5.10. Related Recipes
-
3.6. Adding a Document to a Document Library by Using Web Services
- 3.6.1. Recipe Type: ASP.NET Web Service and Console Application
- 3.6.2. Ingredients
- 3.6.3. Special Considerations
- 3.6.4. Preparation
- 3.6.5. Process Flow
- 3.6.6. Recipe—VB: FileUploadService (See Project FileUploadService-VB, Class Service.vb)
- 3.6.7. Recipe—C#: FileUploadService (See Project FileUploadService, Class Service.cs)
- 3.6.8. Recipe—C#: TestFileUploadService
- 3.6.9. To Run
- 3.6.10. Variations
- 3.6.11. Related Recipes
-
3.1. Creating a List by Using the Object Model
-
4. Working with Web Parts
- 4.1. Creating a Simple RSS Feed Web Part
-
4.2. Creating an XML Web Part
- 4.2.1. Recipe Type: Web Part
- 4.2.2. Ingredients
- 4.2.3. Special Considerations
- 4.2.4. Preparation
- 4.2.5. Process Flow
- 4.2.6. Recipe—VB (See Project XMLWebPartVB, Class XMLWebPart.vb)
- 4.2.7. Recipe—C# (See Project XMLWebPartCS, Class XMLWebPart.cs)
- 4.2.8. Recipe—XML Document (See Project XMLWebPartCS, File SampleXMLSource.xml)
- 4.2.9. Recipe—XSLT
- 4.2.10. To Run
- 4.2.11. Variations
-
4.3. Creating a SQL Web Part
- 4.3.1. Recipe Type: Web Part
- 4.3.2. Ingredients
- 4.3.3. Special Considerations
- 4.3.4. Preparation
- 4.3.5. Process Flow
- 4.3.6. Recipe—VB (See Project SQLWebPartVB, Class SQLWebPart.vb)
- 4.3.7. Recipe—C# (See Project SQLWebPartCS, Class SQLWebPartCS.cs)
- 4.3.8. Recipe—XSLT (See Project SQLWebPartVB, File Presidents.xslt)
- 4.3.9. To Run
- 4.3.10. Variations
-
4.4. Creating a Page Viewer Web Part
- 4.4.1. Recipe Type: Web Part
- 4.4.2. Ingredients
- 4.4.3. Special Considerations
- 4.4.4. Preparation
- 4.4.5. Process Flow
- 4.4.6. Recipe—VB (See Project PageViewerWebPartVB, Class PageViewerWebPartVB.vb)
- 4.4.7. Recipe—C# (See Project PageViewerWebPartCS, Class PageViewerWebPartCS.cs)
- 4.4.8. To Run
- 4.4.9. Variations
-
4.5. Creating a Connectable Page Viewer Web Part
- 4.5.1. Recipe Type: Web Part
- 4.5.2. Ingredients
- 4.5.3. Special Considerations
- 4.5.4. Preparation
- 4.5.5. Process Flow
- 4.5.6. Recipe—VB (See Project ConnectablePageViewerVB, Class ConnectablePageViewerVB.vb)
- 4.5.7. Recipe—C# (See Project ConnectablePageViewerCS, Class ConnectablePageViewerCS.cs)
- 4.5.8. To Run
- 4.5.9. Related Recipes
-
4.6. Reading Web-Part Parameters from the Querystring
- 4.6.1. Recipe Type: Web Part
- 4.6.2. Ingredients
- 4.6.3. Special Considerations
- 4.6.4. Preparation
- 4.6.5. Process Flow
- 4.6.6. Recipe—VB (See Project QuerystringWebPartVB, Class QuerystringWebPart.vb)
- 4.6.7. Recipe—C# (See Project QuerystringWebPartCS, Class QuerystringWebPart.cs)
- 4.6.8. Recipe—Clients.xslt (See Project QuerystringWebPartCS, File Clients.xslt)
- 4.6.9. To Run
- 4.6.10. Variations
- 4.6.11. Related Recipes
-
4.7. Using the SmartPart to Expose a .NET User Control
- 4.7.1. Recipe Type: Web Part
- 4.7.2. Ingredients
- 4.7.3. Special Considerations
- 4.7.4. Preparation
- 4.7.5. Process Flow: GetProfileStatus()
- 4.7.6. Process Flow: UpdateStatus()
- 4.7.7. Recipe—Page Layout (See Project SmartPartStatusWebPartCS, File SmartPartStatusWebPart.ascx)
- 4.7.8. Recipe—VB (See Project SmartPartStatusWebPartCS, Code-Behind SmartPartStatusWebPart.ascx.vb)
- 4.7.9. Recipe—C# (See Project SmartPartStatusWebPartCS, Code-Behind SmartPartStatusWebPartCS.ascx.cs)
- 4.7.10. To Run
-
4.8. Creating a ZoneTab Web Part
- 4.8.1. Recipe Type: Web Part
- 4.8.2. Ingredients
- 4.8.3. Special Considerations
- 4.8.4. Preparation
- 4.8.5. Process Flow: CreateChildControls()
- 4.8.6. Process Flow: ShowHideWebParts()
- 4.8.7. Recipe—VB (See Project ZoneTabWebPartVB, Class ZoneTabWebPart.vb)
- 4.8.8. Recipe—C# (See Project ZoneTabWebPartCS, Class ZoneTabWebPart.cs)
- 4.8.9. To Run
- 4.8.10. Variations
-
4.9. Creating a Web Part to Edit SPWeb Properties
- 4.9.1. Recipe Type: Web Part
- 4.9.2. Ingredients
- 4.9.3. Special Considerations
- 4.9.4. Preparation
- 4.9.5. Process Flow: CreateChildControls()
- 4.9.6. Process Flow: btn_Click()
- 4.9.7. Process Flow: delbtn_Click()
- 4.9.8. Recipe—VB (See Project WebPropertiesWebPartVB, Class WebPropertiesWebPart.vb)
- 4.9.9. Recipe—C# (See Project WebPartPropertiesCS, Class WebPartProperties.cs)
- 4.9.10. To Run
- 4.9.11. Variations
-
5. Working with Event Handlers
- 5.1. Why Create an Event Handler?
- 5.2. When to Use an Event Handler Rather Than a Workflow?
- 5.3. Event Handler Enhancements in SharePoint 2007
-
5.4. Updating List Fields When Adding a Document to a Document Library
- 5.4.1. Recipe Type: Event Handler
- 5.4.2. Ingredients
- 5.4.3. Special Considerations
- 5.4.4. Preparation
- 5.4.5. Process Flow
- 5.4.6. Recipe—VB (See Project SetDocumentFields-VB, Class Class1.vb)
- 5.4.7. Recipe—VB: Installer (See Project InstallSetDocumentFields-VB, Module Module1.vb)
- 5.4.8. Recipe—C#: Event Handler (See Project SetDocumentFields-CS, Class SetDocumentFields.cs)
- 5.4.9. Recipe—C#: Installer (See Project InstallSetDocumentFields-CS, Class Program.cs)
- 5.4.10. To Run
- 5.4.11. Variations
-
5.5. Sending an Email When a Task Is Completed
- 5.5.1. Recipe Type: Event Handler
- 5.5.2. Ingredients
- 5.5.3. Special Considerations
- 5.5.4. Preparation
- 5.5.5. Process Flow
- 5.5.6. Recipe—VB: Event Handler (See Project SendEmail-VB, Class SendEmail.vb)
- 5.5.7. Recipe—VB: Installer (See Project InstallSendEmail-VB, Class Class1.vb)
- 5.5.8. Recipe—C#: Event Handler (See Project SendEmail-CS, Class SendEmail.cs)
- 5.5.9. Recipe—C#: Installer (See Project InstallSendEmail-CS, Class Program.cs)
- 5.5.10. To Run
- 5.5.11. Variations
-
5.6. Preventing Deletion by Using an Event Handler
- 5.6.1. Recipe Type: Event Handler
- 5.6.2. Ingredients
- 5.6.3. Special Considerations
- 5.6.4. Preparation
- 5.6.5. Process Flow
- 5.6.6. Recipe—VB: Event Handler (See Project PreventDeletion-VB, Class PreventDeletion.vb)
- 5.6.7. Recipe—VB: Installer (See Project InstallPreventDeletion-VB, Module Module1.vb)
- 5.6.8. Recipe—C#: Event Handler (See Project PreventDeletion-CS, Class PreventDeletion.cs)
- 5.6.9. Recipe—C#: Installer (See Project InstallPreventDeletion-CS, Class Program.cs)
- 5.6.10. To Run
- 5.6.11. Variations
- 5.6.12. Related Recipes
-
5.7. Creating a Calculated Field by Using an Event Handler
- 5.7.1. Recipe Type: Event Handler
- 5.7.2. Ingredients
- 5.7.3. Special Considerations
- 5.7.4. Preparation
- 5.7.5. Process Flow
- 5.7.6. Recipe—VB: Event Handler (See Project UpdateFieldsEventHandler-VB, Class UpdateFieldsEventHandler.vb)
- 5.7.7. Recipe—VB: Installer (See Project InstallUpdateFieldsEventHandler-VB, Module Module1.vb)
- 5.7.8. Recipe—C#: Event Handler (See Project UpdateFieldsEventHandler-CS, Class UpdateFieldsEventHandler.cs)
- 5.7.9. Recipe—C#: Installer (See Project InstallUpdateFieldsEventHandler-CS, Class Program.cs)
- 5.7.10. To Run
- 5.7.11. Variations
- 5.7.12. Related Recipes
-
6. Working with Templates and Other XML Files
- 6.1. Adding a PDF Image to Docicon.xml
-
6.2. Adding Custom Menus by Using a Feature
- 6.2.1. Recipe Type: Feature + ASP.NET Web Application
- 6.2.2. Ingredients
- 6.2.3. Special Considerations
- 6.2.4. Preparation
- 6.2.5. Process Flow
- 6.2.6. Recipe—Feature
- 6.2.7. Recipe—Feature Element
- 6.2.8. Recipe—Installer Script
- 6.2.9. Recipe—VB: Default.aspx (See Project AddComment-VB, Class Default.aspx.vb)
- 6.2.10. Recipe—C#: Default.aspx (See Project AddComment, Class Default.aspx.cs)
- 6.2.11. Web.config Changes
- 6.2.12. IIS Configuration
- 6.2.13. To Run
- 6.3. Adding Web Parts Through Onet.xml
-
6.4. Adding an ExecuteUrl Directive to Onet.xml
- 6.4.1. Recipe Type: CAML + ASP.NET
- 6.4.2. Ingredients
- 6.4.3. Special Considerations
- 6.4.4. Preparation
- 6.4.5. Process Flow: Finish_Click()
- 6.4.6. Page Layout: SelectWebParts.aspx
- 6.4.7. Recipe—VB (See Project SelectWebParts-VB, Class SelectWebParts.aspx.vb)
- 6.4.8. Recipe—C# (See Project SelectWebParts-CS, Class SelectWebParts.aspx.cs)
- 6.4.9. To Run
- 6.4.10. Variations
- 6.4.11. Related Recipes
- 7. Modifying Pages with JavaScript
-
8. Advanced Dishes
-
8.1. Customizing the STSADM Command
- 8.1.1. Recipe Type: STSADM Extension
- 8.1.2. Ingredients
- 8.1.3. Special Considerations
- 8.1.4. Preparation
- 8.1.5. Process Flow
- 8.1.6. Recipe—XML (See Project CustomizeSTSADM-CS, File stsadmcommands.recipes.xml)
- 8.1.7. Recipe—C# (See Project CustomizeSTSADM-CS, CustomizeSTSADM-CS.cs)
- 8.1.8. To Run
- 8.1.9. Variations
- 8.1.10. Related Recipes
- 8.2. Crawling a Database Table by Using a BDC Schema
-
8.3. Creating a Custom MOSS Search Page
- 8.3.1. Recipe Type: ASP.NET Application
- 8.3.2. Ingredients
- 8.3.3. Special Considerations
- 8.3.4. Preparation
- 8.3.5. Process Flow
- 8.3.6. Recipe—ASPX (See Project CustomizingSearch-CS, File CustomizingSearch.aspx)
- 8.3.7. Recipe—VB (See Project CustomizingSearch-VB, Class CustomizingSearch.aspx.vb)
- 8.3.8. Recipe—C# (See Project CustomizingSearch-CS, Class CustomizingSearch.aspx.cs)
- 8.3.9. To Run
- 8.3.10. Variations
- 8.3.11. Related Recipes
-
8.1. Customizing the STSADM Command
Product information
- Title: SharePoint 2007 Development Recipes: A Problem-Solution Approach
- Author(s):
- Release date: February 2006
- Publisher(s): Apress
- ISBN: 9781430209614
You might also like
book
VSTO 3.0 for Office 2007 Programming
Get to grips with Programming Office 2007 using Visual Studio Tools for Office A step-by-step guide …
book
Microsoft® Offic Excel® 2007 Visual Basic® for Applications Step by Step
Quickly teach yourself how to automate tasks and create custom spreadsheet solutions with Excel 2007 Visual …
book
Microsoft® SharePoint® Designer 2010: Step by Step
The smart way to build applications with Microsoft SharePoint Designer 2010 -- one step at a …
book
Microsoft SharePoint: Building Office 2007 Solutions in C# 2005
Microsoft SharePoint: Building Office 2007 Solutions in C# 2005 is the third edition of Scot Hilliers …