Introduction

Welcome to SharePoint 2007 Development Recipes: A Problem-Solution Approach! What you're about to read is the result of an idea thread that's been rolling around in my head for several years—the need for a practical guide that empowers and enables developers to leverage the full potential of SharePoint in the enterprise.

Note

Thanks to Microsoft, just about every book on SharePoint 2007 starts out with a note defining the term. That's because SharePoint can refer to two distinct but closely related products. The first, Windows SharePoint Services (or WSS) is a part of the Windows 2003 operating system (although it must be downloaded and installed separately). WSS, which is free of charge, provides all the core services that you expect, such as security, list management, and web-part support. It's possible to build very sophisticated solutions just using WSS. The second product is Microsoft Office SharePoint Server (MOSS), which builds on top of WSS, is not free, and provides such features as the Business Data Catalog (BDC), Records Management, Enterprise Search, and much more. MOSS takes WSS to new levels in terms of supporting enterprise use of the Office components. Most of the recipes in this book will work equally well in either environment. I will note where a recipe is applicable to only one of the two, or where some changes need to be made depending on the environment.

Early on in my work with SharePoint 2001, I came to view it more as a platform than a product. Since that time, SharePoint has grown tremendously in scope. With SharePoint 2003, we saw the development of robust .NET and web services APIs, as well as a fully thought-out templating model. Just when I thought I understood SharePoint pretty well, the 2007 version was released.

One admittedly crude way of gauging functionality is to look at the number of class library namespaces (for example, Microsoft.SharePoint.Administration) in the API. In SharePoint 2003 there were about 15 libraries in the WSS object model. That number has grown to 35 in the current version! Just a few of the major new or significantly enhanced features in SharePoint (both WSS and MOSS) include the following:

  • .NET 2.0 web-part support

  • Auditing

  • Business Data Catalog (BDC)

  • Content types

  • Event receivers

  • Forms-based authentication

  • Features and solutions

  • Master pages

  • RSS

  • Search

  • Workflow

...and a thousand others.

Note

For a complete list of SharePoint namespaces, classes, methods, and properties, refer to the SharePoint 2007 SDK at http://msdn.microsoft.com/en-us/library/ms550992.aspx.

If nothing else, SharePoint is a great platform for developers who love to learn new programming constructs, objects, and tools (if you don't love to learn, you're in for a rough ride with SharePoint). The reward, however, is equally great. In my 25 years of building software, I have never worked with a platform that is as broad and deep, has such a well-developed API, or is as malleable as SharePoint. I'm no apologist for Microsoft, but I must say they get developers, and SharePoint is a case in point.

But you didn't buy this book to hear me wax poetic about a product or the company that produced it. You bought this book to get real work done real soon. Let me say a few words about how this book is organized and then we'll get to the meat of it.

Is This a "Beginner" or "Advanced" Book?

One question that always comes up when discussing a book is the audience: specifically, whether a book is for beginning, intermediate, or advanced readers. To me, this is the wrong question. The right question is, "Will the book provide information that you don't already possess, or provide information that you already have but in a more accessible form?" In my experience, people who write computer applications tend to be very bright, so it's not a question of intelligence. But SharePoint is such a broad and deep technology that it's quite possible to be a master of some topics and a novice at others. For example, you might be an expert at creating web parts or BDC schemas yet never have looked into creating event handlers or workflow.

Like a cookbook, SharePoint 2007 Development Recipes assumes a certain level of proficiency on the part of the reader. I'll assume you know how to create the basic .NET project types: console, ASP.NET, and ASP.NET web service. That being the case, I won't do a lot of setup for the recipes, just launch in to where the coding begins.

In addition, although we'll cover the basics of deploying a web part, feature, or solution, that's not the focus here. There are many great books and articles that can help you do those things. So the emphasis, again, will be on the cooking rather than the preparation.

Which leads me to another point: this book is much less about theory than practice. Not that understanding the underlying theory of a software platform isn't valuable; it is. It's just that my bias is toward getting things done rather than figuring out how many angels can dance on the head of any particular pin. If you want to know why Microsoft wants you to use SharePoint for human-centric workflows and BizTalk for machine-centric workflows, ask Microsoft. If you want a set of guidelines for when to use a list event receiver, and when to use a workflow to accomplish a given task, or how to add a web part to 1,000 sites programmatically, you've come to the right place.

At the end of the day, this book is designed to be used as a desk reference by those developing applications on top of the SharePoint 2007 platform. It's organized much like a cookbook, with recipes grouped by purpose (administration, webs, lists, web parts, and so forth). Although you can pick just the recipes that meet your immediate needs, browsing through other sections will provide you with lots of ideas for new approaches, techniques, and applications. Of course, a book like this, on a platform as extensive as SharePoint, can never be all-encompassing. What you'll find here are my favorites: recipes that have proven useful in my experience, and that as a whole expose a large part of what's possible with SharePoint. If I hear from one reader that a recipe in this book enabled them to meet a deadline because they could "steal" some code, tweak it a bit, and get what they needed working quickly, I'll feel I've done my job.

How This Book Is Organized

Each recipe is presented by using a common structure that's designed to provide you with a complete set of conceptual tools, as well as working source code, to implement and build on that recipe to make it your own. Specifically, each recipe has the following components:

Recipe Type

The recipe tells you right up front what will be cooked up—a console application, web service, web application, event handler, web part, or script.

Ingredients

Provides a list of all key libraries, classes, and web services that the recipe relies on. Ingredients are further broken down into assembly references (that is, those you need to add to your Visual Studio project), class library references that need to be referenced with using or Imports statements, web services references, or individual classes used.

Special Considerations

Gives pointers and alerts you to issues you need to be aware of to correctly use the recipe and understand why certain design decisions were made.

Process Flow

The process flow includes a graphical representation of key recipe processes, as well as a supporting narrative describing those steps. This helps clarify the logic behind the core elements of the recipe.

Recipe Code

Ultimately, this book is about building working solutions. With that in mind, each recipe provides complete, working code in both C# and VB.NET. Recipes range from .NET console applications to web applications to web services. The emphasis is on demonstrating the core SharePoint programming constructs rather than creating fancy user interfaces—which I leave to you.

To Run

This is where you get to "taste" the fruits of your labor. In this section, you'll find exactly what you need to run the application you've just built, including any steps to add web parts, create Internet Information Services virtual directories, set properties, and the like.

Variations

Here I'll provide suggestions for alterations to the recipe that you may want to consider. Of course, the real fun is when you make these recipes your own by creating the variations that are uniquely yours!

Related Recipes

If there are other recipes in the book that share similarities or may be of particular interest in relationship to the currently described recipe, I'll note them in this section.

Have Fun with It!

Finally, the term recipe has been used intentionally, as I hope you will take what you find here and make it your own by adding your own dashes of code and flourishes of genius.

Consider what you find in these pages a starting point, not the final word.

Happy coding!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.175.21