Download PDF Microsoft SharePoint 2010 development cookbook

Free download. Book file PDF easily for everyone and every device. You can download and read online Microsoft SharePoint 2010 development cookbook file PDF Book only if you are registered here. And also you can download or read online all Book PDF file that related with Microsoft SharePoint 2010 development cookbook book. Happy reading Microsoft SharePoint 2010 development cookbook Bookeveryone. Download file Free Book PDF Microsoft SharePoint 2010 development cookbook at Complete PDF Library. This Book have some digital formats such us :paperbook, ebook, kindle, epub, fb2 and another formats. Here is The CompletePDF Book Library. It's free to register here to get Book file PDF Microsoft SharePoint 2010 development cookbook Pocket Guide.

This book is written for the ASP. NET developer who wants to get to the goal of "professional" SharePoint developer as quickly as possible, by learning the most important practical aspects of development that will be used in the real world. Downloading the example code. Gettingready How to doit Installing and configuring Windows Server Development on the SharePoint platform is very different depending on which workload you are working with and whether your projects require structured and repeatable deployment or if you can customize things using SharePoint Designer.

Ed closes his book with, in my opinion, somewhat misplaced chapter presenting non-developer overview of Web Content Management capabilities of the SharePoint platform. Although the chapter sticks with the recipe format, considering the audience, the recipes should be developer-oriented instead only presenting WCM configuration capabilities of the SharePoint platform.

Microsoft SharePoint 2010 and Windows PowerShell 2 0 Expert Cookbook

The book is written with experienced ASP. 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: Feature Receivers, Event Receivers, and Feature Staplers.

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. 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. 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: 1.

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: 4. 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: 5. 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: 46 Chapter 2 8. Click on Site content types and note the rather extensive selection available.

What I got

You will see Contact under the List section: 9. 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: 1. 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: 1.

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: 5. 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.

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: ff Proposal Amount: 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: 1. 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: 3. 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: 6. 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.

  • Can We See the Invisible Mind of God? (FT Press Delivers Elements)?
  • The Politics of Family Size (Cato Unbound Book 52011);
  • Join Kobo & start eReading today.
  • My Shopping Bag.
  • Since Before You Were Born.

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: 1. 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. 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: 1. Enter the following XML. 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: 3. Select the Site columns link in the Galleries section. Scroll down and you will see our three custom Site Columns in the Packt Publishing section: Congratulations! 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. 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. We are going to explore the Packaging Designer: 1. 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: The Package Designer is a visual representation of a special file in the SharePoint Solution WSP that is the Manifest. 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: 5. 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. Retracting solution 'spproposallibrary. Deleting solution 'spproposallibrary. 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: 1. 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.

Microsoft SharePoint 2010 Development Cookbook–book review

The URL is the destination folder in the content database. Your Elements. 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. Note that the Proposal Library is there and is activated same Feature as with the Site Columns recipe : 3. 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: 4. Click on the Proposal Content Type, and note the Columns section includes the Site Columns we defined in a previous recipe: 64 Chapter 2 Congratulations!

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: Now, let us deploy the Solution and observe the results: 1.

Note that the Proposal Library is there and is activated: 66 Chapter 2 3. Note that a Proposals link has appeared in the quick launch left-hand navigation under the Libraries section: 4. 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": 5. 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: ff On Activate: 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. 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. Lists["Proposals"]; listProposalLibrary. Update ; 3. Parent as SPWeb; if site! TryGetList "Proposals" ; if list! That was easy! Now, let us deploy the Solution and observe the results: 1. Note that the Proposal Library is there and is activated: 3. 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: 3. 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 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: 1.

Under the Users and Permissions section, select People and Groups. 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: How to do it 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". In the ProposalLibraryEventReceiver. ItemDeleting line of code: if! CancelWithError; properties.

Account Options

Note that CancelWithError will cause the action to be rejected — in this case it will trap and prevent the item from being deleted. Note that the Proposal Library is there and is activated: 4. 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": 72 Chapter 2 5. 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: 1. 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: 73 SharePoint Development with Visual Studio 4. 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–book review - Waldek Mastykarz

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. You will introduce breaking changes if you do!

  1. Buddhism Made Simple (Complete Version);
  2. Calculus Practice Problems For Dummies;
  3. Being Mortal: Illness, Medicine and What Matters in the End!
  4. Microsoft SharePoint 2010 Development Cookbook.
  5. My Wishlist?
  6. 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.

    • Microsoft Sharepoint 2010 Development with Visual Studio 2010 Expert Cookbook;
    • Microsoft SharePoint 2010 development cookbook.
    • Illustrated Dictionary of Building: A Reference Guide for Students and Practitioners.
    • il Pensiero di un Sogno: Raccolta di poesie (Italian Edition)?

    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: 1. 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. 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: 5.

    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. Click on the drop-down arrow, and from the menu, select Edit Web Part: 8. 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: 80 Chapter 3 In this recipe, we have learned how to put our web page into edit mode, how to insert a Web Part from the Web Part gallery, and how to modify the Web Parts properties in the Editor Zone.

    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: 1. Repeat the preceding step to add another Web Part. Your Solution Explorer should now look similar to the following screenshot: How to do it NET web control that does not have any user interface. If you wish to render UI, then you must do that yourself through code! 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: 1. 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: How it works 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.