soundofheaven.info Politics MICROSOFT SHAREPOINT 2010 DEVELOPMENT COOKBOOK PDF

Microsoft sharepoint 2010 development cookbook pdf

Thursday, April 11, 2019 admin Comments(0)

Development Series [PDF] [EPUB] SharePoint Development with a1e5bf3. minecraft village series book soundofheaven.info ebooks in PDF. soundofheaven.info Online Source Download and Free Ebook PDF Manual Reference. Microsoft-sharepointdevelopment-cookbook-musters-ed Sharepoint Development With Visual Studio (Microsoft Windows Development ebook PDF EPUB, book in english language.


Author: JARVIS ASUNCION
Language: English, Spanish, Hindi
Country: Maldives
Genre: Business & Career
Pages: 767
Published (Last): 31.08.2016
ISBN: 846-5-62400-567-2
ePub File Size: 19.34 MB
PDF File Size: 11.69 MB
Distribution: Free* [*Regsitration Required]
Downloads: 36924
Uploaded by: EMELY

Microsoft SharePoint Development Cookbook Over 45 recipes to take you from beginner to professional in SharePoint. Over 45 recipes to take you from beginner to professional in SharePoint Development with this book and ebook. Microsoft SharePoint development cookbook. Filesize: MB. Reviews. Extensive information for book fanatics. Better then never, though i am quite late.

Git and Github. The URL is the destination folder in the content database. You will see Contact under the List section: Table of Contents Chapter 1: I will refer to this site as the Chapter 2 URL in this chapter, for later purposes of creating Visual Studio projects.

Sign up here to get these deals straight to your inbox. Find Ebooks and Videos by Technology Android. Packt Hub Technology news, analysis, and tutorials from Packt.

Insights Tutorials. News Become a contributor. Categories Web development Programming Data Security. Subscription Go to Subscription. Subtotal 0. Title added to cart. Subscription About Subscription Pricing Login. Features Free Trial. Search for eBooks and Videos. Microsoft SharePoint development cookbook.

Over 45 recipes to take you from beginner to professional in SharePoint Development with this book and ebook. Are you sure you want to claim this product using a token? Ed Musters December Quick links: What do I get with a Packt subscription?

What do I get with an eBook? What do I get with a Video? Frequently bought together. Learn more Add to cart. Microsoft SharePoint Developer's Compendium: Paperback pages. Book Description 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!

Table of Contents Chapter 1: Setting Up a Development Environment. Chapter 2: SharePoint Development with Visual Studio.

Chapter 3: Web Part Development. Creating and deploying Web Parts with Visual Studio Chapter 4: Development with SharePoint Designer Chapter 5: Retrieving SharePoint data using the list data service. Chapter 6: External Data. Chapter 7: SharePoint Workflows.

Copying and extending out-of-the-box workflows with SharePoint Designer Using SharePoint Designer to implement Visio workflows. Chapter 8: Web Content Management. Authors Ed Musters. Ed holds all certifications in SharePoint , and has been teaching SharePoint development courses for many years. He has been a featured speaker at many international conferences, SharePoint Saturdays, and user groups.

Ed would very much enjoy the opportunity to share his real world expertise with you! Read More. Read More Reviews. Recommended for You. Oracle WebLogic Server 12c: First Look.

You have installed Visio Premium 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.

Type sharepoint designer 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. Here is the simple recipe to install SharePoint Designer You have installed SharePoint Designer Installing Visual Studio Visual Studio is, believe it or not, the very first version of Visual Studio to incorporate a complete set of SharePoint 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!

For those ASP. 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. 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. Run Autorun. Here is the recipe for installing Visual Studio Under the Help Improve Setup section, de-select Yes, send information about my setup experiences to Microsoft Corporation.

Click the Next button when it is available. Click I have read and accept the license terms and click Next. Under Select features to install, select the Custom option and click Next. Finally, click Install. It's probably been long enough now, so have another coffee break and enjoy!

Click Finish when the installation completes and restart the server when prompted. When rebooted, you can exit the wizard. You have successfully installed Visual Studio 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 developer is a standalone virtual machine, where Visual Studio is installed within a full server-based installation of SharePoint Only time will tell whether you agree with me!

Start up Visual Studio and select your preferred environment settings I choose the settings for Visual C developer. Note the startup screen has the option of Extending Visual Studio for an additional 60 days , in case you are using a trial version.

Installing recommended developer tools While Visual Studio certainly contains an excellent set of tools for the SharePoint developer, both Microsoft and the community at large are constantly providing you with further excellent sample code, utilities, and productivity aids. In this section, I recommend three key tools that you should have, and will direct you to a location where you can find more!

Here is the recipe for installing key SharePoint developer tools: Highly recommended is the SharePoint Guidance available at http: Highly recommended is the Community Kit for SharePoint.

It is a set of best practices, templates, Web Parts, tools, and source code that enables practically anyone to create a community website based on SharePoint technology for practically any group of people with a common interest. It is available from http: Highly recommended is the SharePoint Manager tool.

It is from http: You have successfully installed the key tools every SharePoint developer should have at hand. There are far too many excellent tools contributed by the community to be mentioned here, and more being created all the time.

Some will be useful to accelerate some very specific development task. The primary source is CodePlex at http: Search the site for SharePoint , or more generally, SharePoint as some tools support both the current and older versions of SharePoint. Setting up your first web application You are ready to start developing on SharePoint !

Well almost. I am going to strongly recommend a development approach for you. I ask for a moment of patience as I explain. The site collection in turn lives within a Web Application in IIS and that web application will have an associated content database literally, a SQL Server database that has been created to hold the content within the site collections of that web application. You may also know this as the SharePoint containment hierarchy.

Let's say that project is a new collaboration Intranet for the company The Open Highway. I want to host that on the URL http: So I'd like to create that very web application locally, including mimicking the URL I ultimately want to use.

That way, when I actually want to deploy my application, I'll be quite certain that it should operate perfectly well in the target environment. But why do I say your first web application? Did SharePoint not create for itself the first content database, web application, and site collection with a Team Site at its root? Why, yes it did, located at a URL that is your machine name. In my case, that would have been http: And the clarification is that SharePoint created that.

The key word here is your first web application. Use Windows Explorer to navigate to the directory C: Right-click on the Hosts file and select Open.

Copy and paste the three lines referring to the local intranet. Remove the hash marks from lines two and three and then replace the local host with your URL. The result will look as follows: Here is the recipe to create a new web application: From this screen, click on Manage Web Applications and the following screen will be displayed: In the ribbon, click on the New button.

Fill in the screen similarly to the following screenshot. Choose your own name for the web application. Scroll down the window. As shown in the following screenshot, in the Application Pool section, select the Use existing application pool and select the one that begins with SharePoint — In the Database Name and Authentication sections, change that unusably ugly GUID at the end of the database name to something meaningful.

Scroll down to the bottom of the window. Leave all the remaining settings at their default and click OK. Please wait while your changes are processed. Truer words have never been spoken. Please wait patiently until you see the Application Created screen. Click on the Create Site Collection link, as shown in the following screenshot: Scroll to the bottom of the window, enter the Administrator account as the Primary Site Administrator, and press OK, as shown in the following screenshot: You will be rewarded with the Top Level Site Successfully Created screen, as shown in the following screenshot: Don't forget!

If you get the dreaded Error screen, it is just a time out. Refresh the browser and you will see your site. You will be prompted to log in. We will fix this in a moment.

In the meantime, enter the Administrator and the password you chose in my case, Password1. There are a couple of small helpful clean up notes, but otherwise you are ready to code! Using the Tools menu drop-down, select Internet Options. Click on the Security tab and click on the Local Intranet icon, as shown in the following screenshot: Then click Close and click OK thrice: The advantage? No more prompts to login! There are many other "out-of-the-box" SharePoint lists you can create such as Announcements, Contacts, Events calendar , Tasks, and more!

Lists are where we store our data in SharePoint. SharePoint Development with Visual Studio You should strive to use the out-of-the-box lists wherever possible. Next you should look to leverage an out-of-the-box list by "inheriting" from it and then customizing your own columns. If you wish, you may also create your own custom list from scratch.

A list is composed of columns — collectively they form the schema for the list. In SharePoint terms, the schema is called a Content Type, and the individual columns within the schema are called Site Columns. If you have relational database expertise such as with Microsoft SQL Server , the concepts introduced here will be familiar to you. Site Columns are equivalent to data types. Running the script will create a physical table instance as determined by the schema.

The proper creation, deployment, and management of SharePoint lists and schema is an important focus of the professional SharePoint developer. I cannot think of a better example to introduce all of the basics in such a way that you will be returning to this chapter again and again for guidance!

We will be using the awesome Visual Studio SharePoint tools to create a custom document library for Proposals. The "Proposal" will be implemented with a Content Type and Site Columns , and inherit from the out-of-the-box "document", and attached to the document library.

We will also be exploring the practical use of more advanced techniques: This forms one of the most common "professional" patterns for a SharePoint developer! Create Site Columns 2. Create Content Types 3. Create SharePoint list and attach Content Types 4. Provision with Feature Receivers and Feature Staplers 5. Control list events with Item Event Receivers This chapter will walk through the components of this pattern. Ensure the correct web application is selected. Leave all other options at their default values.

Scroll to the bottom and click on Ok. Bookmark the site to your favorites. I will refer to this site as the Chapter 2 URL in this chapter, for later purposes of creating Visual Studio projects.

For example, in my case, this URL is: Choose the type Contacts, enter name as MyContacts and click on Create.

After the creation of the MyContacts list, you should automatically be navigated to the new list. From the ribbon, choose the Items tab from List Tools. Select the New Item drop-down. Specifically, note that you are creating a "new contact".

I added last name "Munster", first name "Eddy" yes, from the 60's television show. Click on the Save button: Now we are going to use the Contacts list as an example for demonstrating all the SharePoint components Microsoft used in putting this type of list together. First we look behind the scenes of the MyContacts list: Navigate to the MyContacts list by clicking the link in Quick Launch left-hand navigation.

In the ribbon, you will see List Tools. Click on the List tab. Click on List Settings in the ribbon. Let us enable a "behind the scenes" view! Click on Advanced Settings. Click on Yes to Allow management of content types. Scroll down and click on OK to save this setting: If you scroll down, you will now see a Content Types section has become visible.

Note that the Content Type — Contact is assigned to the list: These site columns are part of the Contact content type. The columns in the MyContacts list were created as a result of the schema defined in the Contact Content Type.

From the Site Actions menu, choose Site Settings. Note the Galleries section: Click on Site content types and note the rather extensive selection available.

You will see Contact under the List section: Click on Contact and it will take you to the details screen. From the Galleries section, click on Site Columns. A very long list appears but I would encourage you to review and become familiar with it — you should always consider using an existing Site Column instead of "duplicating" something very similar for your own use.

If we wish to follow "best practice" when creating our own Proposals document library, then it should be similarly backed by a Proposal Content Type that contains some out-of-the-box Site Columns and custom Site Columns. As an exercise, repeat this recipe again, but this time try using the Shared Documents library in the Chapter 2 site. Features and Solutions If you have professionally developed any type of application, then you must have had the requirement to "deploy" it.

For example, if you are developing a Windows desktop application, you may have been asked to create a setup. Or perhaps you have experience with using MSI windows installer files. Regardless, when it is time to hand off your application to others you must "package" it for deployment. NET web application, so SharePoint understands special installer files called Solutions creative name, right?

SharePoint solution files have the extension. The great news is that Visual Studio will automatically "package" your SharePoint customizations in WSP format — ready for you to deploy it to the world of SharePoint!

I will explain the term "Feature" in more detail in one moment, but your goal throughout the remainder of this chapter will be to: Package these two Features into a SharePoint Solution file. We will be proceeding to create the example, but at various points in the chapter, you will see the There's more section that will take you behind the scenes on what is happening with our Features and Solution.

Here, we will explore how Microsoft implemented the Contacts Content Type and list schema. To explore Features from the SharePoint site perspective, go to the Chapter 2 site: From the Site Actions menu, select Site Settings. Here, you can see that Microsoft itself has created a number of Features for SharePoint.

The Activate and Deactivate buttons are simply a means of being able to turn the features on or off. Team Collaboration Lists is a feature that enables your ability to create all of the out-of-the-box lists, including a Contact list: Go ahead and click on the Deactivate button for the Team Collaboration Lists feature. You may accept the warning that will pop up! Nothing "bad" will happen. Now go to Site Actions More Options.

You will find all of the out-of-the-box lists gone — you cannot select them to create them. Announcements, Contacts, Document Library, and so on. Go back to Site Actions Site Settings. Verify using Site Actions More Options that the list choices have returned. To explore Features from the physical implementation perspective, we need to examine the SharePoint installation folder.

This is also referred to as the SharePoint Root folder. Open windows explorer and navigate to: Go to the Template sub-folder. Then underneath to the Features folder. From one perspective, SharePoint is a composition of a long list of Features — customizations and extensions that Microsoft has created for the product. Find the TeamCollab folder and navigate to it. Inside you will find a Feature. One of the purposes of this file is to describe the feature with a title, description, and icon.

In this case, it displays the title Team Collaboration Lists and description Provides team collaboration capabilities…". Navigate back up to the Features folder. Towards the top, go to the ContactsList sub-folder. Explore and you will find a feature. We have explored Features from these two perspectives because, as a SharePoint developer, it will be your role to create new Features that get deployed to the SharePoint servers and will appear in the Feature list alongside the Microsoft provided ones!

In our case, building up a SharePoint Solution as described in the introduction to this section. First, please look at the rather extensive set of Site Columns you get "out-of-the-box" and please feel free to reuse them instead of duplicating something similar. In our case, we will be defining a document library to hold our proposals. We are going to define the following additional Site Columns that we require: Number ff Proposal Client: Single line of text ff Proposal Type: Choice field For simplicity of the example, the client is a single line of text.

This could have been another long list the client list and we could then define a "lookup" to be able to choose the client for example, from a drop-down menu for the proposal. Getting ready We will create the Visual Studio project that we will be working with in this chapter: Open Visual Studio From the File menu, select New Project.

We will be taking advantage of some of these in the future chapters, such as the Visual Web Part in the next chapter: Provide a name such as ProposalSiteColumns. Take a moment to view all of the available project items. There is not one specifically for Site Columns, but shortly we will be taking advantage of the items for Content Type and for List Definition.

Click on Add: You will see that a Feature was added called Feature1! We will review this in more detail later. For now, right-click on the node that says Feature1 and select Rename. Change the name to ProposalLibrary. Change the Title to something more meaningful — such as Proposal Library — as well as the Description.

It is professional to add an icon image to your Feature. Target an image size around 32 x 32, although this is not strict for dimension. Typically, you may choose a company logo or such. To add the image to your Feature: Right-click on your project and choose Add SharePoint Images mapped folder.

Click on the SPProposalLibrary folder that was created. Right-click on the folder and select Add Existing Item. Navigate to the location for your image. Double-click on the ProposalLibrary Feature to expose the properties window. Locate the Image URL property and type in the path and image relative to the images folder.

Get ready to generate GUIDs! The following screen will appear. Select the Registry Format. Go ahead and "copy" a GUID now. Ok, this is not the most exciting development you will do in your lifetime, as you will simply be hand typing some XML: Enter the following XML.

You can type in these very GUIDs, or you can generate your own in place of the ones provided: Wait until you see the Deploy Succeeded message in the bottom left-hand corner of Visual Studio. Let us go and verify that our Feature had been deployed and our Site Columns are defined. Navigate to the Chapter 2 site. Select Site Actions Site Settings. Notice that the Proposal Library is there and is activated: Select the Site columns link in the Galleries section.

Microsoft SharePoint 2010 Development Cookbook

Scroll down and you will see our three custom Site Columns in the Packt Publishing section: You have created your first real Feature with Visual Studio SharePoint developer tools; created some Site Columns, deployed them to the sample site, and activated the Feature. Here is some further information and explanation regarding Site Columns and the meaning of the Elements. More Site Column types While these are not all the possible types of columns you can create as Site Columns, here are some of the most common ones: In this case, instructions for creating several "Field" elements, also known as Site Columns.

As we examine more SharePoint items, you will see different types of instructions. There can be one or more Elements. Note that Elements.

However, the name can be one of your choice, and possibly more helpful such as ProposalSiteColumns. Packaging SharePoint Solutions Regardless of the type of Visual Studio Solution you develop — a regular web application or even a Windows application — eventually you will need to "package" it for the purpose of deploying it to another server or client computer. Such packaging is varied and may be a Cabinet. CAB file, a Microsoft Installer. MSI file, or a setup. Some summary points about SharePoint Solution files: We are going to explore the Packaging Designer: Double-click on the Package node in your Visual Studio project.

You can see literally in visual representation that the Proposal Library Feature is contained in our package — as well as the graphics files we deployed to SharePoint's Images directory: It is almost the dictionary definition of a manifest — primarily a list of files contained in the package and their respective deployment location relative to the SharePoint Root folder.

You can view the actual WSP file in the Bin folder of your project. Expand the Bin folder, and then expand the Debug sub-folder. Right-click on the SPProposalLibrary. Right-click on the Debug folder and select Paste. Your Solution should look as follows: We can see the files contained inside: So there is your behind the scenes look at how the SharePoint Solution package is created and what is "inside the box".

Here is some further explanation on what is going on behind the scenes with SharePoint Solutions and Solution deployment. How did my Feature get deployed and activated?

When you right-clicked on your Visual Studio project and selected Deploy Solution — you kicked off the Solution deployment lifecycle! Let us presume now that your Features are deployed. You make some changes and use Deploy Solution again. Then, it adds the new solution WSP file and "installs" it.

Next, the Visual Studio Solution deployment is kind enough to automatically activate the Feature for us, although technically that is an extra step. Go ahead and use Deploy Solution again. Then look at your output window to see the following: SPProposalLibrary, Configuration: Default Run Pre-Deployment Command: Skipping deployment step because a pre-deployment command is not specified.

Retract Solution: Retracting solution 'spproposallibrary. Deleting solution 'spproposallibrary. Add Solution: Adding solution 'SPProposalLibrary.

Sharepoint development pdf 2010 microsoft cookbook

Deploying solution 'SPProposalLibrary. Activate Features: Activating feature 'ProposalLibrary' Run Post-Deployment Command: Skipping deployment step because a post-deployment command is not specified. But what are "Deleting Solution" and "Adding Solution" actually doing? You can physically see all of the WSP files on the server and the current status of solution deployment from Central Administration.

Click on the SPProposalLibrary. You will see the following information: Creating new Content Types Now we are ready to create the schema for our Proposal Library — through a Content Type that will inherit from Document and extend it with our custom Proposal site columns.

The Content Type can also have associated a Microsoft Word template file, so that as you create a "New Proposal", Microsoft Word will come up and launch with a Proposal document template, instead of simply a blank document.

Getting ready Launch Microsoft Word and create a simple document to serve as your Proposal template. Save the file as ProposalTemplate. We must first actually take a copy of our ProposalTemplate. A file copy operation in SharePoint is accomplished via the "Module" provisioning instruction.

You will see an example of this instruction as follows: Select Module from the presented list, provide a name such as ProposalTemplate and click on the Add button.

Navigate to the location of the ProposalTemplate. In the ProposalTemplate section, you will see a sample. Right-click on sample. Edit the Elements. The URL is the destination folder in the content database.

Your Elements. Next we will implement a Proposal Content Type that features the Site Columns created in the last recipe, and attaches the Word Proposal template: Select Content Type from the presented list, provide a name such as Proposal and click on the Add button.

A dialog will come up. Choose Document from the drop-down in response to the question What base content type should this content type inherit from?

In the Elements. Change the Description attribute to something such as Create a new proposal from a template. Add the XMLDocuments node exactly as shown in the following example. This node will add standard New, Edit, and Display forms to the document library. Now, let us deploy the Solution and observe the results: Note that the Proposal Library is there and is activated same Feature as with the Site Columns recipe: Select the Site content types link in the Galleries section.

Scroll down and you will see our three custom site columns in the Packt Publishing section: Click on the Proposal Content Type, and note the Columns section includes the Site Columns we defined in a previous recipe: You have enhanced our Feature with Visual Studio SharePoint developer tools, created a Content Type SharePoint schema , deployed this to the sample site, and activated the Feature.

Creating document libraries with Content Types Now we are going to create an actual document library with the Proposal Content Type attached. Enter Proposal Document Library in response to the question What is the display name of the list definition?. Choose Proposal in the drop-down in response to the question What content type would you like to use for your list definition?. Ensure the checkbox is enabled for Add a list instance for this list definition, and click on the Finish button.

Expand this node to expose the Elements. Change the Title to Proposals. Finally, change the Description to Document Library to manage Proposals. Your Solution Explorer should now looks as follows: Note that the Proposal Library is there and is activated: Note that a Proposals link has appeared in the quick launch left-hand navigation under the Libraries section: Click on the Proposals link.

On the Documents tab of the ribbon, click on the drop-down New Document — and note the specific option to create a new "Proposal": Note the document that comes up starts with the defined template, and the "document information panel" shows the meta data for the document the Site Columns that were defined with the Content Type.

You have enhanced our Feature with Visual Studio SharePoint developer tools, created a list definition and list instance, deployed this to the sample site, and activated the Feature. More specifically, when you click on the Activate or Deactivate button. Feature Receivers are important as they provide you the opportunity to run any feature initialization that is required on Activate, and any clean up that is required on Deactivate.

In our case, we wish to do the following: Set the Management of Content Types setting for the the Proposals list so we can "see" that the correct Proposal Content Type is configured with the list. Code is the only way to accomplish changing this setting. Nothing happens to created lists, such as Proposals, when a Feature is deactivated.

We are going to make the decision, for the sake of our example, that when the feature is deactivated, then the Proposals list will be deleted.

In the ProposalLibrary.

Provide the following lines of code for the FeatureActivated method: Lists["Proposals"]; listProposalLibrary. Update ; 3. Provide the following lines of code for the FeatureDeactivating method: Parent as SPWeb; if site!

TryGetList "Proposals" ; if list! That was easy! Click on the Proposals link in the quick launch left-hand menu. From the Ribbon Library tab, select Library settings. This is an evidence that our Feature Activated code has executed. This should be clear, as we were working with the FeatureActivated method just a few minutes ago in the How to do it For the Proposal Library Feature, click on the Deactivate button.

You will get a warning You are about to deactivate the Proposal Library feature, click on the Deactivate this feature link. Note that the Active text disappears and the button has changed to Activate: Now we have evidence that our Feature Deactivating code has executed, as you will see that the Proposals document library no longer appears in the quick launch — it has been deleted.

You have seen so far in this chapter that much can be accomplished through declarative using XML provisioning instructions. Anything is possible as far as initialization and clean up goes with Feature Receivers. For example, you may have decided to pre-populate your list with sample data. You will find many examples in your future where you will want to take advantage of the powerful capabilities provided by Feature Receivers!

List Event Receivers A List Event Receiver, simply put is code that you the developer can choose to "attach" to one or more lists and that code will generally run when either you add, delete, or update items on a list. The functionality is provided by inheriting from the SPItemEventReceiver class and overriding one of the following key methods: The before events end in "ing", are trapped before the, say update, takes place, and can be cancelled.

The after events end in "ed" and will run after the list has been updated. Normally, if someone has the ability to add an item to a list, then they will have the ability to delete it. We wish to absolutely prevent anyone but the Site Collection Administrator from deleting items from the Proposal list.

This problem could be solved by created a "custom permission level" where we remove the Delete ability, but in this case we don't wish to rely on this having been done. We wish to simply guarantee that it cannot be done by anyone except the administrator. You will log out as the Administrator and log back in as this other user. If you do not currently have another "normal" user, then use the Active Directory Users and Groups to add someone of your choosing — and provide a consistent password such as "Password1" as we used in Chapter 1.

You must now also add the user to the "Members" group of the Chapter 2 site: Under the Users and Permissions section, select People and Groups.

2010 cookbook sharepoint microsoft pdf development

This should already default to being in the Chapter 2 Members group. Use the New drop-down and select Add Users. Use the Check Names button to verify. Click on OK. You should see something similar to the following: On the dialog that comes up, ensure the question What type of event receiver do you want? Ensure Proposal Document Library is selected in response to What item should be the event source?.

In the section Handle the following events, select An item is being deleted".

Microsoft SharePoint 2010 development cookbook

In the ProposalLibraryEventReceiver. ItemDeleting line of code: CancelWithError; properties. Note that CancelWithError will cause the action to be rejected — in this case it will trap and prevent the item from being deleted.

Click on the Proposals link in the quick launch left-hand navigation. On the Documents tab of the ribbon, click on the drop-down New Document and note the specific option to create a new "Proposal": Note the document that comes up starts with the defined template, and the "document information panel" shows the meta data for the document. Log out of Windows and log back in as the user created in the Getting ready section of this recipe: Click the Proposals link in the quick launch left-hand navigation.

You can either use the checkbox to select the Proposal and use the Delete Document button in the ribbon, or use the drop-down from the document name the "ECB" or Edit Control Block menu to attempt to delete the document: You will get the following error, which verifies that our List Item Event Receiver is working!

Log out as the user and back in as the Administrator. Navigate back to this document in the Proposals library of the Chapter 2 site. Verify, as the Site Administrator, that you can delete the document. The set of List Event Receivers forms another important "building block" towards creating a complete and professional solution for SharePoint lists and schema.

With Item Event Receivers, you can "guarantee" the behavior of your list as it is maintained — regardless of where it used, how it is used, or what security has been applied. Providing this consistency can be very important in meeting your requirements.

Microsoft SharePoint Development Cookbook - PDF Drive

Feature Staplers When a new team site gets created, note that several lists and libraries get created automatically. Shared Documents, Tasks, Announcement, Calendar, Links all exist because the site definition for a team site the provisioning instructions for creating the site included the creation of these lists. What if you wanted to include the automatic creation of a Proposals document library every time a team site was created? You may think to modify the out-of-the-box team site definition to accomplish this.

2010 microsoft cookbook pdf development sharepoint

You will introduce breaking changes if you do! You may then wish to create your own custom site definition, which can be a daunting and non-trivial task. So, by stapling the Proposal Library feature to the team site definition, we will accomplish the behavior that every time a team site is created, we will see a Proposals library. Select Module from the presented list, provide a name such as ProposalLibraryFeatureReceiver and click on the Add button.

Provide the following lines of XML to the Elements. A Feature Stapler took longer to explain than to actually do! The above line of code takes the GUIDs for our Features which you can look up in the properties of each feature to verify , and "attaches" them to the team site definition.

The short form "STS" comes from the "acronym" that is the directory name for the site definition. Note that the Libraries section now has a Proposals library! Feature Staplers are an excellent means of "adding" to an out-of-the-box site template and making it "your own".

As you can staple any Feature, literally the possible uses for this simple technique are endless. Web Parts are widgets or gadgets or otherwise small components of user interface functionality that you can flexibly incorporate into your web pages. NET's WebControls namespace. SharePoint has numerous out-of-the-box Web Parts that you can immediately incorporate on your page.

So, please first familiarize yourself with all of these Web Parts and their capabilities! I am continually surprised by the number of times I have seen new SharePoint developers create a Web Part from scratch that effectively recreates out-of-the-box Web Part functionality.

This chapter will be relevant for you if you have made the decision that you must create your own Web Part using Visual Studio Getting ready Carry out the following steps in order to create a site collection for this chapter: Ensure that the web application you created in Chapter 1, Setting Up a Development Environment is selected. Leave all the other options at their respective default settings.

Scroll to the bottom and click Ok. For example, in my case, this URL is http: Under the Lists sections, click on Announcements. Click on the Add new announcement link. Click Save and navigate back to the home page. On the Page tab in the ribbon, press Edit to get the page in edit mode.

Place your cursor at the end of the first paragraph at the centre of the page. Press Enter to go to a new line. In the ribbon, click on the Insert tab of the Editing Tools section.

Then click on Web Part in the Web Parts section of the ribbon. Your screen should now look similar to the following screenshot: What you are viewing is the gallery of available Web Parts by category. You should already be in the Lists and Libraries category with the Announcements list view Web Part highlighted.

Click on the Add button. Hover over the Announcements Web Part that is added on the title, as shown in the following screenshot. When you do, you will see a small drop-down arrow appear to the right of Announcements. Hover on the arrow itself, and it will turn light blue with a tool tip of Announcements Web Part Menu: Click on the drop-down arrow, and from the menu, select Edit Web Part: On the far-right-hand side is the Editor Zone section for the Web Part.

It shows all of the available properties for the Web Part and allows them to be changed. On the Page tab, click Save and Close. Your page should now look as follows: All of this will be important as we move on to create our own Web Parts! Please feel free to go back to the Web Part gallery and explore some other out-of-the-box Web Parts.

Do not forget to edit each Web Part to see what properties are available, and experiment with those as well. Creating and deploying Web Parts with Visual Studio The goal of this recipe is to build an understanding of how Web Parts are created using Visual Studio , and exactly how they are deployed into SharePoint.

Getting ready Carry out the following steps in order to create the Visual Studio project that we will be working with in this recipe: Repeat the preceding step to add another Web Part.

Your Solution Explorer should now look similar to the following screenshot: NET web control that does not have any user interface. If you wish to render UI, then you must do that yourself through code! Your choices with a Web Part in SharePoint include overriding one of the two provided methods: CreateChildControls or RenderContents. With CreateChildControls, you can literally create a control such as a Label or TextBox and add it to the controls collection.

Note that you should never override the Web Part's Render method because it is used internally by SharePoint and overriding it will break the rendering. Carry out the following steps in order to create code for each of the Web Part's C files: Here, we have created a Label, set its Text property, and then added it to the controls collection: Change the class to use the RenderContents method as follows: First, it points to the.

NET assembly—the code—for running the Web Part. Second, it provides a title and description for the Web Part. The contents of the Elements. We will check out the Web Part gallery in the user interface shortly. The only change to make at this time in both of the Elements. Here, I am changing it to Open Highway, but you can pick any value that you wish: Now it is time to see the results of our work!

Press F5. Click OK if prompted to modify the web. The Chapter 3 website will be displayed automatically. Put the home page in Edit Mode. Place the cursor above the Important Announcements Web Part. In the ribbon, select the Insert tab of the Editing Tools section. Click on Web Part in the Web Parts section of the ribbon. In the Categories section, click on the group you specified above its name in my case. Open Highway. The top part of your screen should now look as follows: Note that the Web Part title and description appear as we set them earlier!

Click Add. On the ribbon, select Insert Web Part again. In the ribbon, go back to the Page tab and click the Save and Close buttons. Your screen should look like the following screenshot: You have created and deployed your first Web Part in SharePoint ! Here are a few behind the scenes notes regarding SharePoint Web Parts.

Where did my Web Parts go? Note that if you end your debugging session, the web parts solution will be fully retracted.

You will notice the web parts "disappear" from the home page. View the output window from Visual Studio after closing the browser to see the following information: Retracting solution 'spwebpart. Deleting solution 'spwebpart. This is designed in such a way that you can continue the development and debugging of your Web Part. Instead, if you wish to make the Web Parts a permanent feature of your site collection, then right-click the project in the solution explorer of Visual Studio and click Deploy.

Select Site collection features under the Site Collection Administration section. Scroll down to see that the SPWebPart feature appears and is activated, as shown in the following screenshot: From the Galleries section, select Web Parts.

Scroll to the last page to see the Web Parts created: Select either of the Web Parts and click on the Edit icon. You will see the properties as you set them in Visual Studio in the. The Edit page is shown in the following screenshot: It is tedious to say the least to have to create the full user interface using CreateChildControls. Enter the Visual Web Part. So, you focus on visually creating your user interface, and let this project template take care of the rest for you!

I prefer to have something better named than the default VisualWebPart1, and it is easier to simply delete it. Right-click on the VisualWebPart1 node and select Delete. First, let us look at the difference in the Web Part's C file and carry out the following steps: Open AmazingVisualWebPart.