1. Trang chủ
  2. » Công Nghệ Thông Tin

Microsoft SharePoint 2010 development cookbook ppt

276 2,2K 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Microsoft SharePoint 2010 Development Cookbook
Tác giả Ed Musters
Trường học Birmingham - Mumbai
Chuyên ngành Microsoft SharePoint
Thể loại cookbook
Năm xuất bản 2011
Thành phố Birmingham
Định dạng
Số trang 276
Dung lượng 6,55 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

What you need for this book In order to run the examples in the book, the following software will be required: f Microsoft Server software ‰ Windows Server 2008 R2 ‰ SQL Server 2008 R2 E

Trang 3

Microsoft SharePoint 2010 Development Cookbook

Copyright © 2011 Packt Publishing

All rights reserved No part of this book may be reproduced, stored in a retrieval system,

or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.Every effort has been made in the preparation of this book to ensure the accuracy of the information presented However, the information contained in this book is sold without warranty, either express or implied Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly

or indirectly by this book

Packt Publishing has endeavored to provide trademark information about all of the

companies and products mentioned in this book by the appropriate use of capitals However, Packt Publishing cannot guarantee the accuracy of this information

First published: December 2011

Trang 4

Project Coordinator Michelle Quadros Proofreader Stephen Silk

Indexers Hemangini Bari Tejal Daruwale Production Coordinator Prachali Bhiwandkar Cover Work

Prachali Bhiwandkar

Trang 5

About the Author

instructor for the exclusive Critical Path SharePoint courses for many years Ed is an author

of two books on SharePoint 2010 development He has been a featured speaker at many international conferences, SharePoint Saturdays, and user groups Ed enjoys sharing his real-world expertise with the readers!

He has earlier worked on the Expert SharePoint 2010 Practices book, (ISBN: 1430238704).

I would like to thank Ted and Andrew of Critical Path Training for starting

me on my SharePoint journey, the folks at Telerik for their fantastic support

for my community work, and finally, my loving wife Gala for her unwavering

support for this project

Trang 6

About the Reviewers

Microsoft technologies and more particularly in SharePoint

Initially, he was a web developer, and then became a technical leader for SharePoint from

2006 to 2010 and managed a development team of four

He is now a senior consultant at SoftFluent, an innovative company founded in 2005 by Microsoft veterans

I would like to thank Ed for providing this nice cookbook and I hope it

will be a great help for all the readers Above all, I would like to thank my

wife Zuzana for supporting me and taking care of our children while I was

concentrating on Ed's work

& Environment (S) Pte Ltd He has many years of hands-on experience in SharePoint projects

in various industries, both in the private and government sectors He began his career with 'dBase III +' and 'Pascal' and he is currently engaged full time with 'SharePoint 2010.' Previously, he has worked for several Microsoft gold partner companies and obtained his M.E degree in Computer Science and Engineering from Anna University, in Chennai, India

I take this opportunity to thank three people—first, my friend Loga, who is

the reason for me entering the world of software; second, the Government

of Singapore for the opportunities that they provided me to grow

professionally in this high- tech nation; and third, DHI Water & Environment

(S) Pte Ltd., for giving me the opportunity to work with cutting edge

technologies and giving me the chance to explore new possibilities

Trang 7

Support files, eBooks, discount offers and more

You might want to visit www.PacktPub.com for support files and downloads related to your book Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy Get in touch with us at service@packtpub.com for more details

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks

http://PacktLib.PacktPub.com

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library Here, you can access, read and search across Packt's entire library of books

Why Subscribe?

f Fully searchable across every book published by Packt

f Copy and paste, print and bookmark content

f On demand and accessible via web browser

Free Access for Packt account holders

If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books Simply use your login credentials for immediate access

Instant Updates on New Packt Books

Get notified! Find out when new books are published by following @PacktEnterprise on Twitter,

or the Packt Enterprise Facebook page.

Trang 8

Exploring Content Types and Site Columns 44

Packaging SharePoint Solutions 57

Creating document libraries with Content Types 65

Trang 9

Creating Visual Web Parts 87Creating custom Web Part properties 91Creating Editor Parts for custom Web Part properties 97Creating Connected Web Parts 104

Exploring SharePoint Designer 2010 118Working with the XSLT List View Web Part 122Creating List Forms with SharePoint Designer 132Creating List Forms with InfoPath 135

Retrieving data using LINQ to SharePoint 146Retrieving SharePoint data using the list data service 151Working with the NET Client Object Model 155Working with the Silverlight Client Object Model 161

Getting your data ready for the chapter 172Using the Data Form Web Part with SQL Server 181Using the Data Form Web Part with WCF data 188External Content Types and Lists 194Using Business Data Web Parts 203

Modifying navigation settings 247Creating and Using Page Layouts 248

Trang 10

There is a heavy demand in the marketplace for SharePoint developers that you could

take advantage of—if only you had the opportunity to acquire the relevant skills! However,

SharePoint 2010 is a big, old, product with a steep learning curve—so where

do you begin?

This book has been designed to take the experienced ASP.NET developer from beginner

to professional SharePoint developer in the shortest amount of time You will be productive

on your very first SharePoint development assignment with the knowledge and skills that

you learn here You will have distilled the essence of the author's many years of training,

and leading development teams in SharePoint

This book uncovers the most common "pattern" of SharePoint development tasks

encountered in the real world and puts the topics into a logical order with detailed

step-by-step recipes for you to follow

The practical examples that are given build-up and flow throughout the chapters By the

end of this book, you will be able to apply the concepts to the challenges ahead of you!

What this book covers

Chapter 1, Setting up a Development Environment: In this chapter, you will build a fully

functional SharePoint 2010 server and an integrated SharePoint development environment

in a virtualized setting

Chapter 2, SharePoint Development with Visual Studio: This chapter will introduce SharePoint

2010 development with Visual Studio—packaging with features and deploying with solutions

It will introduce the definition of "schema" SharePoint style—site columns, content types, and

list definitions—as applied to a document library The SharePoint equivalent of a database

"trigger" will be introduced—the list event receiver

Chapter 3, Web Part Development: This chapter will cover web control development with

SharePoint, including user controls and Web Parts More advanced web part development

will be covered including Web Part properties, Editor Parts, and connected Web Parts

Trang 11

Chapter 4, Development with SharePoint Designer 2010: This chapter introduces SharePoint

Designer 2010 as an important tool for the developer You will apply this tool in this chapter

to work with lists You will learn about the very important XSLT List View Web Part, and about creating list forms with both ASPX and InfoPath

Chapter 5, Using the Client OM and REST: This chapter will introduce the retrieval of

SharePoint data via Language Integrated Query (LINQ) and via the List Data Service (REST) The resulting data query will then be demonstrated in a Web Part, and via the Client Object Model in both a Windows and Silverlight application

Chapter 6, External Data: This chapter shows you how to connect to data that is "outside"

of SharePoint, either in databases or via web services Surprisingly powerful out-of-the-box capabilities will allow you to do most of this with "no code"—with Business Data Web Parts, with SharePoint Designer 2010, and with External Content Types and Lists You will also learn

to wrap existing data in SQL Server with a custom developed WCF Data Service that is then consumed in SharePoint 2010

Chapter 7, SharePoint Workflows: This chapter covers using an out-of-the-box approval

workflow and then extending that with SharePoint Designer 2010 Along the way, we are introduced to the workflow form types—Association, Initiation, and Task Edit Then we learn the tools for developing new workflows—Visio 2010, SharePoint Designer 2010, and Visual Studio 2010

Chapter 8, Web Content Management: This chapter provides a "non-developer" overview of

the "other important side" of SharePoint It also covers the concepts of publishing pages, page layouts, and master pages that are used within the Web Content Management capabilities of SharePoint to deliver public-facing websites

What you need for this book

In order to run the examples in the book, the following software will be required:

f Microsoft Server software

‰ Windows Server 2008 R2

‰ SQL Server 2008 R2 Enterprise

‰ SharePoint Server 2010 Enterprise

f Microsoft Office Software:

‰ Microsoft Office 2010 Professional

‰ Visio Premium 2010

‰ SharePoint Designer 2010

f Development Tools:

‰ Visual Studio 2010 Professional or Ultimate

‰ Imtech Get SPMetal Definition Extension3

Trang 12

Note that the links given will lead you to downloadable trial software that will, by definition, have an expiry date Feel free to replace this with your own licensed software, such as an MSDN subscription.

# Software Name URL

Who this book is for

This book is written for the ASP.NET developer who wants to become a professional

SharePoint 2010 developer as quickly as possible, by learning the most important

practical aspects of development that will be used in the real world

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information Here are some examples of these styles, and an explanation of their meaning.Code words in text are shown as follows: "With CreateChildControls, you can literally create a control such as a Label or TextBox and add it to the controls collection."

Trang 13

A block of code is set as follows:

protected override void CreateChildControls()

{

Label myLabel1 = new Label();

myLabel1.Text = "SharePoint 2010 Cookbook Chapter 3 - This Web Part uses CreateChildControls";

this.Controls.Add (myLabel1);

}

When we wish to draw your attention to a particular part of a code block, the relevant lines

or items are set in bold:

Warnings or important notes appear in a box like this

Tips and tricks appear like this

Reader feedback

Feedback from our readers is always welcome Let us know what you think about this book—what you liked or may have disliked Reader feedback is important for us to develop titles that you really get the most out of

Trang 14

To send us general feedback, simply send an e-mail to feedback@packtpub.com, and mention the book title via the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail suggest@packtpub.com

If there is a topic that you have expertise in and you are interested in either writing or

contributing to a book, see our author guide on www.packtpub.com/authors

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you

to get the most from your purchase

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com If you purchased this book elsewhere, you can visit

http://www.PacktPub.com/support and register to have the files e-mailed directly to you

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen

If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us By doing so, you can save other readers from frustration and help us improve subsequent versions of this book If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title Any existing errata can

be viewed by selecting your title from http://www.packtpub.com/support

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media At Packt,

we take the protection of our copyright and licenses very seriously If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy

Please contact us at copyright@packtpub.com with a link to the suspected pirated material

We appreciate your help in protecting our authors, and our ability to bring you valuable content

Questions

You can contact us at questions@packtpub.com if you are having a problem with any aspect of the book, and we will do our best to address it

Trang 16

Setting Up a Development Environment

In this chapter, we will cover:

f Selecting your virtual environment

f Installing and configuring Windows Server 2008 R2

f Installing and configuring SQL Server 2008 R2

f Installing and configuring SharePoint Server 2010

f Installing Microsoft Office 2010 Professional

f Installing Visio Premium 2010

f Installing SharePoint Designer 2010

f Installing recommended developer tools

f Setting up your first web application

Introduction

Before one can consider himself/herself a true SharePoint 2010 developer, you must be

capable of creating your very own development environment Rather like the Jedi requirement

of crafting your very first light saber; ok, it's not really that mystical, or that difficult to do, but I assure you that you will find the experience highly gratifying

Trang 17

This chapter will take you through all the recipes that you require to build your very own development environment This will be done in a step-by-step manner, via the suggested best practice of using a Windows Server 2008 R2 server as the base operating system running on

This chapter is not meant to be followed as a guide for building any type of production

server - for example, it does not follow best practices for database naming or service

accounts; having SQL and/or Active Directory on the same box; PowerShell automation, and so on It may not be sufficient as a development standard in your organization, so

please consult with your IT department before doing real SharePoint development for

your clients

What if you have the Windows 7 64-bit version? Can you install and run SharePoint Server

2010 and all other required software and tools? Absolutely you can! Please use your favorite search engine to seek out the instructions to do so However, I don't recommend it in practice, unless you have no other choice SharePoint is a server-based piece of software, and installing this on your desktop will inflict a heavy price on performance due to the many services (such

as Search) that SharePoint will want to run frequently! There are scripts out there that help

shut down and start up these SharePoint services to help you out However, I personally like

the convenience of isolating SharePoint 2010 and related development activities to a virtual

machine You can completely shut this down and put it away for when you need it—by literally

putting it on an external drive Also, I find myself developing solutions for many different clients and projects, and in fact, I have set up a virtual machine for each project, so that, in future, I can pick up the project for that client from exactly where I left it, by simply firing up the

corresponding virtual environment

We will be covering selection of a virtual environment in the next section However, I thought I would mention that if you have a Windows Server 2008 R2 operating system on hand capable

of running Hyper V, then you have the option of bypassing a full build, and downloading the Information Worker virtual machine, fully configured with SharePoint 2010, Visual Studio, and

even FAST Search Use your favorite search engine to find information worker vm download

Follow the instructions to download, set up, and activate this virtual machine on a trial basis (180 day maximum life span)

Trang 18

Presuming you are still reading, you have decided that building your own virtual environment

is the way to go So let's get to it! I urge you to be patient during this task — this chapter will take a couple of days for you to complete, as you download many GBs of software and wait patiently through sometimes long installation processes

For the software that you will require throughout this chapter, you have two main choices:

1 Preferred: If you or the company that you work for has, access to a Microsoft

Developer Network (MSDN) subscription, then you can download the required software that provides you with the corresponding activation keys The main

advantage of this approach is that your virtual environment will be permanent

and licensed, thus you don't have to worry about the software expiring

2 Alternative: Every single software product mentioned in this chapter is available for download on a trial basis from the Microsoft site The main disadvantage of this approach is that each and every piece of software has a different trial use period Many have the ability to extend the trial period, but eventually the environment will

be rendered effectively inoperable and you will have to build the environment again

from scratch Also, note that the environment is not a properly licensed version, and

is therefore only for trial, exploration, and evaluation uses

Selecting your virtual environment

Prisoners serving life sentences (in Canada) have what is known as a faint hope clause where

you have a glimmer of a chance of getting parole after 15 years However, those waiting for

Microsoft to provide us a version of Virtual PC that can run Virtual Hard Drives (VHDs) hosting

64-bit operating systems (such as Windows Server 2008 R2), have no such hope of ever seeing that piece of software But miracles do happen, and I hope that the release of a 64-bit capable Virtual PC renders this section of the chapter obsolete If this has in fact happened,

go with it and proceed to the following section

Getting ready

Head into your computer's BIOS settings and enable the virtualization setting The exact setting you are looking for varies widely, so please consult with your manufacturer's

documentation This setting seems universally defaulted to off, so I am very sure you will

need to perform this action

Trang 19

How to do it

Since you are still reading, however, it is safe to say that a miracle has not yet happened Your first task is to select a suitable virtualization technology that can support a 64-bit guest operating system The recipe here is to consider the choices in this order, with the outcome of your virtual environment being selected:

1 Microsoft Virtualization: Hyper-V certainly has the ability to create and run Virtual Hard Disks (VHDs) with 64-bit operating systems It's free—that is, you can install the Hyper-V role, but it requires the base operating system to be Windows Server 2008 R2 It can

be brutal to get it running properly on something like a laptop (for example, because

of driver issues) It won't be a good idea to get Windows 2008 Server running on a laptop, primarily because of driver issues I recommend that if your laptop is running

Windows 7, look at creating a dual boot, and a boot to VHD where this other boot option

/ partition is Windows Server 2008 R2 The main disadvantage is coming up with an (preferably licensed) installation of Windows Server 2008 R2 as the main computer operating system (or as a dual boot option) Or perhaps your company runs Hyper-V on their server farm and would be willing to host your development environment for you? Either way, if you have managed to get access to a Hyper-V server, you are good to go!

2 VMware Workstation: Go to http://www.vmware.com and download my absolute favorite virtualization technology—VMware Workstation—fully featured, powerful, and can run on Windows 7 I have used it for years and love it You must of course pay for

a license, but please believe me, it is a worthwhile investment You can sign up for

a 30 day trial to explore the benefits Note that you only need one copy of VMware Workstation to create a virtual machine Once you have created it, you can run it anywhere using the freely available VMware Player

3 Oracle Virtual Box: Go to http://www.virtualbox.org/ and download this free software that will run on Windows 7 and create and host 64-bit guest operating systems The reason that this is at the bottom of the list is that I personally do not have experience using this software However, I have colleagues who have used it and have had no problems with it Give this a try and see if it works as equally well

as a paid version of VMware

With your selected virtualization technology in hand, head to the next section to install and configure Windows Server 2008 R2, which is the base operating system required for an installation of SharePoint Server 2010

Installing and configuring Windows Server

2008 R2

SharePoint 2010 requires the Windows Server 2008 R2 operating system in order to run In this recipe, we will configure the components of Windows Server 2008 necessary in order to get ready to install SQL Server 2008 and SharePoint 2010

Trang 20

Getting ready

Download Windows Server 2008 R2 from your MSDN subscription, or type in windows server

2008 R2 trial download into your favorite search engine to download the 180-day trial from

the Microsoft site

This book does not cover actually installing the base operating system The specific

instructions to do so will be dependent upon the virtualization software selected as per the

Selecting your virtual environment recipe Generally, it will be provided as an ISO image

(the file extension will be iso) ISO means a compressed disk image, and all virtualization

software that I am aware of will let you mount (attach) an ISO image to the virtual machine as

a CD Drive This means that when you elect to create a new virtual machine, you will normally

be prompted for the ISO image, and the installation of the operating system should proceed in

a familiar and relatively automated fashion

So for this recipe, ready means that you have your virtualization software up and running, the

Windows Server 2008 R2 base operating system is installed, and you are able to log in as the

Administrator (and that you are effectively logging in for the first time)

How to do it

Log in as the Administrator You will be prompted to change the password the first time—I

suggest choosing a very commonly used Microsoft password—Password1 However, feel

free to select a password of your choice, but use it consistently throughout this chapter

The Initial configuration tasks screen will come up automatically On this screen:

1 Activate windows using your 180 day trial key or using your MSDN key

2 Select Provide computer name and domain Change the computer name to a

simpler one of your choice In my case, I named the machine OPENHIGHWAY Leave

the Member of option as Workgroup The computer will require a reboot

3 In the Update this server section, choose Download and install updates Click on

the Change settings link and select the option Never check for updates and click

OK Click the Check for updates link The important updates will be selected Click

on Install Updates Now is a good time for a coffee break! You will need to reboot

the server when the updates complete

4 In the Customize this server section, click on Add Features Select the Desktop

Experience, Windows, PowerShell, Integrated, Scripting, and Environment options

Choose Add Required Features when prompted to do so Reboot the server when

prompted to do so

If the Initial configuration tasks screen appears now, or in the future, you may now select

the checkbox for Do not show this window at logon We will continue configuration from the

Server Manager, which should be displayed on your screen If not, launch the Server Manager

using the icon on the taskbar

Trang 21

We return to Server Manager to continue the configuration:

OPTIONAL: Click on Configure Remote Desktop if you have a preference for accessing your virtual machine using RemoteDesktop

(RDP) instead of using the virtual machine's console software

1 In the Security Information section, click Go to Windows Firewall Click on the Windows Firewall Properties link From the dialog, go to each of the tabs, namely, Domain Profile, Private Profile, and Public Profile and set the Firewall State to Off on each tab and click OK

2 Click on the Server Manager node, and from the main screen, click on the Configure

IE ESC link Set both options to Off and click OK

3 From the Server Manager, expand the Configuration node and then expand Local Users and Groups node, and then click on the Users folder Right-click on the Administrator account and select Properties Select the option for Password never expires and click OK

4 From the Server Manager, click the Roles node Click the Add Roles link Now, click

on the Introductory screen and select the checkbox for Active Directory Domain Services Click Next, again click on Next, and then click Install After completion, click the Close this wizard and launch the Active Directory Domain Services Installation Wizard (dcpromo.exe) link Now, carry out the following steps:

‰ From the new wizard that pops up, from the welcome screen, select the checkbox Use advanced mode installation, click Next, and again click on Next on the Operating System Compatibility screen

‰ Select the option Create a new domain in a new forest and click Next

‰ Choose your domain (FQDN)! This is completely internal to your

development server and does not have to be real For book purposes,

I am using theopenhighway.net, as shown in the following screenshot Then click Next:

Trang 22

‰ From the Set Forest Functional Level drop-down, choose Windows Server

2008 R2 and click Next

‰ Click Next on the Additional Domain Controller Option screen Select Yes on the Static IP assignment screen Click Yes on the Dns Delegation Warning screen

‰ Click Next on the Location for Database, Log Files, and SYSVOL screen

‰ On the Directory Services Restore Mode Administrator Password screen, enter the same password that you used for the Administrator account, in my case, Password1 Click Next

‰ Click Next on the Summary screen

‰ Click on the Reboot On Completion screen Otherwise reboot the server after the installation completes

5 You will now configure a user account that will run the application pools for the

SharePoint web applications in IIS From the Server Manager, expand the Roles node Keep expanding the Active Directory Domain Services until you see the

Users folder Click on the Users folder Now carry out the following:

‰ Right-click on the Users folder and select New | User

‰ Enter SP_AppPool in the full name field and also enter SP_AppPool in the user logon field and click Next

‰ Enter the password as Password1 (or the same as you had selected for the Administrator account) Deselect the option for User must change password

at next logon and select the option for Password never expires Click Next and then click Finish

Trang 23

6 A loopback check is a security feature to mitigate against reflection attacks,

introduced in Windows Server 2003 SP1 You will likely encounter connection issues with your local websites and it is therefore universally recommended that you disable the loopback check on a development server This is done from the registry editor:

‰ Click the Start menu button, choose Run…, enter Regedit, and click OK to bring up the registry editor

‰ Navigate to HKEY_LOCAL_MACHINE | SYSTEM | CurrentControlSet | Control | Lsa

‰ Right-click the Lsa node and select New | DWORD (32-bit) Value

‰ In the place of New Value #1 type DisableLoopbackCheck

‰ Right-click DisableLoopbackCheck, select Modify, change the value to 1, and click OK

Congratulations! You have successfully configured Windows Server 2008 R2 and are ready

for our next recipe Installing and configuring SQL Server 2008 R2

There's more

The Windows Shutdown Event Tracker is simply annoying on a development machine To turn this feature off, click the Start button, select Run…, enter gpedit.msc, and click OK Scroll down, right-click on Display Shutdown Event Tracker, and select Edit Select the Disabled option and click OK, as shown in the following screenshot:

Trang 24

Installing and configuring SQL Server

2008 R2

SharePoint 2010 requires Microsoft SQL Server as a fundamental component of the overall SharePoint architecture The content that you plan to manage in SharePoint, including web content and documents, literally is stored within and served from SQL Server databases The SharePoint 2010 architecture itself relies on information stored in SQL Server databases, such

as configuration and the many service applications In this recipe, we will install and configure the components of SQL Server 2008 necessary to install SharePoint 2010

Getting ready

I do not recommend SQL Server Express for your development environment, although this

is a possible, free, and valid choice for the installation of SharePoint 2010 In my personal experience, I have valued the full power and flexibility of the full version of SQL Server as well

as not having to live with the constraints and limitations of SQL Express Besides, there is another little reason too! The Enterprise edition of SQL Server is either readily available with your MSDN subscription or downloadable as a trial from the Microsoft site

Download SQL Server 2008 R2 Enterprise from your MSDN subscription, or type in sql server

2008 enterprise R2 trial download into your favorite search engine to download the 180-day

trial from the Microsoft site

Trang 25

For SQL Server 2008 R2 Enterprise, if you have MSDN software, then you will be provided with an ISO image that you can attach to the virtual machine.

If you download your SQL Server from the Microsoft site as a trial, extract the software (it

is a self-extracting EXE) on your local machine, and then share the folder with your virtual machine Finallly, run the Setup.exe file

Trang 26

4 You will be presented with the SQL Server 2008 R2 Setup screen On the first screen, you can select an evaluation or use your product key (from, for example, MSDN) and then click Next.

5 Accept the terms in the license, but do not check the Send feature usage data

to Microsoft checkbox, and click Next

6 On the Setup Support Files screen, click Install All tests will pass except for a warning that you can safely ignore (the one noting we are installing on a domain controller), and click Next, as shown in the following screenshot:

7 On the Setup Role screen, select SQL Server Feature Installation and click Next

8 On the Feature Selection, as shown in the following screenshot, carry out the

following tasks:

‰ In Instance Features, select Database Engine Services (and both

SQL Server Replication and Full Text Search), Analysis Services, and Reporting Services

‰ In Shared Features, select Business Intelligence Development Studio, Management Tools Basic (and Management Tools Complete), and

Microsoft Sync Framework

Trang 27

‰ Finally, click Next.

9 On the Installation Rules screen, click Next

10 On the Instance Configuration screen, click Next

11 On the Disk Space Requirements screen, click Next

12 On the Server Configuration screen:

‰ Set the Startup Type for SQL Server Agent to be Automatic

‰ Click on the button Use the same account for all SQL Server services Select the account NT AUTHORITY\SYSTEM and click OK

‰ Finally, click Next

13 On the Database Configuration Engine screen:

‰ Look for the Account Provisioning tab and click the Add Current User button under Specify SQL Server administrators

‰ Finally, click Next

Trang 28

14 On the Analysis Services Configuration screen:

‰ Look for the Account Provisioning tab and click the Add Current User button under Specify which users have administrative permissions for Analysis Services

‰ Finally, click Next

15 On the Reporting Services Configuration screen, select the option to Install

but do not configure the report server Now, click Next

16 On the Error Reporting Screen, click Next

17 On the Installation Configuration Rules screen, click Next

18 On the Ready to Install screen, click Install

19 Your patience will be rewarded with the Complete screen! Finally, click Close The Complete screen is shown in the following screenshot:

20 You can close the SQL Server Installation Center

Trang 29

21 Configure SQL Server security for the SP_AppPool account:

‰ Click Start | All Programs | SQL Server 2008 R2 | SQL Server

Management Studio

‰ On Connect to server, type a period (.) in the Server Name field and

click Connect

‰ Expand the Security node

‰ Right-click Logins and select New Login

‰ Use the Search function and enter SP_AppPool in the box Enter object name to select Click the check names button and then click OK In my case, you see the properly formatted THEOPENHIGHWAY\SP_AppPool in the login name text box

‰ On the Server Roles tab, ensure that the dbcreator and securityadmin roles are selected (in addition to the already selected public role)

‰ Finally, click OK

Congratulations! You have successfully installed and configured SQL Server 2008 R2 Enterprise

and are ready for our next recipe Installing and configuring SharePoint Server 2010.

Installing and configuring SharePoint

Server 2010

We are ready to get to the main event of the chapter! In this recipe, we deal with the

installation and configuration of SharePoint 2010 itself

Getting ready

Download SharePoint Server 2010 from your MSDN subscription, or type in sharepoint server

2010 trial download into your favorite search engine to download the 180-day trial from the

Microsoft site

There are a few pre-requisites that need to be in place before the actual installation of SharePoint 2010 So, let us prepare a few ingredients for our recipe in advance

From Internet Explorer in the virtual machine:

1 Use your favorite search engine to find ado.net data services update for net

framework 3.5 sp1 Look for the Download Details link, which should be the

first result (on the Microsoft site) This update is required in order to enable the REST–based data services that SharePoint 2010 relies upon

2 Look for the x64 version and download it from the Microsoft site to the desktop of the virtual machine Now, launch the installation

Trang 30

3 Click Yes when prompted with Do you want to install the following Windows

software update?, which is shown in the following screenshot:

It is now time for our second coffee break Click Close after the Installation Complete screen

appears We are nearly there! We are going to get into the SharePoint 2010 setup in order to

install the required pre-requisites If you have the MSDN software, you will be provided with an

ISO image that you can attach to the virtual machine If you downloaded it from Microsoft as a

trial, download it to your virtual machine settings and sharing a folder from the host machine

Double-click the EXE file to launch the installation Ensure your virtual machine has internet

connectivity (test by using Internet Explorer to navigate to http://www.microsoft.com)

Run Splash.hta

Installing the SharePoint 2010 pre-requisites:

1 Click on the Install Software Prerequisites link Once you click on this link, you will

see the following screen:

Trang 31

2 On the Microsoft SharePoint 2010 Products Preparation Tool - Welcome screen, click Next.

3 On the License Terms for Software Products screen, select the I accept the terms

of the License Agreement(s) checkbox and click Next

4 It is now time for our third coffee break Watch for any prompts to reboot the server

5 On the Installation Complete screen, click Finish

Now, let's get to the main recipe for which you have patiently been waiting for!

How to do it

Here is your recipe to install SharePoint 2010:

1 From the virtual machine CD Drive, run Splash.hta

2 Click on the Install SharePoint Server link

3 On the Enter your product key screen, enter either your MSDN software key or your trial license key

4 On the Read the Microsoft Software License Terms screen, select the checkbox I accept the terms of this agreement and click on Continue

5 On the Choose a file location screen, click Install Now The Installation Progress screen will show the proceeding of the installation

6 Fourth coffee break? You might want to consider switching to decaf

7 Note! This is a good time to actually take a snapshot of your virtual machine (or back it up), as this can be a good a starting point if in the future you have

to set up another separate development machine

8 When you see the Run Configuration Wizard, leave the checkbox Run the

SharePoint Products Configuration Wizard selected and click Close

9 On the SharePoint Products Configuration Wizard or the Welcome screen, click Next

10 Click Yes to the warning regarding services that may need to be restarted

11 On the Connect to a Server Farm screen, choose the option to Create a new server farm and click Next

12 On the Specify Configuration Database Settings screen, specify your machine name in the Database Server text field Use the SP_AppPool account, which was previously set up, and specify your password in the Password field of the Database Access Account section and click Next

Trang 32

13 On the Specify Farm Security Settings screen, choose a passphrase of Password1 (or the same as you have used for the Administrator account) and click Next.

14 On the Configure SharePoint Central Admin Web Application Page, select

the checkbox Specify port number and enter the value 9999 (or a different port

number of your preference) Leave the default authentication provider as NTLM and click Next

15 On the Completing the SharePoint Products Configuration Wizard, click Next

16 You are probably sick of coffee by now Please take the time to check your e-mail, voice messages, Facebook, Twitter, and Linked In

17 On the Configuration Successful screen, click Finish

Configure SharePoint 2010 via the Initial Farm Configuration Wizard:

1 Internet Explorer will open and navigate to the adminconfigintro.aspx page in Central Administration or the Initial Farm Configuration Wizard

2 On the Help make SharePoint better screen, select the option No, I don't wish to participate and click OK

Trang 33

3 On the How do you want to configure your SharePoint farm? screen, click on Start the Wizard.

4 On the next screen in the Service Account, select Use existing managed account and ensure that the SP_AppPool account is selected In the Services section, de-select Access Services and Word Automation Services and click Next

5 You are almost there! Reward yourself with a quick online match in your favorite game on your favorite console while you wait for the configuration to complete

6 The wizard will have created a web application using the machine name, in my case,

http://openhighway You now get to create your very first Site Collection Choose

a title based on your company name (in my case, The Open Highway), choose the Team Site template and click OK, as shown in the following screenshot:

7 Your hard and patient work is rewarded with the This completes the Farm

Configuration Wizard screen!

Trang 34

8 Click on the Site URL to open and test that your new Team Site (and therefore SharePoint 2010) is operating correctly DO NOT DESPAIR OR PANIC if you receive

a rather nasty looking Error screen!

9 Many times in a development machine, depending on the resources assigned to it and the power of the desktop/laptop you are running with - navigation to the URL will simply TIME OUT Breathe deeply Refresh the browser See! There is your Team Site Congratulations! Bookmark this URL in your Internet Explorer favorites The following screenshot shows my Team Site:

Trang 35

Congratulations! You have successfully installed and configured SharePoint Server 2010 and are ready for our next step – to install Microsoft Office and your development tools.

There's more

From the home page of your Team Site, click on the Site Actions menu and select More Options If you are prompted with the following screen with the Install Microsoft Silverlight link, then click on the link and take the opportunity now to install it! The user interface of SharePoint 2010 relies on Silverlight in many cases:

Trang 36

When the Silverlight install downloads, click Run on the security warning on the Install Silverlight dialog and then click Install Now, as shown in the following screenshot:

Installing Microsoft Office 2010 Professional

SharePoint 2010 is tightly integrated with, and was specifically designed to exploit, Microsoft Office 2010 So Office 2010 is a key tool for you to leverage in your SharePoint 2010 solutions, such as Word, Excel, and so on Together with Visio and SharePoint Designer, these

applications will be an important part of your development toolkit

Getting ready

Download Microsoft Office 2010 Professional Plus from your MSDN subscription, or type in

Microsoft office 2010 professional plus trial download into your favorite search engine to

download the 60-day trial from the Microsoft site

Wherever the software comes from, it will be presented as an EXE file Make the file available

to your virtual machine, for example, by going to your virtual machine settings and sharing a folder from the host machine Or you could choose to download the software directly to your

VM environment Double-click the EXE file to launch the installation

How to do it

Here is the recipe to install Microsoft Office Professional Plus 2010:

1 On the first screen, enter your product key (either MSDN or trial key)

2 Accept the terms of the license agreement and click Continue

3 On the Choose the installation you want screen, click Customize

Trang 37

4 (Recommended) On the next screen, Installation Options tab, mark Microsoft Access, Microsoft OneNote, Microsoft Outlook, and Microsoft Publisher as Not Available / not installed (red mark) You can always install these later if you wish

to experiment with these applications with SharePoint Finally, click Install Now

5 Click Close when the installation completes

6 We want to take a moment to initialize Office From the Windows Start menu, launch Microsoft Word

7 On the Help protect and improve Microsoft Office screen, select the option Don't make changes and click OK

8 Take the opportunity to activate Office if this has not been (automatically)

done already

9 On the File tab in the ribbon, select Options On the Word Options screen, select Trust Center on the left-hand side Click the Trust Center Settings button On the Trust Center screen, select Protected View on the left-hand side, as shown in the following screenshot Deselect the first three checkboxes and click OK twice:

Trang 38

10 Close Microsoft Word.

Congratulations! You have installed Microsoft Office Professional Plus 2010

Installing Visio Premium 2010

Here we will install Visio 2010, and later in this book, we will exploit the key new capability

to design SharePoint workflows

Getting ready

Download Visio Premium 2010 from your MSDN subscription, or type in visio premium 2010 trial download into your favorite search engine to download the trial from the Microsoft site

If you have the MSDN software, you will be provided with an ISO image that you can attach

to the virtual machine as a CD Drive In this case, run SETUP.EXE

If you downloaded from Microsoft as a trial, make the file available to your virtual machine, for example, by going to your virtual machine settings, and sharing a folder from the host machine In this case, run VisioSingleImage.exe

How to do it

Here is the simple recipe to install Visio 2010:

1 On the first screen, enter your product key (either MSDN or the trial key) for

Visio Premium

Note that the edition is important, as Premium is the version that contains the SharePoint Workflow template

Trang 39

2 Accept the terms of the license agreement and click Continue.

3 On the Choose the installation you want screen, click Install Now

4 Click Close when the installation completes

Congratulations! You have installed Visio Premium 2010

Installing SharePoint Designer 2010

In this recipe, we will install SharePoint Designer 2010 This is a powerful tool to create

no-code solutions for SharePoint, but it is also a critical tool for the developer to exploit all

of SharePoint's out-of-the-box capabilities before turning to code solutions in Visual Studio

Getting ready

SharePoint Designer 2010 is a FREE tool you can download from the Microsoft site and

install without the need for a license key Type sharepoint designer 2010 download into

your favorite search engine to download the software Make the file available to your virtual

machine, for example, by going to your virtual machine settings, and sharing a folder from

the host machine Otherwise, you could choose to download the software directly to your

virtual machine environment Double-click the EXE file to launch the installation

How to do it

Here is the simple recipe to install SharePoint Designer 2010:

1 Accept the terms of the license agreement and click Continue

2 On the Choose the installation you want screen, click Install Now

3 Click Close when the installation completes

Congratulations! You have installed SharePoint Designer 2010

Installing Visual Studio 2010

Visual Studio 2010 is, believe it or not, the very first version of Visual Studio to incorporate

a complete set of SharePoint 2010 development tools—ones that we of the SharePoint

development world have been longing for for many years You might overhear our excitement by

murmuring "Wow!" We can press F5 and then we can even debug our software! For those ASP.

NET developers who might be new to SharePoint development in 2010, you might say "Yeah,

so what?" Of course you can! To which we might reply "But you don't understand!!!" Anyway, I

digress, this could be the subject of another whole chapter about what we used to have to deal

with, which would add absolutely no value whatsoever to your task at hand today Suffice to

say, Visual Studio is your primary SharePoint customization platform that you will discover as

we go through the book For now, let us get this tool installed into your virtual environment

Trang 40

Getting ready

Download Visual Studio 2010 from your MSDN subscription—get the Ultimate version if you

have it, download the Professional version, or type Microsoft visual studio 2010 ultimate trial

into your favorite search engine to download the 30-day trial from the Microsoft site

Note that there is an option on the start page of Visual Studio to register the software and extend this trial for a further 60 days

Either way, you will be provided with an ISO image that you can attach to the virtual machine

as a CD Drive Run Autorun.EXE

How to do it

Here is the recipe for installing Visual Studio 2010:

1 On the Microsoft Visual Studio 2010 Setup screen, click on Install Microsoft Visual Studio 2010

2 Under the Help Improve Setup section, de-select Yes, send information about my setup experiences to Microsoft Corporation

3 Click the Next button when it is available

4 Click I have read and accept the license terms and click Next

5 Under Select features to install, select the Custom option and click Next

6 Deselect options for Visual Basic, Visual C++, Visual F#, Dofuscator, and SQL Server 2008 Express Finally, click Install

7 It's probably been long enough now, so have another coffee break and enjoy!

8 Click Finish when the installation completes and restart the server when prompted

9 When rebooted, you can exit the wizard

Congratulations! You have successfully installed Visual Studio 2010

How it works

You may now realize the point which we are at I will put forward to you that by my experience, the most effective development platform for the SharePoint 2010 developer is a standalone virtual machine, where Visual Studio is installed within a full server-based installation of SharePoint 2010 Only time will tell whether you agree with me!

Ngày đăng: 06/03/2014, 21:20

TỪ KHÓA LIÊN QUAN