[BOOKS] Beginning SharePoint development by Steven Fox; Darrin Bishop; et al. Book file SharePoint development at Complete PDF Library. beginning sharepoint development by fox steve wrox paperback . Both the Muhimbi PDF Converter for SharePoint Online and PDF Converter. This books (Beginning SharePoint Development [PDF]) Made by Steve Fox About Books Beginning SharePoint Development.
|Language:||English, Spanish, Dutch|
|Genre:||Health & Fitness|
|ePub File Size:||23.33 MB|
|PDF File Size:||10.27 MB|
|Distribution:||Free* [*Regsitration Required]|
I GEttING StartED WIth SharEPoINt DEVELoPMENt tion jinzihao.info files ( the standard format of documents created with newer versions of Word) into PDF. export your SharePoint Designer workflow to Visual Studio (every .. it ' s being declared at the beginning of this file and used as an attribute later on. Beginning SharePoint® Administration™: Microsoft® SharePoint® Foundation and . development for more than 10 years, specializing in SharePoint for the past five years It may be Microsoft Office documents, PDF documents.
We are going to define the following additional Site Columns that we require: WordPress Shortcode. Note the startup screen has the option of Extending Visual Studio for an additional 60 days , in case you are using a trial version. Reader feedback Feedback from our readers is always welcome. We will be taking advantage of some of these in the future chapters, such as the Visual Web Part in the next chapter: Now it is time to see the results of our work!
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. 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. 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. 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.
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". 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. 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! 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. Notice how it refers to the related user control.
It then loads the control and adds it to the Web Part control collection. Put in another way, the user control runs inside the Web Part, or the Web Part is a container for the user control: Edit the contents of each of the two Elements. Here I am changing it to Open Highway, but pick any value that you wish: Now, to work on the inside part, the user control.
Double-click the AmazingVisualWebPart. Pin the toolbox in place so that you can drag-and-drop controls, as shown in the following screenshot. Create your very own truly amazing Web Part: In my case, I double-clicked the button and added a line of code so that we can demonstrate performing an action: Now, it is time to see the results of our work!
Press F5 and carry out the following steps: The Chapter 3 website will be automatically displayed. Put the home page in Edit mode. Place the just below the welcome text. In the Categories section that appears, click on the group you specified above in my case, Open Highway. The top part of your screen should now look similar to the following screenshot: Note that the Web Part title and description appear as we set them earlier.
In the ribbon, go back to the Page tab and click on the Save and Close buttons. Your Web Part should appear on the screen as you had designed it. So far, they are just convenient user interface components. It is the Properties that turn it into a true Web Part! Customizable means that the Designer can change the appearance or behavior of the Web Part through its settings.
Trivially, we did this with the Title property in the first recipe of this chapter. If you have not done so already, refresh your memory by going back to the last recipe and access the Web Part menu and Edit Web Part. On the right-hand side of the Editor Zone, you will see the following three categories: Appearance, Layout, and Advanced, as shown in the following screenshot: Our goal in this recipe will be displaying text in the Web Part in a chosen custom color.
In order to do that, we need to provide a choice of colors as a property in the Editor Zone. Please open this solution in Visual Studio and carry out the following steps: Right-click on References and choose Add Reference. Add the. NET reference for System. Name the folder Enums. Right-click on the Enums folder and click Add New Item 5.
From the Visual C section, select the Code category. Choose the code file and provide the name PrettyColors. For example, Blue will work, while Chartreuse will not , that is, any valid System. Your file will look similar to the following screenshot: Remember that the User Control is actually hosted inside of the Web Part, or put in another way, the Web Part is a container hosting the user control.
So, if we set up and then change a public property on the Web Part, the user control will not know about this, or even have access to the Web Part property. Therefore, we are first going to set up communication between the Web Part and the user control by providing a reference to the Web Part for this purpose: This allows the hosting Web Part to call the user control and provide a reference: Right below the above method, we will provide a method to allow the hosting Web Part to pass in the color property.
This method will take the color and set the ForeColor property of the label control: Enhance the CreateChildControls method as follows, which does the job of passing the reference of the Web Part host to the user control: Now that we have our communication channel set up between the user control and the Web Part, it is time to set up the Web Part properties.
Put the following code right below the declaration of the AmazingVisualWebPart class. You will notice that this is simply a plain old property, with get and set methods that affect a private member declaration for holding a given PrettyColors value: However, this will not automatically make the property exposed to the Editor Zone.
Full description To Download Please Click https: SlideShare Explore Search You. Submit Search. Successfully reported this slideshow. We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads.
Published on May 14, This books Beginning SharePoint Development [PDF] Made by Steve Fox About Books Beginning SharePoint Development Discover how to take advantage of the many new features in SharePoint SharePoint is a significant leap forward from the release, and you will find that there are a ton of features built into the platform for you to leverage in your solution development.
Full description To Download Please Click https: SlideShare Explore Search You. Submit Search. Successfully reported this slideshow. We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads.
You can change your ad preferences anytime. Upcoming SlideShare. Like this presentation? Why not share! An annual anal Embed Size px.