5 Issue

UNDERSTANDING SHAREPOINT JOURNAL

Bjørn Furuknap

Beginning SharePoint Development

UNDERSTANDING SHARE POINT JO URN AL

Beginning SharePoint Development

This book is dedicated to my wife.

 Understanding SharePoint Rubina Ranasgt. 10 N-0190 Oslo, Norway Phone +47 91 39 85 86 • Web http://www.understandingsharepoint.com/

Credits About the Author Bjørn Christoffer Thorsmæhlum Furuknap is a senior solutions architect, published author of Building the SharePoint User Experience, speaker, and passionate SharePointaholic. He has been doing software development professionally for 16 years for small companies as well as multinational corporations. He has also been a teacher at a college-level school, teaching programming and development to aspiring students, a job that inspired him to begin teaching what he has learned and learns every day.

About the Technical Reviewer Jim Bob Howard is a husband and father, senior software engineer, and web designer. He is a published writer on numerous topics from homeschooling to frugal living and from theology to SharePoint. He has been doing software development off and on professionally for 15 years for companies of all sizes. He enjoys helping craft solutions for custom business requirements and is glad to join the USP Journal team.

About Understanding SharePoint Journal Understanding SharePoint Journal is a periodical published by UnderstandingSharePoint.com. The journal covers few topics in each issue, focusing to teach a deeper understanding of each topic while showing how to use SharePoint in real-life scenarios. You can read more about USP Journal, as well as get other issues and sign up for regular updates, discounts, and previews of upcoming issues, at http://www.understandingsharepoint.com/journal.

Other Credits A great big thanks to Kim Wimpsett for doing the copyedit. The quality of work in this issue is greatly attributed to her skill. Jeremy Thake and Andreas Ferdinand have provided important and valuable reviews as part of the community review board.

Table of Contents Credits........................................................................................ i About the Author ................................................................................... i About the Technical Reviewer ................................................................ i About Understanding SharePoint Journal ................................................ i Other Credits ......................................................................................... i

Introduction ............................................................................... 4 Preparing for Departure ............................................................... 1 Preparing Your Environment ................................................................. 1

What You Must Have ...............................................................................1 What You May Want ................................................................................3 Now, How About Them Links? ..................................................................5

Setting Up SharePoint ........................................................................... 6 Installation Requirements ..........................................................................6 Installing SharePoint .................................................................................8 Configuring SharePoint for First Use ........................................................13

SharePoint as Birds See It .......................................................... 22 At First Glance ................................................................................... 22 SharePoint Front Page .............................................................................22 Create Page ...........................................................................................25 Pages in SharePoint ................................................................................26 Site Settings Page ...................................................................................28

Featuring the Framework..................................................................... 33 Is There a Solution? ................................................................................34

SharePoint Development Scenarios ...................................................... 35 Taxonomy .............................................................................................35 Legacy Web Applications ........................................................................36 Business Process Automation ...................................................................37

Core Concepts .......................................................................... 40 The Straw That Brought the CAML Back............................................. 40 So, What Does It Look Like? ...................................................................41

SharePoint Object Model Principal Players .......................................... 42 Basic Tasks ...........................................................................................43 Disposing of Objects...............................................................................45

Creating Your First SharePoint Solution............................................... 46 Deploying the Feature .............................................................................50

Data Development .................................................................... 59 Creating a Content Type ...................................................................... 59 Content Type Basics ........................................................................... 63

Content Type Features ............................................................................63 Content Type ID ....................................................................................64

SharePoint Lists .................................................................................. 65 List Instances .........................................................................................66 List Definitions ......................................................................................71

Behavior .................................................................................. 79 Event Receivers .................................................................................. 79

Feature Receivers ...................................................................................79 Content Type Event Handlers...................................................................83

SharePoint Designer Workflow............................................................ 90

Visual Stuff............................................................................ 103 Web Parts .........................................................................................103 Creating a SharePoint Web Part.............................................................. 104

Custom Actions ................................................................................108 Replacing a CustomAction .................................................................... 108 Dynamic CustomActions ....................................................................... 111

Final Thoughts and Additional Resources .................................. 116 Previous USP Journal Issues.................................................... 117 Issue 1: SPCurrentUsers Explained ......................................................... 117 Issue 2: Developing SharePoint Content Types ......................................... 117 Issue 3: SPTags Explained ..................................................................... 117 Issue 4: SharePoint Designer Workflow................................................... 117

USP Journal Affiliate Program ................................................ 120

Exercises        

Creating the Web Application ........................................... 17 Creating a Site Collection ................................................. 18 Creating Your First SharePoint Solution ............................. 46 Creating a WSP Solution File............................................ 53 Creating a WSPBuilder Solution ....................................... 60 Creating a List Instance in SharePoint ................................ 66 Adding Content to a List Instance ...................................... 69 Creating a Custom List Definition ..................................... 71

      

Creating a SharePoint Feature Receiver .............................. 80 Changing Site Logo in a SharePoint Site ............................ 81 Creating a Content Type Event Handler ............................. 83 Creating a SharePoint Designer Workflow.......................... 91 Creating a SharePoint Web Part ...................................... 104 Creating a CustomAction Feature .................................... 108 Creating a Dynamic CustomAction .................................. 112

Introduction Asking the right question, at the right time, to the right people, can trigger a landslide. Welcome all aspiring SharePoint developers, to Understanding SharePoint Journal. If you are completely new to SharePoint, welcome also to SharePoint and a world of thrills and joys, horrors and quirks. You are about to embark on an exciting journey, and I’ll modestly say that you have chosen an excellent place to start, reading this issue as you are. I may be biased. Throughout this issue, I will introduce you to SharePoint and some of the tasks you may encounter as a SharePoint developer. If you have done some development already, then that is a big benefit, and the benefit becomes huge if you have done ASP.NET development. However, you should be able to complete the exercises even without prior programming experience. This issue came about after a member of the mailing list complained about the lack of beginner courses in SharePoint development. According to the reader, most online resources or books assumed that you either had a lot of prior experience or were too shallow to provide any benefit. Although I won’t claim to have tried to cover the full depth of any topic in this issue, I have chosen tasks to show you a wide variety of scenarios you may encounter. Of course, you may want to dive deeper into these issues later, and I’ll be immodest enough to suggest checking out the other issues of USP Journal to explore at least some of those topics in greater depth. Before we get started, I would also like to extend a special thank-you to the team that has worked on this issue. With that said, I think it is time to start….

B E G I N N I N G

S H A R E P O I NT

1

D E V E L O P M E N T

Chapter

Preparing for Departure Your first step on a wondrous journey. Welcome, welcome, welcome. In this chapter, I want to make sure that you have a development lab set up and ready for use. I realize that if you have never worked with SharePoint before, this may seem a bit bewildering. However, ensuring that we have a common setup allows us to better explore the development scenarios and get similar results. Now, the first thing you want to do is create a new Visual Studio project. Feel free to use the WSPBuilder project types. Then, add a new feature with receiver, build and… Oh, you haven’t gotten that part yet. Sorry, let’s make sure you get your environment set up first. I C O N

K E Y

 Valuable information



Test your knowledge

 Exercise

 

Caution Line break

Preparing Your Environment First things first, right? We need to get you set up with the right equipment and tools to make your development experience as productive and educational as possible. What You Must Have Well, you’ll need SharePoint. And you’ll need a place to run SharePoint. And that place will need to be on a server operating system. Yes, I know, you are likely not walking around with a server under your arm, but fear not, there are ways to solve this, even on a laptop. In fact, I do this all the time when I am demonstrating SharePoint to people while on the move. What you want to get is one of several available virtual machine software packages. Personally, I prefer VMware Workstation, but you can also use Microsoft’s free Virtual PC. Both of these allow you to run a virtual server on your computer.

1

If you do have a server you can use for running SharePoint, getting a virtual machine is still a better idea. You see, not only are you going to run SharePoint on that server, but you are also going to do your actual development on that server. In addition, virtual machines allow you to easily revert to a previous state. As a developer, you will likely do some…weird stuff to your server. Having to reinstall the entire machine just because you want to see what happens if you do something really cool is a hassle. Note

Even if you have a slower laptop with only a gigabyte or two of memory, you can run a server OS as a guest OS. It may be a bit slower, but I ran a Windows Server 2003 virtual machine on my 1GB laptop for a long time before I bought a faster computer. I’ll include a resource box with download links a little later in this chapter. The second thing you need is a Windows Server OS. Just pop on over to the Microsoft store; I’m sure you can get something as cheap as a few thousand dollars. Or, you can simply download a 180-day evaluation version, which will allow you more than enough time to evaluate it if this is a path you want to take.  Tip

Even if you decide you want to keep working with SharePoint after your evaluation period expires, you still do not have to buy a full license to Windows Server. Microsoft offers several developer subscriptions that give you access to development and lab software, such as an MSDN subscription or a TechNet subscription. These are far more affordable than buying full licenses but are not for use in production environments. Now, if you are running on a slower machine, getting Windows Server 2003 may be a better choice than Windows Server 2008. I’ll even use Windows Server 2003 in this issue to make sure we get everyone on board. As I said, you are going to do your development work on the server. I recommend using Visual Studio as your development platform. You can use other tools as well or even Notepad if you are so inclined. In fact, Notepad is a useful tool for several tasks here, so don’t brush this off as completely ludicrous yet. Visual Studio is also available as a free version, called Visual Studio Express, and you can get 90-day evaluation versions of the paid versions as well. The link to both the free and trial versions is in the resources box below.

2

The final item you must have is SharePoint. The content in this book focuses on Windows SharePoint Services, the free version of SharePoint, and I won’t touch MOSS topics at all. I’ll walk you through the installation of SharePoint in a moment, but first, let’s take a look at some tools you may want to get. Tip

I will not walk you through the installation of Windows Server 2003 or Visual Studio. However, if you have problems with installing these, Microsoft offers a premade virtual machine that you can download that has been set up with Windows Server 2003, Visual Studio, and SharePoint. What You May Want The tools I list here are not required but are very useful in your SharePoint development toolkit. I will introduce you to how you use these tools throughout this issue, enough to make you see the benefit of them. Before I introduce these tools, however, I would like to share with you some general advice. Tools are very good as productivity tools but horrible as educational tools. If you start out relying solely on tools, you will quickly face problems once the tools are not adequate for solving your requirements. As such, although I recommend that you get these tools, I will instruct you in not using them. This will also ensure that you are armed with enough knowledge to fully appreciate how much time these tools really save you. WSPBuilder

Two of the most useful tools in the world of SharePoint development are made by a Dane named Karsten Keutmann. The first of these tools is WSPBuilder—or, more precisely, the WSPBuilder extensions for Visual Studio, but I’ll just refer to the tool as WSPBuilder. WSPBuilder integrates with Visual Studio to speed up your SharePoint development by a factor of lots. WSPBuilder does this by adding several useful project templates that do a lot of the tedious and manual labor required by a SharePoint project. In addition, WSPBuilder extends Visual Studio by adding several very useful menu options that help you create, deploy, and upgrade WSP solution packages required by SharePoint for solution installation. 3

You probably won’t realize all the power that rests inside this small package until later in the issue, but let me just say at this point that WSPBuilder will save you hours of work on every project you develop. The even better part is that the tool is free, just like the other optional tools in this chapter. SharePoint Manager 2007

The other tool from Karsten Keutmann is SharePoint Manager 2007. SharePoint Manager 2007 allows you to inspect your entire SharePoint installation, even information that is not visible through the web interface. SPM also allows you to make changes to your SharePoint sites, giving you speedy access to information and choices not readily available elsewhere or that require cumbersome command-line commands. SPM is also incredibly useful for verifying that changes you make to SharePoint are applied correctly. As with WSPBuilder, no amount of explanation at this point will make you appreciate the power of these features of SPM, but throughout this issue, you will surely understand how SPM also will save you tons of frustration and time in your SharePoint development. .NET Reflector

Finding the source of a problem sometimes requires really getting your hands dirty. In .NET terms, this means reflection, meaning you split open a .NET DLL file and look at the source code. Inspecting the SharePoint source code is incredibly useful if you are searching for information that is not written in the documentation. Sadly, this is quite often, and sometimes the documentation does not properly reflect reality either. .NET Reflector is not a SharePoint tool at all, though, so if you have done your fair share of .NET development before, chances are you already have this tool. Microsoft SQL Server

Although not required, having a SQL Server installation will allow you to inspect the databases created by SharePoint. You may also want to set up database backups and perform restores if something goes terribly wrong. Let’s face it, as developers, we tend to break things to learn. I highly recommend using a full SQL Server installation. SharePoint works well with both SQL Server 2005 and 2008, so either version will do. Again, Microsoft provides trial software for you to use, available as a download from the Microsoft site. Installing SQL Server is not covered in this issue, however, so if you want to use a full SQL Server installation, you need to set this up on your own.

4

Windows SharePoint Services SDK

The software development kit for SharePoint mainly contains the documentation for SharePoint development in a downloadable format. However, although this is very useful in some scenarios, remember that downloaded and offline content will go stale, and the online version of the documents may be more up-to-date. Although I find the SDK very useful, I also keep the MSDN documentation on speed-dial as often as I can. Now, How About Them Links? OK, OK, you have been patient enough; here are the links to all you will need to follow along in this issue. Feel free to get all of these now, before moving ahead. Resource Links

Virtual PC http://www.microsoft.com/downloadS/details.aspx?FamilyID=04d264 02-3199-48a3-afa2-2dc0b40a73b6&displaylang=en VMware Workstation evaluation http://vmware.com/products/ws/ Visual Studio 2008, Express and paid version evaluation http://www.microsoft.com/visualstudio/en-us/try/default.mspx Windows SharePoint Services with Service Pack 2, Infrastructure Update http://technet.microsoft.com/enus/windowsserver/sharepoint/bb400747.aspx WSPBuilder http://www.codeplex.com/wspbuilder SharePoint Manager 2007 http://www.codeplex.com/spm .NET Reflector http://www.red-gate.com/products/reflector/ SQL Server 2005/2008 Trial 5

http://www.microsoft.com/sqlserver/2005/en/us/trial-software.aspx http://www.microsoft.com/sqlserver/2008/en/us/trial-software.aspx Windows SharePoint Services SDK http://msdn.microsoft.com/en-us/library/ms441339.aspx Download the required software, and make sure you install and set up at least your server operating system as well as your preferred version of Visual Studio now. For your lab environment, you may choose any setup you like, and in most cases, the default setup options will work.

Setting Up SharePoint At this point, you should either have set up or be setting up your Windows Server OS and Visual Studio. I am going to assume that you have done so, so if you haven’t, following along with the exercises may prove difficult. Also, my assumptions would be wrong, and I really don’t want that to be the case.  You should also have set up SQL Server now. Although this is optional, I do recommend it. The setup experience and later options change slightly depending on whether you use a separate SQL Server installation, so I will cover both setup alternatives in this chapter. Note

Remember to update all your software after installation. For Windows and Visual Studio, you can accomplish this using Microsoft Update. Installation Requirements The first task we will undertake is to set up your system to meet the requirements of a SharePoint installation. In short, you need to ensure that you have .NET 3.0 and IIS installed and also that ASP.NET 2.0 is installed and allowed to run. VIDEO CONTENT The video IIS Setup walks you through the installation, setup, and configuration of IIS and ASP.NET 2.0.

6

.NET Frameworks

If you have not yet installed .NET 2.0 and .NET 3.0, now would be a very good time to do so. To install them, go to Windows Update or Microsoft Update, and check the optional software category. After you have installed these two versions of the framework, make sure that you go back into Windows Update to get any patches or security updates to the framework. This advice applies to any update you make to the OS, however, so I’m not going to repeat it every time. IIS

To install IIS, go to the Control Panel and then Add/Remove Programs. You will find a button in the left menu called Add/Remove Windows Components. Click this button. Next, find the option titled Application Server, select it, and hit Next to begin file copying the files. Doing so will almost set up all you need to get IIS to run properly. The missing thing is to configure IIS to allow ASP.NET to run. This will be done automatically if you install the frameworks after you have installed IIS, though, but I recommend you go through the steps just to know what to do. If you installed the .NET Framework before installing IIS, you need to configure IIS to recognize ASP.NET as a web server extension. To do so, start a commandline console by hitting StartRun and typing cmd. Next, change the directory into the C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 folder, and then type aspnet_regiis.exe /I before hitting Enter. After the registration of ASP.NET completes, go to the Internet Information Services Manager, and navigate to Web Service Extensions. Locate ASP.NET 2.0, and allow the extension, as shown in Figure 1.

7

FIGURE 1. ALLOWING ASP.NET 2.0 EXTENSIONS After completing this step, you are ready to start the Windows SharePoint Services installation. Installing SharePoint The SharePoint installation has several stages, and you also need a few user accounts that you will use when setting up the installation. So, before you doubleclick the SharePoint installer file, you need to prepare three user accounts. These user accounts serve specific purposes to your SharePoint environment, so I will explain these in more detail. VIDEO CONTENT The video WSS Install walks you through the installation of SharePoint. You do not need to set any specific permissions on any of these accounts, so just creating a plain user account will be enough. SharePoint will grant the necessary permissions and group memberships as required. You can create these users from the Computer Management administrative tool. Note

You may want to refer to the TechNet document on user accounts for your production environment. 8

http://technet.microsoft.com/en-us/library/cc263445.aspx For your development lab, however, using the setup explained here will suffice. SharePoint Administrative User

The administrative user account runs the Central Administration application pool as well as all the Windows services required by SharePoint. In my lab, I use the username sp_admin for this account. SharePoint Application Pool User

The application pool user account is responsible for running the application pool for your SharePoint web application. In my lab, I use the username sp_user for this account. SharePoint Search Content Access User

The search content access user account will have full read access to your entire SharePoint installation. The account is used by the search indexer to index all the documents in your sites and site collections. Note that this does not grant the end user any elevated access. The content access account does not return results to the user, so user permissions, or the lack thereof, still apply to the search results. In my lab, I use the username sp_search for this account. After creating these users and setting an appropriate password, your Computer Management console should resemble Figure 2.

9

FIGURE 2. COMPUTER MANAGEMENT CONSOLE With these three users created, it is time to start the installation of SharePoint. SharePoint Installation Wizard

When you start the SharePoint installation wizard, the wizard will first determine whether you have met all the prerequisites of the installation. You should at this point have done the following: •

Installed IIS



Installed .NET Framework 2.0 and 3.0



Configured IIS to allow ASP.NET 2.0

Refer to the previous sections if the SharePoint installation wizard complains about any of these issues. After accepting the license terms, the installation wizard will ask you to choose between a basic install and an advanced install. Although the basic option may seem tempting, you lose several options that are important to your development experience, especially if you want to configure and use a SQL Server installation.

10

Note

The choices you make here are not easily reversed, so I highly recommend you choose the Advanced option. If you do select the Basic option, however, you can skip the rest of this section. After you select Advanced, you are asked a question similar to the previous question about server type, as shown in Figure 3.

FIGURE 3. SERVER TYPE SELECTION The Stand-alone option, although simple for single installations, limits your future options. The option Web Front End, however, may confuse you, because it clearly states it will install only those components required to render content to users. However, this is all we need, so select the Web Front End option. After clicking Install Now, SharePoint will complete the installation of the files needed to run SharePoint.

11

SharePoint Products and Technologies Configuration Wizard

After the installation completes, SharePoint will offer to run the SharePoint Products and Technologies Configuration Wizard. Note

From now on, I’ll refer to this wizard as the SharePoint configuration wizard. My fingers hurt every time I have to type the entire name. Oh, and one more note… Note

If you choose not to run the wizard now, you can restart the wizard from Administrative Tools later. When you start the SharePoint configuration wizard for the first time, you will be asked to provide the SQL Server name and the credentials used for the administrative functions in your SharePoint installation. This is the sp_admin user you created earlier in the chapter. The first choice you will make is whether to connect to an existing farm or create a new farm. Every SharePoint installation is a farm, even if it is a one-animal kind of farm. I’ll explain more on the SharePoint architecture in the next chapter. Since this is the first and only server you are installing, you should choose to create a new farm. Doing so will lead you to the Specify Configuration Database Settings page of the wizard. This page is fairly straightforward, but there is a caveat. I strongly recommend using the machine name as the database server rather than localhost. Although using localhost may work initially, I have seen problems configuring certain options later. See Figure 4 for my setup of this page, and hit Next when you have set up something similar.

12

FIGURE 4. DATABASE CONFIGURATION On the next configuration page, you can specify which TCP port you want to use for the Central Administration website. It may be a good idea to customize this number and use a number you can easily remember. For example, setting the number to 2000 may be easier for you to remember than 34241. Finally, after hitting Next and reviewing your configuration, you are ready to let the wizard complete its magic. This will launch a series of steps in which SharePoint will configure your new installation and create the required databases, give the sp_admin user the correct permissions, create the Central Administration website, and so on. After the wizard completes waving its wand around to conjure up a new SharePoint installation for you, hit Finish to launch the Central Administration website to perform the final setup. At this point, however, the actual installation of SharePoint is complete. Configuring SharePoint for First Use When the Central Administration website opens, you should see a site resembling Figure 5.

13

FIGURE 5. CENTRAL ADMINISTRATION  Tip

If you are asked for username and password when you open Central Administration, you can add the machine name to the Local Intranet zone so that the current username is automatically logged in. The Central Administration website has three tabs at the top: Home, Operations, and Application Management. I urge you to explore these tabs to learn what options are available from which tab. For now, however, we should focus on the administrator tasks, available on the Home tab. Most of the administrator tasks are optional. Of course, you want to set up a site, but all the other tasks can be postponed until you need them. The first task is to read the deployment instructions. I will leave that as an exercise for your own spare time. After you have carefully read these instructions, as I am sure you always do, simply delete the task. Mail Setup

The two tasks I recommend you perform right away are the tasks to set up incoming and outgoing email settings. Setting up these settings allows you to interact with your SharePoint installation using email. This is particularly powerful in workflow and automation scenarios but is useful for other purposes as well. VIDEO CONTENT The video WSS Setup Part 1 walks you through the details of completing the mail setup.

14

You do not have to set up a full-blown email server to be able to utilize email in SharePoint, however. In fact, you have already installed most of what you need to get email up and running if you utilize the built-in SMTP Service of IIS. To install the IIS SMTP Service, go to the Add/Remove Programs option in Control Panel, and enter the Add/Remove Windows Components, as you did when you first installed IIS. Then, select Application Server, and click Details. Select the Internet Information Services (IIS) option, and again click Details. Scroll down to find SMTP Service, and select that, as shown in Figure 6.

FIGURE 6. SMTP SERVICE INSTALLATION Hit OK until you are back in the Windows Components Wizard, and hit Next to install the IIS SMTP Service. After the installation completes, go back into Central Administration, and click the Operations tab and then the “Incoming e-mail settings” link. Select Yes to allow the server to receive email, and then hit OK.

15

Note

The remaining settings on the Configure Incoming E-Mail Settings page are optional, but make sure the Settings mode is set to Automatic. If the Automatic mode is not available, retrace your steps of the IIS SMTP Service installation. After returning to the Operations page of Central Administration, click the “Outgoing e-mail settings” link to enter the Outgoing E-Mail Settings page. Again, set your Outbound SMTP server to the machine name of your lab machine. You also need to set a From address. Sadly, by default, SharePoint offers very little flexibility when it comes to setting the sender of outgoing emails, and all notifications, workflow emails, and other system emails are sent from the same address. You can change this when you develop your own features and code, however. Figure 7 shows my setup. Hit OK to return to the Operations page.

FIGURE 7. OUTGOING EMAIL SETTINGS Creating Your First SharePoint Site

Before you can create your first SharePoint site, we need to cover some information on the SharePoint architecture. VIDEO CONTENT The video WSS Setup Part 2 covers the creation of your first SharePoint site.

16

A SharePoint site is actually the lowest level of a pyramid spanning four levels. At the top of the pyramid is the farm, comprising everything in your entire SharePoint installation. Below the farm is the web application. The web application maps to an IIS web application, including an IIS application pool that executes all requests on behalf of the user. Inside each web application is one or more site collections. These site collections are pure SharePoint artifacts and exist in one or more of the SharePoint content databases. Site collections are not visible artifacts, however, and exist only for the structure and management of multiple sites. Finally, inside each site collection, there is at least one, but possibly many, sites. A site is the only visible part of the SharePoint architecture hierarchy. Each site is a website consisting of lists, libraries, pages, and other content. Since you have already created a farm in the installation part of this chapter, the first step to set up your first site is to create a web application.  Creating the Web Application

Go to the Application Management tab of Central Administration, and click the link “Create or extend Web application.” On the Create or Extend Web Application page, click “Create a new Web application” to get to the Create New Web Application page, shown in Figure 8. Note

The “Extend an existing Web application” option is useful if you want to expose the contents of a web application to a different zone, for example to an extranet or to the Internet.

FIGURE 8. CREATE NEW WEB APPLICATION 17

The Create New Web Application page may seem complex, but for lab purposes you really just need to focus on two things here. The first thing you need to decide on is which port your new web application should run. The port will be appended to the server name you use to access your sites in the new web application. If you select 3000 as the port, your sites will be accessible at the URL http://servername:3000/. You can have multiple web applications for a SharePoint farm, but only one web application per port, at least until you set up a full DNS infrastructure. The default port for a web server is 80, and if you select port 80 for your web application, you can access your sites on just http://servername/. I usually end up creating many web applications in a lab environment, so I use multiples of 1000 for my ports, with the Central Administration website at 2000, but that’s just my preference. The second thing you must configure on the Create New Web Application page is the username and password under which the application pool will run. This will be the sp_user account you created previously. Scroll down to the Application Pool section, and enter the username and password of that user.  Tip

If you scroll down beneath the Application Pool section, you can also set up IIS to restart automatically when you click OK. This is useful in a lab environment, but in a production environment, you may want to manually restart IIS during off-peak hours. Finally, scroll down to the bottom. Notice that you cannot select a search server. The reason is that you have not yet configured the search server. Because this option is not strictly required, I have created a walk-through of setting up and configuring search in a separate video. VIDEO CONTENT The video WSS Setup Part 3 guides you through the setup and configuration of search. At the very bottom, click OK to create your first web application.

 Creating a Site Collection

After the web application has been created, you should create your first site collection. The site collection is an administrative feature and is not visible per se. However, even site collection has a root site, and when you are creating a new site collection, you are also creating that root site.

18

To create your first site collection, you can click the Create Site Collection link from the receipt page after creating the web application, or you can go to the Application Management tab and click the link there. You will next go to the Create Site Collection page, a section of which is shown in Figure 9.

FIGURE 9. CREATE SITE COLLECTION For your first site, choose a title and optionally a description for your site. The next section we should address is the Template Selection section. To understand these selections, however, a small bit of explaining is in order. A template is a definition of what should be contained in a site when the site is first created, including pages, lists, libraries, event handlers, features, content types, and all the other things that are unfamiliar to you at this point. SharePoint uses two forms of site templates. One is what is correctly termed site template and is created by taking an existing site and saving that site as a template. Site owners can do this from the Site Settings page, and I will show you how later. The other type of template is a site definition. A site definition is a declarative definition of how a site should be created. The site definition is more flexible than a site template but is harder to create. Both site templates and site definitions are listed in the Template Selection section, and there is no way for you to see just from the name whether a certain selection is a site template or a site definition. However, when users create site templates from existing sites, these are usually located on a tab called Custom. For this exercise, however, just select the Team Site template, which is actually a site definition, and move to the next section.

19

The next section is where you define the site collection administrators. You should have at least a primary site collection administrator, but you can add a secondary site collection administrator as well. A site collection administrator has the overall administrative responsibility for the site and can create new sites inside the site collection. However, you can also add one or more site owners, whose permissions apply only to the individual site to which they are granted permissions. In fact, for end users who need to manage an entire site, I prefer to add them as site owners rather than granting them site collection administrator permissions. For your lab environment, however, feel free to add yourself as the primary site collection administrator. Caution

Do not use any of the three accounts you created previously for the SharePoint service accounts. These are for SharePoint internal use only, while the site collection administrator should be a real human. You will likely revisit the site collection creation page several times. Finally, skip the Quota Template, and click OK to create your first site and site collection. After the creation completes, click the link to open your first SharePoint site. Congratulations, your SharePoint lab is now ready for development. Let’s review the key concepts and move on to the actual development, shall we? 

REVI EW QUESTIO NS

? 1. On what operating system do you develop for SharePoint? ? 2. Before starting the installation of SharePoint, which three setup

requirements must be met on your server?

? 3. After installation, what is the first mandatory task to create a new

SharePoint site?

? 4. Why should you use a dedicated account to run the content web

applications rather than the service account?

20



REVI EW QUESTIO NS ANSWER ED

? 1. You need either Windows Server 2003 or Windows Server 2008 to

develop for SharePoint.

? 2. Before installing, you must install IIS and .NET Framework v2 and v3, as

well as enable ASP.NET 2.0 as an allowed IIS extension.

? 3. After installation, the first mandatory task to create a new SharePoint site

is to create a web application.

? 4. You should use a dedicated account to run the content web applications

rather than the service account since the service account has more permissions than required.

21

2 Chapter

SharePoint as Birds See It Get the broad overview of SharePoint. Now that you have a basic development environment set up, I think we should start out by investigating how you will use that environment and what tasks lay ahead for your development career. In this chapter, I am going to give you a very broad overview of SharePoint and introduce some of the tasks you may encounter as a SharePoint developer. We will explore some of these tasks in greater detail later in this issue, so for now, feel free to concentrate on just grasping the concepts.

At First Glance Start up your newly created SharePoint site. If you have worked with SharePoint before, everything should be familiar, but I would like to walk you through the site in any case to introduce you to some of the development tasks you may encounter. SharePoint Front Page The front page of your SharePoint site, shown in Figure 10, is the user gateway to most of the information in your site.

FIGURE 10. SHAREPOINT TEAM SITE FRONT PAGE

22

Beginning SharePoint Development

programming and development to aspiring students, a job that inspired him to ...... I usually end up creating many web applications in a lab environment, so I use.

982KB Sizes 2 Downloads 186 Views

Recommend Documents

DownloadPDF Beginning iPhone Development with ...
Book Synopsis. Create your very own apps for the latest iOS devices. You ll start with the basics, and then work your way through the process of downloading.

[Indo-Book.com] Beginning Android Application Development (Wrox ...
... Interface . . . . . . . . . . . . . . . . . . . . . . . 81. Chapter 4 Designing Your User Interface Using Views . . . . . . . . . . . . . . . . . . . . . . 125. Chapter 5 Displaying Pictures and Menus with Views . . . . . . . . . . . . . . . . .