Академический Документы
Профессиональный Документы
Культура Документы
MICROSOFT
LEARNING
PRODUCT
10232A
Lab Instructions and Lab Answer Key: Designing and Developing Microsoft SharePoint Server 2010 Applications
Information in this document, including URL and other Internet Web site references, is subject to change without notice. Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, e-mail address, logo, person, place or event is intended or should be inferred. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation. Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property. The names of manufacturers, products, or URLs are provided for informational purposes only and Microsoft makes no representations and warranties, either expressed, implied, or statutory, regarding these manufacturers or the use of the products with any Microsoft technologies. The inclusion of a manufacturer or product does not imply endorsement of Microsoft of the manufacturer or product. Links may be provided to third party sites. Such sites are not under the control of Microsoft and Microsoft is not responsible for the contents of any linked site or any link contained in a linked site, or any changes or updates to such sites. Microsoft is not responsible for webcasting or any other form of transmission received from any linked site. Microsoft is providing these links to you only as a convenience, and the inclusion of any link does not imply endorsement of Microsoft of the site or the products contained therein. 2010 Microsoft Corporation. All rights reserved. Microsoft and the trademarks listed at http://www.microsoft.com/about/legal/en/us/IntellectualProperty/Trademarks/EN-US.aspx are trademarks of the Microsoft group of companies. All other marks are property of their respective owners. Product Number: 10232A Part Number: Released: 09/2010
Module 1
Lab Instructions: ASP.NET Advanced Concepts for SharePoint
Contents:
Lab A: Page Size and ViewState Exercise 1: Using Fiddler to Observe Page Loading Exercise 2: Using Fiddler to Examine Page Size Exercise 3: Reducing Page Size Lab B: Memory and Performance Exercise 1: Starting a Performance Capture Exercise 2: Reviewing the Report Exercise 3: Resolving Memory Issues and Retest 6 8 9 3 4 5
Sc cenario
Se everal users in a remote offi are compla n ice aining about th overall perf he formance of th manufactur he ring system bu on ASP.NE 2.0. Youve been asked to identify why uilt ET o y th performanc may be slow for them and resolve the issues using th Fiddler he ce w d he to ool.
Results: After this exercise, you should have a default.aspx page that emits slightly more than half the number of bytes as before.
Sc cenario
Remote users have indicated that performa h ance has impr roved due to th ViewState he hanges youve made. Howev the attenti has caused more focus o the e ver, ion d on ch ap pplication and youve been made aware th the applica d hat ation seems to get slower o as time goes on Youve been asked to iden s n. n ntify what is ha appening and improve the ap pplication.
Task 3: Retest
Verify different (better) results.
Results: After this exercise, you should have an application that doesnt consume as much memory during runtime.
Module 2
Lab Instructions: Designing for User Experience
Contents:
Lab A: Selecting Page Parts Exercise 1: Line Dashboard Exercise 2: Managers Dashboard Exercise 3: Alert Notification Lab B: Selecting Page Types Exercise 1: Plant Summary Page Exercise 2: Plant Configuration Page Exercise 3: Employee List Exercise 4: Line Status 9 10 11 12 4 5 6
Su upporting In nformation
In this lab, wer focused on the parts that go on to the p n re page. The obje ective is to un nderstand how to make the right decision around the controls and components w e ns e us to build th pages and c sed he complete the u experienc Youll be w user ce. working in te eams to talk ou the right de ut ecisions for eac of the following compon ch nents. As with the pag types, the decision tree sh ge hown in the ne slide is des ext signed to elp of hat d bout the he you focus on the types o questions th you should be asking ab sc cenario to dete ermine the cor rrect control ty ype. Again, the decision tree is designed e to illustrate of the types of qu o t uestions and d decisions. Due to over-simpl e lification, it may m be possible to have a con e ntrol that doesnt directly fit this decision tree. n
Results: After this exercise, you should have a group decision on the type of control to use and why this is the right type of page, including reasons why the other types of controls are not appropriate or are not the best choice.
Results: After this exercise, you should have a group decision on the type of control to use and why this is the right type of page, including reasons why the other types of controls are not appropriate or are not the best choice.
Results: After this exercise, you should have a group decision on the type of control to use and why this is the right type of page, including reasons why the other types of controls are not appropriate or are not the best choice.
Su upporting In nformation
Because of the move from the manufacturi application several diffe m e ing n, erent pages eed ated in SharePo to suppor different asp oint rt pects of the ap pplications ne to be crea move. They also need to supp enhanced functionality based on the platform. In m o port d y e th lab, youll work together in teams to id his w r dentify the pot tential page ty ypes that will so the proble including the identificat olve em tion of the ben nefits and weaknesses of se everal differen potential pag types. Youll also try to d nt ge determine wha additional at in nformation you need to m ull make the best d decision for the page type. e Th following diagram is inte he d ended to aid y with makin these decis you ng sions. Understand tha this decision tree is not designed to be authoritative. The problem U at n is more comple than what a diagram like this can show The decision trees s ex w. n ob bjective is to il llustrate the ty ypes of questio that you s ons should ask, an then the nd an nswers to thos questions c lead you down one path or another. se can h
Results: After this exercise, you should have arrived at a decision about the type of Plant Summary page to use. You should also understand why this is the right type of page, why other types of pages are not appropriate, and whether this is your best option.
10
Results: After this exercise, you should have arrived at a decision about the type of Plant Configuration page to be used, as well as why this is the right type of page and why other types of pages may or may not be appropriate or the best option.
11
Results: After this exercise, you should have arrived at a decision about the type of Employee List page to be used, as well as why this is the right type of page and why other types of pages may or may not be appropriate or the best option.
12
Results: After this exercise, you should have arrived at a decision about the type of Line Status page to be used, as well as why this is the right type of page and why other types of pages may or may not be appropriate or the best option.
Module 3
Lab Instructions: Designing for Data
Contents:
Lab A: Time Tracking Exercise 1: Creating List Views Exercise 2: Adding Indexes Lab B: Invoice Management Exercise 1: Creating an Invoice Content Type Exercise 2: Enabling Content Organization Exercise 3: Testing Content Organization 7 8 9 2 4
Results: After this exercise, you should have three views on your Time Tracking table to make it easier to process the information.
Results: After this exercise, you should have improved list performance by providing indexes for the views to use in rendering the data.
Sc cenario
Contoso is plan C nning to use SharePoint to s store invoices from vendors. Right now, ev veryone in acc counting can s all of the in see nvoices from e every vendor, b some but ve endor invoices may contain confidential i s n information th needs to be restricted in hat e th future. he Because accoun payable oft uses temporary staff, the department doesnt want nts ten e ontributors to have to know where to file documents. w co
4. 5.
The members of accounting need to be able to open the invoices from the Office client applications. The content must be searchable by vendor or by invoice number.
Starting Point
You already have a content type and list for vendors created that you can use. A sample set of vendor data has been populated. An Invoices document library has been created for your use.
Task 1: Create the site columns for the invoice content type
Invoices have fields, such as Invoice Number, Purchase Order Number, Vendor ID, Invoice Date, Total Amount, and Sales Tax.
Question: How do you determine what site columns to create for your content types? Question: How do you determine what the key criteria is for establishing the folder structure?
Results: After this exercise, you should have a functioning invoice management system that automatically moves invoices to the correct directory.
Module 4
Lab Instructions: Designing for Data Capture and Integration
Contents:
Lab A: Creating External Lists Exercise 1: Connecting to the Data Source Exercise 2: Defining the External Content Types Exercise 3: Defining the External Lists Exercise 4: Setting Security for the Content Types Exercise 5: Defining an Association Lab B: Creating an InfoPath Form Exercise 1: Creating the Calculations Exercise 2: Publishing the Form to a SharePoint Library 9 10 3 4 5 6 7
Sc cenario
Contosos enter C rprise resourc planning (ERP) system is a simple syste that uses a ce em si ingle Microsof SQL Server database. Th purchasing manager want to be able ft he ts to review in Sha o arePoint the p purchase order from the ER system. You been rs RP uve as sked to connect SharePoint to the ERP sy ystem.
Results: After this exercise, you should have a connection in SharePoint Designer to the Contoso ERP database.
Results: After this exercise, you should have four external content types for the four main entities exposed in the Contoso ERP database.
Results: After this exercise, you should have four external lists, one for each of the external content types.
Results: After this exercise, you should be able to access the external lists that youve created to read or add data.
Results: After this exercise, you should have created an association you can use to navigate from a purchase request line to the purchase request header record.
Sc cenario
Th purchasing manager is p he g preparing to tr ransition the approval proce for ess pu urchased requ uests from pap to a ShareP per Point workflow process. You have been w u as sked to design a form that c be used lat when you w n can ter want to autom the mate pr rocess with a workflow. You have decided to create an InfoPath form so that you w u d m ca use a one-to an o-many relatio onship, which isnt supporte on list form ed ms. Fo this exercis you use the PurchaseReq or se, e questForm-Starter.xsn file lo ocated in the E:\Student\Mo odule4 directo ory.
Results: After this exercise, you should have an InfoPath form that represents a complete purchase request.
10
Results: After this exercise, you should have a published InfoPath form that you can use to capture purchase request information.
Module 5
Lab Instructions: Designing Artifacts
Contents:
Lab A: Incident Response Site Exercise 1: Evaluating the Requirements Exercise 2: Designing the Solution Lab B: Expense Reports Exercise 1: Evaluating the Requirements Exercise 2: Designing the Solution 8 12 3 6
Sc cenario
Contoso is crea C ating an incide manageme system for floor incident This ent ent ts. sy ystem will reco the set of p ord procedures th should be e hat enacted when an incident oc ccurs. An incid dent can be so omething as si imple as a con ntainer of mate erials be eing knocked over to a critical leak in a key system. You job is to convert the ur re equirements in the approp nto priate set of co omponents in SharePoint to solve the o pr roblem.
Incidents are defined as unexpected situations that require a response. Incidents include any situation where a worker is injured, product has been damaged or destroyed, or situations where systems break down. In all, Contoso has over 2,000 defined incident responses across the 20 plants that Contoso operates. An average plant will have about 50 custom response plans and approximately 75 that are standard responses for the company. Every incident occurrence requires the creation of an incident response form. This incident response must be routed to the plant manager and to the vice president of safety. Most incident occurrences are minor and the information in the response form is the same. Some incidents are special because they have caused harm to an employee or because they have represented a significant loss of product. These forms are different from the standard form and are routed to the president of Contoso Manufacturing for review. Due to regulations, its necessary to have a backup copy of the Web site with the response plans in paper form on the shop floor at all times. Managers are instructed to print a copy of the incident response plan from the Web site, if possible. If a response form cannot be printed through the Web site, then a copy must be made of the hardcopy file. The hardcopy file will be managed by the safety officer for the plant. Managers will be required to update the files on the floor when a change is recorded and to reprint all response plans every 6 months. The system must notify the safety officer that content has changed. Since many of the procedures in an incident response are the same, the safety department wants to be able to select from a set of procedures and have those procedures included as the incident response plan on the page.
Task 2: Evaluate requirements against the objective, precise, measurable, and understandable criteria
Which of the requirements are good requirements? Which requirements would you need to clarify?
A template is provided for your reference. Use the following legend to evaluate the requirement against these parameters: + = Yes 0 = Needs Information - = No
Understandable
Requirement
Measurable
Objective
Precise
Suggestions
Task 3: Evaluate requirements against responsiveness, skills, scale, and rate of change
Do you have the information that you need in order to create the solution, or are their gaps that need to be addressed first?
A template is provided for your reference. Use the following legend to evaluate the requirement against these parameters: + = Yes 0 = Needs Information - = No
Responsiveness
Requirement
Rate of Change
Scale
Skills
Suggestions
Results: After this exercise, you should have an understanding of the quality of the requirements across two different evaluation criteria.
Task 2: Create a set of clarifying questions that you would ask to further refine and validate your proposed solution
What requirements do you need clarified? What design approaches do you want to verify with the customer?
Results: After this exercise, you should have greater clarity for the types of questions that you would need to ask to better understand the requirements and a prototypical design to evaluate with the customer.
Sc cenario
Contoso, like many other org C m ganizations, is feeling the pinch of compe etitive pr ressures and is improving it cost control measures. As a part of this effort, theyre i ts l s e lo ooking to both standardize t way that expense report are handled and to get h the ts d be etter reporting on the kinds of expenses t g s that the organ nization is incu urring. As a re esult, youve been asked to t transform a se of requireme et ents into an in nexpensive so olution in SharePoint to help manage exp p pense reports.
The accounting department acknowledges that its quite likely that there will be more variations of the expense report in the future as they understand expenses better. All of the expense reports are required to run through a similar approval process. The approval routing is slightly different for the vendor and customer expense reports being routed to the production manager and sales manager for approval, respectively. The training and miscellaneous expense reports get routed to the employees manager. Approval for payment is dependent upon the managers approval authorization and the amount of the expense reported to the manager. Obviously, the expense reports need to capture the details for the expenses in the appropriate categories. However, the key concerns for the system will be capturing the total dollars of expenses and the vendor, customer, or training, for which the expenses were incurred.
Therefore, the following criteria must be satisfied before an expense report can be approved and submitted for payment: The vendor expense form must record the vendor that was visited as well as the dates of the visit. The customer expense form must record the customer that was visited as well as the dates of the visit. The training expense report must record the training event for which the expenses were incurred. The miscellaneous report must include a description about the general purpose of the expenses as well as a date range for which the expenses were incurred. All of the reports need a report date and the employees name and information for which the expenses apply. The system must be able to report the number of expense reports by category, and the total amount by category. In addition, it must report the total amount spent per vendor and per customer. It should also show the expense reports by employee.
10
Task 2: Evaluate requirements against the objective, precise, measurable, and understandable criteria
Which of the requirements are good requirements? Which requirements would you need to clarify?
A template is provided for your reference. Use the following legend to evaluate the requirement against these parameters: + = Yes 0 = Needs Information - = No
Understandable
Requirement
Measurable
Objective
Precise
Suggestions
11
Task 3: Evaluate requirements against responsiveness, skills, scale, and rate of change
Do you have the information that you need in order to create the solution, or are their gaps that need to be addressed first?
Responsiveness
Requirement
Rate of Change
Scale
Skills
Suggestions
Results: After this exercise, you should have a better understanding of the gaps in the requirements as they were provided and what questions you need answered to understand the situation.
12
Task 2: Create a set of clarifying questions that you would ask to further refine and validate your proposed solution
What questions do you need answered in order to understand the situation enough to be comfortable with your proposed solution? What parts of the proposed solution do you want the customer to verify?
Results: After this exercise, you should have a proposed solution that you could discuss with the customer to better understand the situation and how the solution may or may not fit.
Module 6
Lab Instructions: Designing Processing Solutions
Contents:
Lab A: Designing an Engineering System Exercise 1: Evaluating Client Capabilities and Requirements Exercise 2: Evaluating Sandbox Capabilities and Requirements Exercise 3: Evaluating Farm Deployment Capabilities and Requirements Lab B: Creating a Sensor Report Exercise 1: Designing Data Access for Sensor Data Exercise 2: Designing a Processing Solution for the Report Exercise 3: Designing a Processing Solution for the Approval 9 10 11 4 6 7
Sc cenario
Contosos engin C neering depar rtment needs t do specialty analysis on d they to y data ar storing in SharePoint. This requires cal re lculations that are not possi t ible with ou of the box calculated field You need t enable mem ut c ds. to mbers of the en ngineering de epartment to write their ow code. Howe w wn ever, you also m must be conce erned about de evelopers writ ting code that affects the entire farm. Develop an option (or options) n ) fo the engineer or ring departme to accomplish their goal ent l. Th engineering department captures data points off of v he a various system and ms ha developed a set of predic as ctive algorithm to determin when its tim for ms ne me pr reventative ma aintenance to a machine. Th production department r he n relies on this da to know when a machin will be unav ata w ne vailable because of maintena ance and to ev valuate the risk of running t machine w k the without the ma aintenance. Th precise algorithm and th he hreshold data t that perform t calculation change the ns fr requently, so th engineering department needs to retai control of th he in he de evelopment an deploymen of updates t the system. nd nt to
A typical algorithm reviews more than 1,000 data points but less than 5,000 and performs some statistical analysis on the data when compared to output and a number of other metrics. The output of the evaluation is added to an analysis results table. The engineering department includes C++ developers with experience in writing very low level interfaces between programmable logic controllers and data capture systems.
What would be the drawbacks or requirements of a JavaScript client? What limits would it place on the design of the solution? Which activities would be difficult to accomplish?
What would be the drawbacks or requirements of a Silverlight client? What limits would it place on the design of the solution? Which activities would be difficult to accomplish?
What would be the drawbacks or requirements of another type of external client? What limits would it place on the design of the solution? Which activities would be difficult to accomplish?
Results: After this exercise, you should have a clear understanding of what a clientbased solution can do.
Results: After this exercise, you should have a clear understanding of what a sandbox solution can and cannot do.
Results: After this exercise, you should have a clear understanding of what a farmdeployed solution can and cannot do.
Sc cenario
Each month, Co ontoso must p prepare a repo for the gove ort ernmental env vironment versight agenc of each co cies ountry based o sensor data captured dur on a ring the ov month. You nee to build a s m ed system to create this report. Th sensor data that is captured is collecte in a set of te files that ar stored on a he a ed ext re re emote file serv The forma of the data is comma-sepa ver. at s arated values fi files. The file na ames include the computer name as well as a date/time stamp to ma each e ake na ame unique. Th report is a document tha contains tab of summa he at bles aries from all th sensors he in ncluding aggre egations, avera ages, and standard deviation It must also include ns. so ome boilerplat text and som comments from the heal and safety officer about te me s lth th data in the report. he r Because Contos operates in 30 countries, 30 people ne to be able to generate so n , eed his th report.
Results: After this exercise, you should have decided on an approach for accessing the sensor data.
10
Results: After this exercise, you should have a plan for processing the report.
11
Results: After this exercise, you should have a design for approving the workflow when its finished.
Module 7
Lab Instructions: Designing Packaging
Contents:
Lab A: Building a Business Document Solution Exercise 1: Designing a Solution Exercise 2: Creating the Final Solution Lab B: Working with Dependencies Exercise 1: Creating a Common Assembly Exercise 2: Creating a Dependent Solution 9 10 3 6
Sc cenario
Yo are a devel ou loper at Conto Ltd., whic is a large organization wit a global oso, ch th cu ustomer base. Contoso provid a certification package w each prod C des with duct. The pack kage includes se everal differen documents t nt that together m make up the c certification pa ackage. When a new line is cre eated, a certifi ication packag library needs to be set up and the ges p ppropriate con ntent types for that library n r need to be defi ined. Develop a strategy to p ap pr rovision this li ibrary with the appropriate content types s.
Note: The intent of this lab is to provide you with an opport N t tunity to design the n pa ackaging for th custom application. You rec he ceive a fairly ge eneric use case scenario, an this lab quic highlights a few different design options that may resu in nd ckly s ult di ifferent packag ging designs.
Results: The use case scenario as provided is very open ended. After this exercise, you should have a better idea of the requirements as they relate to the various products and the functionality that the two platforms offer and the expected use and livelihood.
Assume that you arrive at the following answers: SharePoint Foundation is the platform. Multiple CPL lists can exist in a single site. There are no naming conventions. No content types exist elsewhere. These content types will not be used elsewhere and are intended for use only by this application. There are no lookup fields. There can be only one content type per list. Lists are created on fairly infrequent basis. The administrative team expects artifacts to allow creation of a backup/archive site without installation of any assemblies.
The CPL_ContentTypes Feature has the following characteristics: Hidden (because it is not intended for use by anyone else) Contain one content type that inherits from the Document content type
Additionally, note that the final design could operate as a sandboxed solution.
Task 6: Ensure that the CPL_ContentTypes feature contains only one element
Visual Studio 2010 may add the certification package list definition to the CPL_ContentTypes feature when the definition is created. Ensure that the element is not included in the feature.
After the list is created, in Advanced Settings, enable management of content types. On the List Settings page: Verify that the Contoso.CertificationPackageList - Certification Package Documents content type is associated with the list.
Sc cenario
Yo are a devel ou loper at Conto Manufactu oso uring. Contoso development team has os de ecided to plac common bu ce usiness logic in a common a n assembly. This will allow s sm maller units of functionality to reference a common cod base. You n f y de need to create a Web Part that uses the com t mmon assembl ly.
10
Open the Package Designer for the farm solution, and record the Solution ID. You use this in the next step. Open the Package Designer for this sandboxed solution. Click Manifest.
11
Click Edit Options to open the advanced text box where you can enter custom XML that will be integrated with other settings. Visual Studio merges all information to create a composite solution manifest. Add the following XML to the Manifest Template text box:
<?xml version="1.0" encoding="utf-8"?> <Solution xmlns="http://schemas.microsoft.com/sharepoint/"> <ActivationDependencies> <ActivationDependency SolutionId="ADD_SOLUTION_ID_FROM_STEP_5"/> </ActivationDependencies> </Solution>
12
Note: You see Show Error Details only if Callstack is set to true in the Web applications Web.config file. You should set the value to true only in development environments.
Note: No error messages are shown during the removal of the farm solution. Dependencies are not checked. Therefore, you might end up in a scenario where previously working code breaks because the dependency has been removed.
Note: In Visual Studio 2010, a message indicating that there was a dependency problem and installation was halted will appear. Because the farm solution was removed but never reinstalled, the sandboxed solution cannot be installed. By reinstalling the farm solution, you can reinstall the sandboxed solution (and return to where you were in Task 3).
Module 8
Lab Instructions: Designing a Development Strategy
Contents:
Lab A: Team-Based Logging and Configuration Exercise 1: Appraising the List-Based Configuration Exercise 2: Using a SharePoint List-Based Configuration Exercise 3: Using SharePoint List-Based Logging Exercise 4: Configuring the Logging Level Lab B: Operational Logging Exercise 1: Adding Logging to SharePoint ULS 10 2 3 6 8
Think abou how you pr ut rovide the con nfiguration opt tions for the sc cenario. Evaluate th pros and co for the scenarios and pic a preferred solution. he ons ck
Create the GetCurrentTargetForWeek method. Using the ConfigurationList constant value, retrieve the first item in the specified list from the current Web and return the value in the field specified by the TargetForWeekFieldName constant value.
Add a global variable for a text box control entitled _txtCurrentTarget and then add the text box to the controls collection in CreateChildControls. Add a button to the controls collection and instantiate a new event handler for the button click event. In the button click event handler, add code to create a new list item in the target list specified by the ConfigurationList constant and set the field value specified by the TargetForWeekFieldName constant to the value entered by the user in the _txtCurrentTarget text box.
Insert code in the FeatureDeactivating event to remove the list from the current web.
Results: After this exercise, you should be able to see how using a SharePoint list for application configuration is simple to do. You should now consider the value the SharePoint platform provides as you can set security on the list to restrict the users who can set the configuration values. You could provide versioning on the list to see how the target has changed over time.
Add a DeleteLogList method, which accepts an SPWeb object as a parameter and returns void, to remove the logging list in the specified context. Insert code to delete the specified list.
Refactor the code in the FeatureActivated event into a new CreateConfigurationList method which accepts an SPWeb object as a parameter and returns void.
Refactor the code in the FeatureDeactivating event into a new DeleteConfigurationList method which accepts an SPWeb object as a parameter and returns void. Modify the FeatureActivated event to call the CreateCongurationList and CreateLogList methods, passing in the current web context. Modify the FeatureDeactivating event to call the DeleteCongurationList and DeleteLogList methods, passing in the current web context.
Results: After this exercise, you should be able to see how using a SharePoint list for application logging is simple to do. It is possible to add logging very simply to applications that will enable you to trace error or log information.
Edit the BtnSubmitCurrentTargetClick event. Modify the call to the LogEvent method to pass in a logging level of Info in addition to the error message text.
Edit the LogEvent method and insert code to evaluate the value of the logging level passed in as a parameter against the logging level value selected by the user and insert a log item into the log list if the level is greater than or equal to the selected value.
Results: After this exercise, you will have added application configuration options that allow the level of logging to be controlled via Web part properties. This example shows how it is possible to control the program flow using configuration settings.
10
Sc cenario
Th Operations team has imp he s plemented a n monitorin solution tha is able to new ng at pa the Share arse ePoint ULS log They have requested tha all custom so gs. at olutions be up pdated to prov vide ULS-base logging. ed
11
Results: After this exercise, you will have updated the logging to also target the SharePoint ULS. This example shows how it is possible provide admin level logging capabilities to your solutions.
Module 9
Lab Instructions: Developing Version and Deployment
Contents:
Lab A: Versioning Assemblies Exercise 1: Defining Base Version Exercise 2: Upgrading the Assembly Lab B: Feature Upgrade Exercise 1: Creating Upgrade Manage Page Exercise 2: Adding Feature to Upgrade Exercise 3: Upgrading Feature 6 8 9 2 4
Results: After this exercise, you will have defined a basic version for the feature and also will have demonstrated that the default assembly version for the Web Part assembly is 1.0.0.0.
Note: This solution must be deployed to a blank Web site and not a team site.
The main tasks for this exercise are as follows: 1. 2. 3. 4. 5. 6. 7. Update version. Package and deploy. Add SafeControl. Add BindingRedirect. Package and update. Evaluate the changes. Optional: Remove the additional SafeControl entry and deploy the solution.
Optional: Remove the additional SafeControl entry and deploy the solution
Explain why the Web Part still works.
Results: After this exercise, you will have demonstrated how it is possible using the new features of SharePoint 2010 to automatically provide assembly versioning and binding redirects.
Results: After this exercise, you will have created an application page that queries features in the site collection that need to be upgraded. You will have added an upgrade event handler to the feature that will be called during the upgrade event. You will also have provided specific version information that defines when the upgrade action is called and that action has been passed in the event handler. Based on this understanding of the upgrade framework, you should now be able to work through all of the scenarios.
Results: After this exercise, you will have deployed a feature that will place an entry into a log upon being upgraded.
Task 2: Upgrade
Use the FeatureManager page to upgrade the feature.
Results: After this exercise, you will have an entry in the upgrade log indicating that the upgrade has been performed.
Module 10
Lab Instructions: Designing Information Architecture and Navigation
Contents:.
Lab A: Developing a Site Structure Exercise 1: Using Card Sort Exercise 2: Designing Content Types and Site Columns Lab B: Implementing Farm-wide Navigation Exercise 1: Deploying a Custom SiteMap Exercise 2: Adding an ASPmenu to a Custom Master Page 9 11 2 6
Lab Instructions: Desig gning Information Arc chitecture and Navig gation
Note: Your instr N ructor may run this lab as a cla discussion. ass
Guidelines G
You should try to create a maximum o five main ca d of ategories. You may cr reate up to five subcategorie per category until youve developed an e es y n appropriate categorizatio tree. e on You may not use the dep partment name (included in the beginnin of the item es n ng ce) ntent category y. for referenc in your con
Break into groups and start working for 10 minutes. Then well reconvene to discuss the task further.
Content for Card Sort [Accounting] Expense Reports [Accounting] Purchase Orders [Accounting] Invoices (Accounts Receivable) [Accounting] Invoices (Accounts Payable) [Administration] Mission Statements [Administration] Phone Lists [Administration] Corporate Summary Presentations [Engineering] Product Design Specifications [Engineering] Test Reports [Engineering] Plant Diagrams (Physical) [Engineering] Plant Diagrams (Electrical) [Engineering] Plant Diagrams (Mechanical) [Engineering] Plant Renderings
[Accounting] Purchase Orders [Accounting] Tax Filings [Accounting] Financial Reports [Accounting] Closing Reports
[Engineering] Machine Inspection Reports [Engineering] Interface Specifications [HR] Offer Letters
[Administration] Memos [Administration] Board of Directors Meeting Agendas [Administration] Board of Directors Meeting Minutes [Administration] Customer Complaint [Administration] Customer Complaint Responses
(continued)
Content for Card Sort [HR] Benefits Information [HR] Time cards [HR] Union Contracts [HR] Workers Compensation Claims [HR] Workers Compensation Claim Responses [HR] Employee Details [Legal] Contracts (Bank) [Legal] Contracts (Customer) [Legal] Contracts (Vendor) [Legal] Contracts (Partner) [Legal] Releases [Legal] Licenses [Legal] Building Permits [Legal] Zoning Petitions [Legal] Wrongful Termination Letters / Responses [Legal] Case Files [Manufacturing] Bill of Materials [Manufacturing] Production Costs [Purchasing] Vendor Quality Reports [Purchasing] Vendor Pricing Agreements [QA] Item Quality Reports [QA] Test Procedures [QA] Equipment Inspection Reports [Sales] Team Performance Reports
[Sales] Competitive Performance Reports [Sales] Proposals [Sales] Sales Presentations [Sales] Sell Sheets [Sales] Catalogs / Line Cards [Sales] Pricing Contracts [Sales] Prospects [Sales] Client Contacts [Sales] Performa P&Ls [Sales] Flyers
[Sales] Product Images [Sales] Packaging Inserts [Sales] Packaging Designs [Shipping] Bills of Lading
2.
Results: After completing this exercise, you should have an understanding of how to apply information architecture to content type and site column selection in SharePoint.
Lab Instructions: Desig gning Information Arc chitecture and Navig gation
Sc cenario
Each manufactu uring plant wi have its own site collectio To make it easier for ill n on. t sers out nufacturing pla ants, the plann ning team us to find information abo other man ha decided to add custom n as navigation to a footer on the master page u used by Sh harePoint. Sin the numbe of manufacturing plant sit collections i relatively nce er te is st tatic, the team has decided t use an .xmlto -based navigat tion control in nstead of cr reating a custo SiteMapProvider class or a custom nav om r vigation contr Site users rol. will w be able to use links in th footer to nav u he vigate between top-level site in each n es manufacturing plants site co m ollection. A roo node repres ot senting the cor rporate In ntranet site wil also be inclu ll uded. In this lab, you should: n 1. . 2. . Add naviga ation nodes representing the manufacturi plants site collections e ing e and corpor intranet to the Layouts.Sitemap of all Web applicat rate o tions. Create a master page wit navigation l th links based on the added na n avigation nodes.
7.
10
Note: In a multiple Web front end server environment, the command line must be run once on each server. Invoking the SPWebService.ApplyApplicationContentToLocalServer method will accomplish the same thing, but since it runs only on one server, you would need to create a custom timer job that would invoke the API on each Web front end server.
11
5. 6.
12
13
3.
4. 5.
Deploy the project. Navigate to the site you chose as the target when you created the project in Exercise 1. You should see a new global navigation footer at the bottom of the page.
Note: You have only added the V4global.master to one site in this exercise. You would need to deploy and activate the custom master to other sites for the navigation to be complete.
Results: After completing this exercise, you should have an understanding of how to implement a custom global navigation system for a SharePoint site.
Module 11
Lab Instructions: Designing Branding and Customization Support
Contents:
Lab A: Packaging Branding Exercise 1: Importing .wsp Files Into Microsoft Visual Studio Exercise 2: Extracting the File Resources Exercise 3: Writing the Feature Receiver to Apply Changes Exercise 4: Testing the Changes Lab B: Improving Branding Performance Exercise 1: Observing Current Performance Exercise 2: Turning on BLOB Caching Exercise 3: Observing BLOB Cached Performance Exercise 4: Observing _layouts Performance 8 9 10 11 3 4 5 6
Sc cenario
Th designer ha delivered a Microsoft Sha he as arePoint site w which has been modified n with w SharePoin Designer. Th designer pa nt he ackaged the ch hanges up into a .wsp by o di isabling the pu ublishing featu and then selecting save site as templ ures n e late. The de esigner has let you know of the following changes they made which you need to t f g y pa ackage:
Added a ne master pag called Conto ew ge oso.master Created a custom CSS ca c alled Contoso. .CSS Added a Co ontoso logo Modified th site logo UR of the site he RL
Yo package should apply a of these elem our all ments to a site as a part of a feature e ac ctivation proce ess.
Results: After this exercise, you should have a Visual Studio project with the artifacts that the designer created in SharePoint Designer.
Task 2: Copy the master page resources to the Contoso Branding project
Drag the Master_Page_Gallery folder hierarchy into the Contoso.Branding project. Delete all of the unnecessary elements until just the list instance and module for Contoso.master remain.
Task 3: Copy the site assets resources to the Contoso Branding project Drag the Site_Assets folder hierarchy into the Contoso.Branding project. Task 4: Remove the imported project
In Solution Explorer, remove the imported project from the solution.
Results: After this exercise, you should have a Contoso Branding project that will deploy all of the required files to support changing the master page.
Results: After this exercise, you should have a completely functional Visual Studio project, which will deploy the required resources and provide the user with a way to activate the Contoso branding on their site.
Task 2: Deactivate the feature and ensure the site still works
Deactivate the feature Apply Contoso Branding in site features. Navigate back to the home page and ensure that the Contoso Branding has been removed.
Results: After this exercise, you should have demonstrated that your project works correctly.
Sc cenario
Th designer ha delivered a SharePoint site which has b he as been modified with d Sh harePoint Des signer. The des signer packaged the change up into a W by es WSP di isabling the pu ublishing featu and then selecting save site as templ ures n e late. The de esigner has let you know of the following changes they made which you need to t f g y pa ackage:
Added a New Master Pag called Cont ge toso.master. Created a custom CSS ca c alled Contoso. .CSS. Added a Co ontoso logo. Modified th site logo UR of the site. he RL
Yo package should apply a of these elem our all ments to a site as a part of a feature e ac ctivation proce ess.
Results: After this exercise, you should have observed how out of the box all of the requests which are serviced by the content database have a cache-control header set to private.
Results: After this exercise, you should have enabled the SharePoint Server BlobCache on SharePoint so that files from the database are cached locally.
10
Results: After this exercise, you should have observed the impact that enabling the BLOB cache has on the client interaction.
11
Results: After this exercise, you should have an understanding of how performance differs with BlobCache turned on and how _layouts behaves in terms of cache control.
Module 12
Lab Instructions: Designing Security
Contents:
Lab A: Setting Up a Customer Service Site Exercise 1: Setting Up the Authentication Provider Exercise 2: Creating an FBA-Claims Site Optional Exercise 3: Viewing Claims for an FBA User Lab B: Solving a Security Issue Exercise 1: Understanding the Scope and Relating it to Configuration Exercise 2: Designing a Security Strategy 15 15 3 6 13
Sc cenario
Contoso manuf C facturing wants to allow cus stomers to log into a ShareP g Point site to se the progress of their orde Customers will not have an internal n ee ers. s e network id dentity. The sa representa ales ative needs the ability to ma e anage access to the o cu ustomers sites s.
These two requirements point us in the direction of a solution that leverages FBA. By setting up a custom database that is housed internally (on Contoso property), we are able to isolate user identities and provide Contoso employees the ability to manage user accounts that will be needed to access the site. Knowing that we plan to use FBA, we also know that our Microsoft SharePoint Web application must be set up to use claims-mode authentication.
Task 2: Set up the FBA database and verify you can manage users
For this step, the following assumptions were made to reduce complexity. We are going to use standard instructions for setting up an FBA database. The IIS Management console will serve as our user management interface. The security account for the application pools will be Network Service. This is a predefined local account that will allow us to set up both the SharePoint and generic ASP.Net sites.
Note: These assumptions may not be valid for production systems. They are intended for educational and development use only.
1.
Start the ASP.NET SQL Server Setup Wizard. The setup file is located at %windows%\Microsoft.Net\Framework64\ v2.0.50727\aspnet_regsql.exe. Default values should be sufficient for all fields, with the exception of the SQL Server name field. Specify .\SharePoint for the server name.
2. 3.
Open IIS Manager. Create a new Web site called fba, which utilizes the SharePoint 80 application pool. Open Microsoft SQL Server Management Studio. Locate the aspnetdb database. Add Network Service as a db owner for the aspnetdb.
4. 5.
Navigate to the root folder for the fba Web site that was just created. Create a web.config file, and add the following text to the file:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <connectionStrings> <add name="fbaSQL" connectionString="Server=.\SHAREPOINT;Database=aspnetdb;Integrated Security=true" /> </connectionStrings> <system.web> <!-- membership provider --> <membership defaultProvider="fbaMembers"> <providers> <add name="fbaMembers" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="fbaSQL" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" /> </providers> </membership>
<!-- role provider --> <roleManager enabled="true" defaultProvider="fbaRoles"> <providers> <add name="fbaRoles" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="fbaSQL" applicationName="/" /> </providers> </roleManager> <authentication mode="Forms" /> </system.web> </configuration>
6.
At this point, you should be able to go back to the Internet Information Services (IIS) Management console, add at least one user to your new FBA database, and grant one user access to the site. You can also define roles and associate users with those roles. For demo purposes, create at least one role and associate the user from Step 6 with the role.
7.
Results: After this exercise, you should have all the underlying FBA components in place and ready for SharePoint consumption. You are now ready to provision a SharePoint 2010 site for use with FBA.
Create a site collection for the top-level site of your Forms Web application.
The web.config files are located in two different folders: The root folders for both the Forms Web application and Central Administration are located under \inetpub\wwwroot\wss\VirtualDirectories. The root folder for the Security Token Service is located under 14\WebServices\SecurityToken. Add the following connection string to the web.config files (as a child of the <configuration> node):
Note: Be sure to place this node after the configSections node; otherwise, you will get an error stating that configSections must be the first child of the configuration node.
<add connectionStringName="fbaSQL" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" passwordAttemptWindow="10" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" name="fbaMembers" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </providers> </membership>
Task 5: Define membership and role providers for the Forms Web application
Update the membership and role provider information contained within Form Web applications web.config file with the following text:
<roleManager enabled="true" cacheRolesInCookie="false" cookieName=".ASPXROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All" defaultProvider="c" createPersistentCookie="false" maxCachedResults="25"> <providers> <clear /> <add connectionStringName="fbaSQL" applicationName="/" name="fbaRoles" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
10
<add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <add name="c" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthRoleProvi der, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" /> </providers> </roleManager> <membership defaultProvider="i" userIsOnlineTimeWindow="15" hashAlgorithmType=""> <providers> <clear /> <add connectionStringName="fbaSQL" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" passwordAttemptWindow="10" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" name="fbaMembers" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <add name="i" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthMembershi pProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" /> </providers> </membership>
11
Task 6: Define membership and role providers for the Security Token Service application
Update the membership and role provider information contained within the Security Token Services web.config with the following information:
Note: <system.web> does not exist in a default out-of-box installation. Add the following as the last child of the <configuration> node.
<system.web> <membership> <providers> <add connectionStringName="fbaSQL" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" passwordAttemptWindow="10" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" name="fbaMembers" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </providers> </membership> <roleManager enabled="true"> <providers> <add connectionStringName="fbaSQL" applicationName="/" name="fbaRoles" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </providers> </roleManager> </system.web>
12
Task 7: Use Central Administration to designate the first FBA user for the Forms Web application
Designate one of the FBA users created in Task 2 as either a site collection administrator or grant them Full Control via a user policy. If all associations have been properly set, the Central Administration site should be able to locate the FBA users.
Results: After this exercise, you should have a fully functioning FBA-Claims SharePoint site.
13
14
Sc cenario
Contoso manuf C facturing is moving more in nformation to the customer portals. It has be reported that some of th documents are unavailab to the customer, even een t he s ble th hough they should have acc cess to the doc cuments. An nalyze and de evelop a securi strategy an implement i ity nd it.
15
Module 13
Lab Instructions: Designing for Page and Data Access Performance
Contents:
Exercise 1: Using the SharePoint Server 2010 Developer Dashboard to Capture Performance Metrics Exercise 2: Leveraging the SharePoint Server 2010 Search API for Large Data Queries 2 4
Lab Instructions: Desig gning for Page and D Access Performa Data ance
Exercise 1: Using the SharePoin Server 2 nt 2010 Deve eloper Dashboard to Captur Perform D re mance Met trics
Sc cenario
Yo have create a custom list and list inst ou ed tance for deplo oyment into a site co ollection and a Web Part to retrieve the lis data and ren st nder it in a da grid. ata Th user has po he opulated the li with large a ist amounts of da You must assess the ata. pe erformance im mpact of the cu ustom Web Pa using the S art SharePoint Dev veloper Dashboard. D Th main tasks for this exerc are as follo he s cise ows: 1. . 2. . Enable the SharePoint Developer Dash hboard. Deploy the Contoso.Perf e formance.Lists solution. s
3. 4.
Add performance instrumentation to a custom Web Part. Analyze results in the Developer Dashboard.
Results: After this exercise, you should have instrumented the code to write output results to the Developer Dashboard and deployed the solution to SharePoint.
Exercise 2: Leveraging the SharePoint Server 2010 Search API for Large Data Queries
Scenario
After analyzing the performance results of the custom List View Web Part, you determine that the performance of the solution is less than optimal. You must now refactor the code to use the SharePoint Search API to retrieve list item data and display it in a data grid. The main tasks for this exercise are as follows: 1. 2. Create a search query to retrieve list items. Analyze performance metrics in the Developer Dashboard.
Results: After this exercise, you should have configured Search, modified the code to retrieve list items through the Search API, and compared the performance metrics in the Developer Dashboard.
Module 14
Lab Instructions: Designing a Testing Strategy
Contents:
Exercise 1: Conducting Unit Testing Exercise 2: Conducting Performance Testing Exercise 3: Conducting Load Testing 2 5 6
As both the Presenter (Web Part) and Model (data) classes cannot be unit tested without mock (stub) objects due to their dependency upon the SharePoint framework, the developer must write a suite of tests to validate the functionality of the View class. The unit tests must validate that data from a DataTable is properly bound to a GridView object and that the XML Encoded values for list field names are properly decoded into a readable format. Finally, the unit tests must be automatically executed after each successful build of the Web Part project. The main task for this exercise is as follows: 1. Create, execute and automate a unit test.
Add a postbuild event to the Contoso.Testing.WebParts project to execute mstest.exe from the command line using the Contoso.Testing.vsmdi metadata file and the UnitTests test list. Rebuild the solution and view the results of the test execution in the Output window.
Results: After this exercise, you should have created a unit test, executed the unit test, and automated execution of the unit test as part of the build process for the project. Provide the results of the exercise so that students will know when and if they have completed the lab exercise successfully.
Results: After this exercise, you should have created a performance test and validated the results of the tests against the target Web application.
Results: After this exercise you should have created a load test and validate the results of the test against the target web application.
Module 1
Lab Answer Key: ASP.NET Advanced Concepts for SharePoint
Contents:
Lab A: Page Size and ViewState Exercise 1: Using Fiddler to Observe Page Loading Exercise 2: Using Fiddler to Examine Page Size Exercise 3: Reducing Page Size Lab B: Memory and Performance Exercise 1: Starting a Performance Capture Exercise 2: Reviewing the Report Exercise 3: Resolving Memory Issues and Retest 4 4 5 2 3 3
Note: If the page is blocked by the Internet Explorer Enhanced Security Configuration, click Add and add the website to the Trusted sites zone.
5.
Change back to the Fiddler window and click the session that is reading from 127.0.0.1 (the port number will be random) and the path of /.
Click Save to save the Default.aspx file. Open Internet Explorer and press F5. Examine the revised page (see Exercise 2). Now, the size is 112848 bytes.
Task 3: Retest
Redo Exercise 1 and verify different (better) results.
Module 2
Lab Answer Key: Designing for User Experience
Contents:
Lab A: Selecting Page Parts Exercise 1: Line Dashboard Exercise 2: Managers Dashboard Exercise 3: Alert Notification Lab B: Selecting Page Types Exercise 1: Plant Summary Page Exercise 2: Plant Configuration Page Exercise 3: Employee List Exercise 4: Line Status 5 6 7 8 2 3 4
Notification Area
Silverlight
Web Part Server Control Web Part AJAX Silverlight Menu Item Status Bar
Notification Area
Application
Master
Static Page
Master
Web Part
Wiki
Static Page
Wiki
Static Page
Application
Master
Static Page
Module 3
Lab Answer Key: Designing for Data
Contents:
Lab A: Time Tracking Exercise 1: Creating List Views Exercise 2: Adding Indexes Lab B: Invoice Management Exercise 1: Creating an Invoice Content Type Exercise 2: Enabling Content Organization Exercise 3: Testing Content Organization 5 7 9 2 4
8. 9.
10. In the View Name box, enter ByMonthByPlant. 11. Select the Make this the default view check box. 12. In the Columns section, clear the Attachments, Title, and YearMonth options. 13. In the Columns section, select the Employee and Hours options. 14. Scroll down and click the plus sign to the left of the Group By section to expand it. 15. In the First group by the column drop-down list, select YearMonth. 16. In the Then group by the column drop-down list, select Plant. 17. Scroll down to the end of the page and click OK. You now have a view grouped by Year-Month and then by plant.
10. In the Column name field, enter InvoiceDate. 11. In the The type of information in this column is option list, select Date and Time. 12. In the Group section in the Existing group section, select Contoso. 13. Click OK. 14. Click Create. 15. In the Column name field, enter InvoiceAmount. 16. In the The type of information in this column is option list, select Currency. 17. In the Group section in the Existing group section, select Contoso. 18. Click OK. 19. Click Create. 20. In the Column name field, enter Vendor. 21. In the The type of information in this column is option list, select Lookup (information already on this site).
22. In the Group section in the Existing group section, select Contoso. 23. In the Additional Column Settings section, select Vendors from the Get information from drop-down list. 24. Click OK.
10. In the Select columns from drop-down list, select Contoso. 11. In the Available columns list box, press the CTRL key and select InvoiceAmount, InvoiceDate, InvoiceNumber, PONumber, and Vendor and click Add. 12. Click OK. 13. In the Columns section, click Invoice Number. 14. In the Column Settings section, select the Required option. 15. In the Columns section, click Vendor. 16. In the Column Settings section, select the Required option. 17. Click OK.
10. Click the Library Tools-Library tab. In the Settings group, click Library Settings. 11. In the Content Types section, click Add from existing site content types. 12. From the Available Site Content Types list box, click Invoice and then click Add. 13. Click OK.
In the Quick Launch area, click the Invoices library. Notice that a folder exists with the name 12; Fabrikam, Inc. Click on the folder 12; Fabrikam, Inc. Notice that the document exists in the folder.
Module 4
Lab Answer Key: Designing for Data Capture and Integration
Contents:
Lab A: Creating External Lists Exercise 1: Connecting to the Data Source Exercise 2: Defining the External Content Types Exercise 3: Defining the External Lists Exercise 4: Setting Security for the Content Types Exercise 5: Defining an Association Lab B: Creating an InfoPath Form Exercise 1: Creating the Calculations Exercise 2: Publishing the Form to a SharePoint Library 9 12 2 3 6 7 8
10. Click Finish. 11. In the SharePoint Designer title bar, click Save (disk icon) to save and publish the content type.
9.
10. Click Finish. 11. In the SharePoint Designer title bar, click Save (disk icon) to save and publish the content type.
10. In the Properties section, select the Show in Picker check box. 11. In the Data Source Elements section, click Total Amount. 12. In the Properties section, select the Show in Picker check box. 13. Click Finish. 14. In the SharePoint Designer title bar, click Save (disk icon) to save and publish the content type.
10. In the Properties section, select the Show in Picker check box. 11. In the Data Source Elements section, click Amount. 12. In the Properties section, select the Show in Picker check box. 13. Click Finish. 14. In the SharePoint Designer title bar, click Save (disk icon) to save and publish the content type.
3.
4. 5.
10. Click Finish. 11. In the SharePoint Designer title bar, click Save (disk icon) to save and publish the content type.
10. In the list box, select the VendorName field. 11. Click Next twice. 12. Click Finish. 13. Click the button to the right of the Display name text box. 14. In the Select a Field or Group dialog box, verify that the VendorName field is selected, and then click OK twice.
10
10. Click Next twice. 11. Click Finish, and then click OK.
11
8. 9.
Click the Insert Field or Group button. Double-click the Amount field.
10. Click OK twice. 11. Right-click the Total amount field in the header, and then select Text Box Properties. 12. To the right of the value text box, click the Fx button. 13. Click the Insert Function button. 14. In the Categories list box, select Math. 15. In the Functions list box, double-click sum. 16. Double-click the text double-click to insert field. 17. Expand PurchaseRequestLines and Lines, double-click ExtendedAmount, and then click OK twice.
12
Module 5
Lab Answer Key: Designing Artifacts
Contents:
Lab A: Incident Response Site Exercise 1: Evaluating the Requirements Exercise 2: Designing the Solution Lab B: Expense Reports Exercise 1: Evaluating the Requirements Exercise 2: Designing the Solution 8 14 2 6
Task 2: Evaluate requirements against objective, precise, measurable, and understandable criteria
Use the following legend to evaluate the requirement against these parameters: + = Yes 0 = Needs Information - = No
Understandable
Measurable
Objective
Precise
Suggestions Ask which parts of the system need to be functional in order to pass the government review. Clarify what the printed page has to look like. Does it have to convey the key information or does it have to fit a specific format? Can an incident response be saved with no procedures? Are all procedures centralized or can a plant have their own procedures? How do you control which responses are shared for a plant from the corporate responses and which ones are unique? What are the reminder intervals? What happens if a response is rejected? Who is notified? When are they notified?
Task 3: Evaluate requirement against responsiveness, skills, scale, and rate of change
Use the following legend to evaluate the requirement against these parameters: + = Yes 0 = Needs Information - = No
Responsiveness Rate of Change
Scale
Skills
Suggestions The skills of the project team members would likely be clear if you worked for the organization but arent clear here. The rate at which the procedures change wasnt specified. The requirements make it clear that this has to be self-service.
The requirements are clear about the ability to select procedures and its clear that the safety officer should be able to perform this. However, its not made clear how many procedures theyll select. Nor is it clear the frequency with which the procedures that apply to when an incident response is changed.
(continued)
Responsiveness Rate of Change
Scale
Skills
Suggestions The key missing element is an understanding of the skills of those who will be setting up the incident responses. Inheritance is a complex topic, so it will be important to understand how much the system should make this easier. The rate of change between unique and shared incident responses isnt made clear. The reminder frequency (if any) isnt called out. The skills are specified by the fact that the requirements call out senior management, and the scale is missing. The requirements dont define the number of incidents in a typical year. Nor do the requirements call out an expected frequency of change for the workflows. The requirements arent clear on the number of changes (rate of change) or the responsiveness window after a change is approved.
Task 2: Create a set of clarifying questions that you would ask to further refine and validate your proposed solution
The primary suggested questions are included in the preceding table for evaluation. However, the following questions may also be asked to help evaluate the proposed solution: Is it acceptable to have these incident response plan sites located in the same hierarchy? How do you make the decision between a critical incident and a standard incident? Its clear that all injuries are considered critical, but how much product makes an incident critical? Should there be a separate category for product damage and worker injury? Is it acceptable for the safety officer to follow the procedures for printing, or does the system need to allow for the printing of a booklet every 6 months that includes all of the incident plans for a plant? How is it determined when its time to change the workflow, and who is responsible for changing it?
The approval process for training and miscellaneous expenses requires a workflow that is routed through the users manager and possibly through the users managers manager. The approval process for vendors is a custom task and gets routed through the production manager. The approval process for customers is a custom task and gets routed through the sales manager. Expense reports must capture: Total amount Employee
In addition to the standard fields, Vendor expense reports must capture: Vendor for expense Dates of travel
In addition to the standard fields, Customer expense reports must capture: Customer for expense Dates of travel
In addition to the standard fields, Training expense reports must capture training for which the expense was incurred. A reporting system must be capable of reporting: By expense report category By employee By vendor By customer
10
Task 2: Evaluate requirements against objective, precise, measurable, and understandable criteria
Use the following legend to evaluate the requirement against these parameters: + = Yes 0 = Needs Information - = No
Understandable
+
Measurable
Objective
Precise
Suggestions The only ambiguity that might be questionable would be expense reports for vendors or customers that arent related to a trip. For instance, the purchase of a top vendor award. The approval process is described generically. Exception conditions, like the CEO who doesnt have a manager and where the manager approval amounts will be retrieved from, arent covered. Theres no mention of guidance for the managers on approval/rejection and no discussion of potential automatic approval. The key piece of missing data is during the process, when does the approval get routed to the production manager, and what happens if the production manager is the direct manager of the person submitting the report?
Approval process
11
(continued)
Understandable +
Measurable
Objective
Precise
Suggestions The key piece of missing data is the same as for vendor, except that were talking about the sales manager. This is clear. However, the relatively small set of fields would generally indicate a need to probe for other questions like totals by category. The missing information is how the vendor will be recorded. Will this be by vendor ID or by name? Will the user be expected to enter this information manually or will the system need to ensure that this value is correct? See Capture fields for Vendor.
Capture fields
Is the list of training opportunities a constrained list? Where will this list come from? The formats for the report arent covered, nor the details for the fields to be displayed in the report. No security requirements are specified, but its quite likely there are requirements that are not expressed.
Reporting
Security
12
Task 3: Evaluate the requirement against responsiveness, skills, scale, and rate of change
Use the following legend to evaluate the requirement against these parameters: + = Yes 0 = Needs Information - = No
Responsiveness Rate of Change
-
Scale
Skills
Suggestions Its not clear how many expense reports are processed for a timeframe. Nor is it clear how frequently the expense report policies change, or how frequently manager approval amounts change, and so forth. Its unclear how frequently the approvers need to be reminded they have a pending approval. It also isnt clear how quickly they need to be notified. As with the expense report types, the scale (number of approvals) and the rate of change are unknown. See Approval process.
Approval process
Its unclear how frequently accounting may change the number of fields being captured.
13
(continued)
Responsiveness Rate of Change -
Scale
Skills
Suggestions In addition to the issues for Capture fields, its also unclear how the vendor will be identified. See Capture fieldsVendor.
The responsiveness for the reports, the skills of the report operator, the number of times the reports will be run (scale), or the frequency of changes (rate of change) are all unknown. Since none of this was specified in the requirements, clarification is required on every aspect.
Security
14
The proposed content hierarchy would be: Expense Report Trip Expense Report Vendor Expense Report Customer Expense Report
The miscellaneous expense report would use the base type. The base type would define fields for the employee and total amount. A trip expense report would be defined with fields for starting and ending dates. The vendor expense report would add the vendor field and the customer expense report would add the customer field. The training expense report would add a training field. Workflows would be attached at the expense report type and overridden or replaced at the vendor expense report and customer expense report level. This arrangement allows for new expense report types with the same basic structuresuch as prospects and vendor evaluation.
15
Task 2: Create a set of clarifying questions that you would ask to further refine and validate your proposed solution
Most of the clarifying questions appear in the preceding requirements, however, several specific questions about the proposed solution could be: Might you have a customer or vendor expense report that doesnt include a trip? Could you have more types of expense reports that you want to track which do involve trips? Do the users know how to use InfoPath well enough that they could fill out expense reports based on InfoPath?
Module 6
Lab Answer Key: Designing Processing Solutions
Contents:
Lab A: Designing an Engineering System Exercise 1: Evaluating Client Capabilities and Requirements Exercise 2: Evaluating Sandbox Capabilities and Requirements Exercise 3: Evaluating Farm Deployment Capabilities and Requirements Lab B: Creating a Sensor Report Exercise 1: Designing Data Access for Sensor Data Exercise 2: Designing a Processing Solution for the Report Exercise 3: Designing a Processing Solution for the Approval 6 6 7 2 4 5
Some of the key drawbacks of a JavaScript-based client are the following: JavaScript can be turned off by the user or broken by other components of the page (reliability). JavaScript performance isnt optimal because of the language design (performance). JavaScript is, relatively speaking, considered to be more difficult to debug than other programming languages because it isnt type safe (maintenance). The engineering developers are unlikely to be able to adapt to JavaScript (weakly typed language) from C++ (strongly typed language) quickly and easily (startup time). Every client solution would require that the data be transmitted to the client, which may be an issue depending on connectivity.
Some of the key drawbacks to a Silverlight client are the following: It requires the installation of the Silverlight client. Every client solution would require that the data be transmitted to the client, which may be an issue depending on connectivity.
Some of the key drawbacks to another external client are the following: There is higher operational complexity with two (or more) interrelated systems. Type-safe checking and error handling are likely to be difficult, complex, or time consuming.
The sandboxed solution can be deployed safely because of the protection and monitoring offered by the sandbox.
Module 7
Lab Answer Key: Designing Packaging
Contents:
Lab A: Building a Business Document Solution Exercise 1: Designing a Solution Exercise 2: Creating the Final Solution Lab B: Working with Dependencies Exercise 1: Creating a Common Assembly Exercise 2: Creating a Dependent Solution 8 9 2 4
Can there be more than one certification package library (CPL) per site? Purpose of question. Its important to understand the business logic and governance requirements.
Is there a naming convention for the list? Purpose of question. You understand that a CPL is a company standard. However, does the name of each CPL also need to follow a standard? If so, how is that controlled?
Have the content types been defined elsewhere? Purpose of question. Try to use existing work, especially when it comes to site columns and content types. You do not want to create a duplicate content type. The offshoot of this question is deciding whether you need to set up a common set of content types that can be used by others.
Do any of the content type fields require additional setup work? Purpose of question. The initialization of some fields may require custom code, which means you need to create a feature receiver or some other setup code.
Can there be more than one certification package type per list? Purpose of question. Multiple content types on a list are useful. However, multiple types introduce opportunities for users to apply the wrong one. You may also need to be concerned with default upload behavior where the first content type is applied to an uploaded document.
How often will certification package lists need to be created? Purpose of question. Will certification package list creation be a task you repeat many times over? If so, maybe the final design should include a programmatic provisioning mechanism that is triggered by workflow, a timer job, custom data, or something similar.
What is the intended livelihood of the data after it is created? Purpose of question. It is really important to understand how long the data is going to live or needs to be retrieved. This in turn affects your final design for both upgrade and administrative archival.
The CPL_ContentTypes Feature has the following characteristics: It is hidden. It contains one content type that inherits from the Document content type.
4. 5.
3. 4.
Select Site from the Scope drop-down list. In the Items in the Solution list box, select Content Type, and click the button with the right angle bracket (>). The content type will now appear in the Items in the Feature list box. Click Save. In Solution Explorer, rename the newly created feature Feature2 CPL_ContentTypes. Right-click the feature, and click View Designer. In the Properties pane, change the Is Hidden value to True.
5. 6. 7. 8.
9.
Click Save.
5.
3. 4.
Notice that the scope is selected as Web by default. In the Items in the Solution list box, select List Definition, and click the button with the right angle bracket (>). The list definition appears in the Items in the Feature list box. Click Save. In Solution Explorer, rename the newly created feature Feature2 CPL_ListDefinition.
5. 6.
Task 6: Ensure that the CPL_ContentTypes feature contains only one element
1. 2. In Solution Explorer, right-click CPL_ContentTypes, and click View Designer. Notice that there is only one content type in the Items in the Feature list box.
9.
10. Select the Yes option in Allow management of content types, and then click OK. 11. On the List Settings page, do the following: Verify that the Contoso.CertificationPackageList - Certification Package Documents content type is associated with the list.
Results: After this exercise, you should be able to see how different design choices can result in different packaging designs. A few subtle changes here and there, and this design could have had a different layout and end-user experience.
Note: Note that the Deploy as a sandboxed solution option is in the SharePoint Customization Wizard.
4. 5. 6. 7. 8.
Click Finish. In the Sandboxed project, right-click References and then click Add Reference. In the Add Reference dialog, click the Projects tab and then select the Contoso.DemoApplication.Common project. Click OK. Right-click the project, point to Add, and then click New Item. In the templates displayed, click Web Part, specify the name of the Web part as CustomDataDisplay, and then click Add.
10
9.
10. Open Package Designer for the farm solution and click Manifest. Record the solution ID. You use this in the next step. 11. Open Package Designer for the sandboxed solution. 12. Click Manifest. 13. Click Edit Options. This opens the advanced text box where you can enter custom XML that will be integrated with other settings. Visual Studio merges all information to create a composite solution manifest. 14. Add the following XML to the Manifest Template text box:
<?xml version="1.0" encoding="utf-8"?> <Solution xmlns="http://schemas.microsoft.com/sharepoint/"> <ActivationDependencies> <ActivationDependency SolutionId="ADD THE ID FROM THE FARM SOLUTION"/> </ActivationDependencies> </Solution>
11
Note: You see Show Error Details only if Callstack is set to True in the Web applications Web.config file. You should set the value to True only in development environments.
12
Note: No error messages are shown during the removal of the farm solution. Dependencies are not checked. Therefore, you can end up in a scenario where previously working code breaks because the dependency has been removed.
Results: After this exercise, you will have created a dependency between two solutions, verified that a properly sequenced install is possible, verified that the dependent code breaks when the parent solution is removed, verified that SharePoint did not stop removal of the parent solution, and verified installation was prevented when an attempt to install the dependent solution was made without the parent solution.
Module 8
Lab Answer Key: Designing a Development Strategy
Contents:
Lab A: Team-Based Logging and Configuration Exercise 1: Appraising the List-Based Configuration Exercise 2: Using a SharePoint List-Based Configuration Exercise 3: Using SharePoint List-Based Logging Exercise 4: Configuring the Logging Level Lab B: Operational Logging Exercise 1: Adding Logging to SharePoint ULS 18 2 3 9 15
Possible Solutions
SPList provides a good solution in terms of: Security Line manager read/write Team members Read only Easily extendable to multiple configurations Can be used by custom code/web parts (example) Can use used by OOB functionality
5.
6.
4.
Click Save.
4.
Click Save.
else { var query = new SPQuery { Query = "", RowLimit = 1 }; var items = configList.GetItems(query); var existingListItem = items[0]; existingListItem[Constants.TargetForWeekFieldName] = Convert.ToInt32(_txtCurrentTarget.Text); existingListItem.Update(); } }
4.
Click Save.
4.
Add the following code to the file, replacing only the commented out FeatureActivated method:
public override void FeatureActivated(SPFeatureReceiverProperties properties) { //Add a configuration list to root web var sc = properties.Feature.Parent as SPSite; var site = sc.RootWeb; var list = site.Lists.TryGetList(Constants.ConfigurationList); if (list == null) { Guid listId = site.Lists.Add(Constants.ConfigurationList, "", SPListTemplateType.GenericList); list = site.Lists[listId]; list.Fields.Add(Constants.TargetForWeekFieldName, SPFieldType.Integer, true); list.Update(); var configItem = list.AddItem(); configItem["Title"] = "Configuration - Do Not Delete"; configItem[Constants.TargetForWeekFieldName] = 1; configItem.Update(); } }
5.
Add the following code to the file, replacing only the commented out FeatureDeActivating method:
public override void FeatureDeactivating(SPFeatureReceiverProperties properties) { //remove the list - Consider if you should do this or not var sc = properties.Feature.Parent as SPSite; var site = sc.RootWeb; var list = site.Lists.TryGetList(Constants.ConfigurationList); if (list != null) list.Delete(); }
6.
Click Save.
Return to Home Page. Click Page Tab and then click Edit Page. In the Left Web part zone, click Add a Web Part. In the Categories list, click Custom. Notice that PlantMonitorSetter and PlanTargetMonitor Web Parts are listed. Select PlantMonitorSetter and click Add. Select PlantTargetMonitor and click Add. Enter a target value in the Setter Web part.
10. Click the Set Target for Current Week button. Verify the value is shown in the Monitor Web partPart.
4.
Click Save.
10
3.
Add the following code to the file, replacing the FeatureActivated and FeatureDeactivating methods:
public override void FeatureActivated(SPFeatureReceiverProperties properties) { //Add a configuration list to root web var sc = properties.Feature.Parent as SPSite; var site = sc.RootWeb; CreateConfigurationList(site); CreateLogList(site); } public override void FeatureDeactivating(SPFeatureReceiverProperties properties) { //remove the list - Consider if you should do this or not var sc = properties.Feature.Parent as SPSite; var site = sc.RootWeb; DeleteConfigurationList(site); DeleteLogList(site); } private void DeleteLogList(SPWeb site) { var loglist = site.Lists.TryGetList(Constants.SPLogList); if (loglist != null) loglist.Delete(); } private void DeleteConfigurationList(SPWeb site) { var list = site.Lists.TryGetList(Constants.ConfigurationList); if (list != null) list.Delete(); }
11
private void CreateLogList(SPWeb site) { var logList = site.Lists.TryGetList(Constants.SPLogList); if (logList == null) { Guid listId = site.Lists.Add(Constants.SPLogList, "", SPListTemplateType.GenericList); logList = site.Lists[listId]; logList.Fields.Add(Constants.LogLine, SPFieldType.Text, true); logList.Fields.Add(Constants.DateAndTimeOfLog, SPFieldType.DateTime, true); logList.Update(); } } private void CreateConfigurationList(SPWeb site) { var list = site.Lists.TryGetList(Constants.ConfigurationList); if (list == null) { Guid listId = site.Lists.Add(Constants.ConfigurationList, "", SPListTemplateType.GenericList); list = site.Lists[listId]; list.Fields.Add(Constants.TargetForWeekFieldName, SPFieldType.Integer, true); list.Update(); var configItem = list.AddItem(); configItem["Title"] = "Configuration - Do Not Delete"; configItem[Constants.TargetForWeekFieldName] = 1; configItem.Update(); } }
4.
Click Save.
12
13
4.
5.
6.
Click Save.
14
Enter a target value in the Setter Web part. Click the Set Target for Current Week button. Verify that the change has been logged to the LogList.
5.
Enter a target and click the Set Target for Current Week with Error button. Verify that the error has been logged to the LogList.
6.
15
4.
Click Save.
16
3. 4.
Locate the method BtnSubmitCurrentTargetClick. Replace the call to LogEvent with the code:
LogEvent(string.Format("Current target for week set at : {0}", _txtCurrentTarget.Text), LogLevel.Info);
5.
Add the following code to the file, replacing the LogEvent method:
private void LogEvent(string message, LogLevel level) { if (level >= _logLevel) { var currentWeb = SPContext.Current.Web; var currentWeekTargetList = currentWeb.Lists[Constants.SPLogList]; // Add a new item var spListItem = currentWeekTargetList.AddItem(); spListItem[Constants.LogLine] = string.Format(message); spListItem[Constants.DateAndTimeOfLog] = DateTime.Now; spListItem.Update(); } }
17
Choose Error as the logging level. Click OK. Click Stop Editing in the ribbon. Verify Logging Level.
8. 9.
Set the target using the Set Target for Current Week. Click Lists and verify that no entry has been added to the LogList.
10. Click Home. 11. Set the target using the Set Target for Current Week with Error. 12. Click Lists and verify that an entry has been added to the LogList. 13. Close Internet Explorer.
18
4.
{0}",
5.
Click Save.
19
Add both Web parts to the page. Click Stop Editing. Set the target using the Set Target for Current Week with Error. Click Lists and verify that an entry has been added to the LogList.
10. Open Windows Explorer. 11. Navigate to Logs below the SharePoint root (C:\Program Files\Common Files \Microsoft Shared\Web Server Extensions\14\Logs). 12. Order the files by date modified to find the latest file. 13. Using Notepad, open the file. 14. Search for the phrase Plant Targets Setter Web Part.
Module 9
Lab Answer Key: Developing Version and Deployment
Contents:
Lab A: Versioning Assemblies Exercise 1: Defining Base Version Exercise 2: Upgrading the Assembly Lab B: Feature Upgrade Exercise 1: Creating Upgrade Manage Page Exercise 2: Adding Feature to Upgrade Exercise 3: Upgrading Feature 10 14 17 2 5
6.
4.
5.
Click Save.
8. 9.
In the Categories list, click Custom. Notice that VersionWebPart Web Part is listed. Select VersionWebPart and click Add.
10. Click Stop Editing. Notice that the VersionWebPart displays Assembly Version 1.0.0.0.
Results: After this exercise, you will have defined a basic version for the feature and also will have demonstrated that the default assembly version for the Web Part assembly is 1.0.0.0.
to
[assembly: AssemblyVersion("1.1.0.0")]
5. 6.
Press CTRL+SHIFT+B to build the solution. This will update the compiled assembly and the SharePoint tools in Visual Studio. Click Save.
where <project dir> is the location of the Contoso.Version project. You can check that by right-clicking the Contoso.Version project and select Open Folder in Windows Explorer. 4. Return to Internet Explorer and navigate to http://sharepoint/student /module9/. (If the page is already open, click Home.) Notice that the Web Part added previously now reports an error. It cannot be loaded because it cant find the v1.0.0.0 of the Contoso.Version .dll. Click the Page tab and select Edit Page.
5.
6. 7. 8. 9.
In the Left Web part zone, click Add a Web Part. In the Categories list, click Custom. Notice that VersionWebPart Web Part is listed. Select VersionWebPart and click Add. Click Stop Editing. Notice that the VersionWebPart displays Assembly Version 1.1.0.0.
4.
Click the plus sign next to Edit Options at the bottom of the designer. Copy the <Assemblies> tag from Manifest and paste it into the <Solution> tag in the Edit Options window. Edit the copied SafeControl entry in the Edit Options window to read, Version 1.0.0.0.
5.
Manifest should look similar to the screenshot below with two SafeControl entries.
2. .
Click Save. .
3.
where <project dir> is the location of the Contoso.Version project. You can check that by right-clicking the Contoso.Version project and select Open Folder in Windows Explorer. 4. Return to Internet Explorer and navigate to http://sharepoint/student /module9/. (If the page is already open, click Home.) Notice that the Web Part added previously now reports assembly version 1.1.0.0.
Results: After this exercise, you will have demonstrated how it is possible using the new features of SharePoint 2010 to automatically provide assembly versioning and binding redirects.
10
11
8.
Click Save.
3.
12
4.
13
void btnUpgrade_Click(object sender, EventArgs e) { string featureId = ((Button)sender).Attributes["FeatureID"]; SPFeature feature = SPContext.Current.SiteFeatures[new Guid(featureId)]; feature.Upgrade(false); }
5.
Click Save.
Results: After this exercise, you will have created an application page that queries features in the site collection that need to be upgraded. You will have added an upgrade event handler to the feature that will be called during the upgrade event. You will also have provided specific version information that defines when the upgrade action is called and that action has been passed in the event handler. Based on this understanding of the upgrade framework, you should now be able to work through all of the scenarios.
14
10. In the Feature designer, change the Scope to Site. 11. Build the solution by pressing CTRL+SHIFT+B. 12. Right-click the project and choose Package. 13. Right-click the project and choose Deploy.
15
3.
4. 5. 6. 7. 8. 9.
Double-click the Contoso.Upgrade.SiteCollection feature. In the Properties window, copy the Receiver Assembly value to Upgrade Actions Receiver Assembly value. Copy the Receiver Class value to the Upgrade Actions Receiver Class value. Change the Version property to 2.0.0.0. In the feature designer, click Manifest and copy the created <UpgradeActions /> line from the preview. Paste the value in the Edit window. The preview window should remain the same.
16
Results: After this exercise, you will have deployed a feature that will place an entry into a log upon being upgraded.
17
replacing <project dir> with the location of the Contoso.Upgrade project. Tip, right-click the project and choose Open Folder in Windows Explorer. 5. 6. Type Iisreset to flush the ASP.NET cache. Navigate to http://<siteurl>/_layouts/Contoso.Upgrade /FeatureManager.aspx. Verify that the Contoso.Upgrade feature is listed and shows the feature version 2.0.0.0 and the activated version 1.0.0.0.
Task 2: Upgrade
1. 2. 3. Click the Upgrade button to upgrade this site collection instance of the feature. Refresh the page and verify the feature is no longer listed. Navigate to the Contoso.Upgrade list. Verify that there is one entry in the list showing something similar to: Performed Upgrade Action UpgradeTo2.0.0.0 on Feature FeatureDefinition/c93306cb-f83a-4aa2-a321-4e5cfd5f7aeb from version 1.0.0.0 to 2.0.0.0.
Results: After this exercise, you will have an entry in the upgrade log indicating that the upgrade has been performed.
Module 10
Lab Answer Key: Designing Information Architecture and Navigation
Contents:.
Lab A: Developing a Site Structure Exercise 1: Using Card Sort Exercise 2: Designing Content Types and Site Columns Lab B: Implementing Farm-wide Navigation Exercise 1: Deploying a Custom SiteMap Exercise 2: Adding an ASPmenu to a Custom Master Page 5 7 2 4
Guideline Review
Here are the guidelines and why theyre important: You should try to create a maximum of five main categories. Reasoning: Its easy to create hierarchies that are overly flat (too many items at one level) and overly deep (too many levels deep). Five main categories as a guideline tries to keep the set to a manageable size and encourages the right balance of depth versus breadth. You may create up to five subcategories per category until youve developed an appropriate categorization tree. Reasoning: The objective is to ensure that were keeping a relatively good substructure, again to encourage a balance of depth versus breadth. You may not use the department names (included in the beginning of the item for reference) in your content category. Reasoning: Organizing by department is easy. Its encouraged by providing where the type of content comes from in the list. The exercise is deliberately putting a department organization at odds with the objective. Break into groups and start working for 10 minutes. Then get back together to further discuss the task. Reasoning: In most cases, the class will get stuck, or a portion of the class will get stuck. Its important that everyone realize that help is available.
Facilitation Notes
The facilitator should provide alternative approaches to organization, particularly if the students are stuck. Here are a few ideas and examples:
Organize by consumer rather than creatorthat is, who needs to know the information, the employee or the customer? Organize by process or flow. Some information is about taking care of customers. Other information is about managing vendors. Irrespective of which department creates the data, organize it by who needs it and when. Look for content (cards) that dont look like they belong in one department. Develop a grouping around those items that dont fit neatly into specific departments. Consider a contract with a customer. Is that a sales item, a legal item, or an accounting item?
Results: After completing this exercise, you should have an understanding of how to apply an information architecture to content type and site column selection in SharePoint.
6. 7. 8. 9.
Note: In a multiple Web front-end server environment, the command line must be run once on each server. Invoking the SPWebService.ApplyApplicationContentToLocalServer method will accomplish the same thing, but since it only runs on one server, you would need to create a custom timer job that would invoke the API on each Web front-end server.
7.
Add the following code on the line above the DeveloperDashboard tag:
<hr /> <div style="position:relative; left:50%; margin-left:-25%; "> <SharePoint:AspMenu ID="FarmNavigationMenuV4" Runat="server" EnableViewState="false" DataSourceID="FarmSiteMap" AccessKey="<%$Resources:wss,navigation_accesskey%>" UseSimpleRendering="true" UseSeparateCss="false" Orientation="Horizontal" StaticDisplayLevels="2" MaximumDynamicDisplayLevels="0" SkipLinkText="" CssClass="s4-tn"/> <asp:SiteMapDataSource ShowStartingNode="True" StartingNodeUrl="http://sharepoint/student/module10/" SiteMapProvider="SPXmlContentMapProvider" ID="FarmSiteMap" runat="server"/> </div>
8. 9.
10. Select the Module item. 11. Specify the name of the module as CopyMaster and then click Add. 12. Right-click the CopyMaster module, point to Add, and select Existing Item. 13. Select V4global.master from the Desktop folder and click Add. 14. Right-click the file Sample.txt in the CopyMaster module folder and select Delete. 15. Click OK to confirm. 16. Modify the Elements.xml for the module so that it matches the following code:
<?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <Module Name="CopyMaster" Url="_catalogs/masterpage"> <File Path="CopyMaster\V4global.master" Url="V4global.master" IgnoreIfAlreadyExists="True" Type="GhostableInLibrary"> <Property Name="ContentType" Value="Master Page" /> <Property Name="UI Version" Value="4" /> </File> </Module> </Elements>
5.
6. 7.
Right-click the Contoso.GlobalNav project and select Deploy. Navigate to the site you chose as the target when you created the project in Exercise 1. You should see a new global navigation footer at the bottom of the page.
Note: You have added only the V4global.master to one site in this exercise. You would need to deploy and activate the custom master to other sites for the navigation to be complete.
Results: After completing this exercise, you should have an understanding of how to implement a custom global navigation system for a SharePoint site.
Module 11
Lab Answer Key: Designing Branding and Customization Support
Contents:
Lab A: Packaging Branding Exercise 1: Importing .wsp Files into Microsoft Visual Studio Exercise 2: Extracting the File Resources Exercise 3: Writing the Feature Receiver to Apply Changes Exercise 4: Testing the Changes Lab B: Improving Branding Performance Exercise 1: Observing Current Performance Exercise 2: Turning on BLOB Caching Exercise 3: Observing BLOB Cached Performance Exercise 4: Observing _layouts Performance 9 10 11 12 2 4 6 8
10. Click Next. 11. When the list of items to import appears after some delay, click Finish. 12. In the Import Completed dialog box, click OK.
Task 2: Copy the master page resources to the Contoso Branding project
1. 2. In Solution Explorer, drag the Master_Page_Gallery folder from Contoso.BrandingImport to the Contoso.Branding project. In the Solution Explorer, in the Contoso.Branding project, delete the following subfolders of the Master_Page_Gallery: _catalogsmasterpage_Features_EnterpriseWikiLayouts_PageLayouts _catalogsmasterpage_Features_PublishingLayouts_MasterPages _catalogsmasterpage_Features_PublishingLayouts_PageLayouts _catalogsmasterpage_Features_PublishingResources _catalogsmasterpage_Features_PublishingResources1 _catalogsmasterpage_global
Task 3: Copy the site assets resources to the Contoso Branding project
In Solution Explorer, drag the Site_Assets folder from Contoso.BrandingImport to Contoso.Branding.
3.
Remove the commented FeatureDeactivating method and paste in the following code:
public override void FeatureDeactivating(SPFeatureReceiverProperties properties) { SPWeb curWeb = properties.Feature.Parent as SPWeb; if (curWeb != null) { curWeb.MasterUrl = curWeb.ServerRelativeUrl + "/_catalogs/masterpage/v4.master"; curWeb.CustomMasterUrl = curWeb.ServerRelativeUrl + "/_catalogs/masterpage/nightandday.master"; curWeb.Update(); } }
Task 2: Deactivate the feature and ensure the site still works
1. 2. 3. 4. 5. In the Site Actions menu, select Site Settings. In the Site Actions group, select Manage site features. To the right of the Apply Contoso Branding feature, click Deactivate. On the feature deactivation confirmation page, click the Deactivate this feature link. Verify that the Contoso branding is no longer displayed.
2. 3. 4. 5.
10
11
12
Module 12
Lab Answer Key: Designing Security
Contents:
Lab A: Setting Up a Customer Service Site Exercise 1: Setting Up the Authentication Provider Exercise 2: Creating an FBA-Claims Site Optional Exercise 3: Viewing Claims for an FBA User Lab B: Solving a Security Issue Exercise 1: Understanding the Scope and Relating it to Configuration Exercise 2: Designing a Security Strategy 14 15 2 6 13
These two requirements point us in the direction of a solution that leverages formsbased authentication. By setting up a custom database that is housed internally (on Contoso property), we are able to isolate user identities and provide Contoso employees the ability to manage user accounts that will be needed to access the site. Knowing that we plan to use FBA, we also know that our Microsoft SharePoint Web application must be set up to use claims-mode authentication.
Task 2: Set up the FBA database and verify you can manage users
1. Start the ASP.NET SQL Server Setup wizard. The setup file is located at %windows%\Microsoft.Net\Framework64\ v2.0.50727\aspnet_regsql.exe. a. b. c. Once the wizard is displayed, click Next. Click Next. In the Server text box, type .\SharePoint.
Create a folder for the FBA user maintenance Web site. Create a folder at the location c:\inetpub\wwwroot\ named fba.
3.
Go to the Start menu, point to Administrative Tools and click on IIS Manager. a. b. c. Click the Sites node from the tree view shown in the Connection pane. In the Actions pane, click Add Web Site. Specify fba as the site name and press TAB.
d. Select SharePoint80 as the application pool. e. f. 4. Specify c:\inetpub\wwwroot\fba as the physical path to the site. Specify fba as the Host name and click OK.
Go to Start menu, point to All Programs, point to Microsoft SQL Server 2008, and click on SQL Server Management Studio. a. b. c. Ensure the server name is .\SharePoint. Click Connect. In Object Explorer, expand the Databases node.
d. Expand the aspnetdb node. e. f. g. h. i. 5. 6. Right-click the Security node. Click New and then click User. Specify Network Service as user name and press TAB. Specify NT AUTHORITY\NETWORK SERVICE as login name and press TAB. In Database role membership, select the db_owner check box.
Click OK. In Windows Explorer or a Command Prompt, navigate to the root folder for the fba Web site (c:\inetpub\wwwroot\fba).
7.
Create a web.config file and add the following text to the file:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <connectionStrings> <add name="fbaSQL" connectionString="Server=.\SHAREPOINT;Database=aspnetdb;Integrated Security=true" /> </connectionStrings> <system.web> <!-- membership provider --> <membership defaultProvider="fbaMembers"> <providers> <add name="fbaMembers" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="fbaSQL" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" /> </providers> </membership> <!-- role provider --> <roleManager enabled="true" defaultProvider="fbaRoles"> <providers> <add name="fbaRoles" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="fbaSQL" applicationName="/" /> </providers> </roleManager> <authentication mode="Forms" /> </system.web> </configuration>
8.
At this point, you should be able to go back to the Internet Information Services (IIS) Management console and add at least one user to your new FBA database and grant one user access to the site. a. b. Return to the IIS Manager window. Select the fba Web site in the tree view shown in the Connections pane, and then double-click .Net Users.
c.
Add at least one user. You will need to grant one user access to the site to complete this lab.
d. In the Actions pane, click Add. e. f. 9. Specify user name, e-mail, and password. These values are the students choice. Click Next.
Click Finish.
10. You can also define roles and associate users with those roles. For demo purposes, create at least one role and associate the user from Step 6 with the role. 11. Select the fba Web site, and then double-click .Net Roles. 12. In the Actions pane, click Add. a. b. c. Specify a name in the Add .Net role popup window. This value is the students choice. Click OK. Return to the .Net Users section.
d. Double-click the user you created. e. f. Select the newly created role to associate the user with the role. Click OK.
d. Type fbaMembers in the ASP.NET Membership provider name field. e. f. g. h. 5. 6. 7. Type fbaRoles in the ASP.NET Role Manager name field. Choose Create a new application pool. Choose Predefined. Select Network Service.
Click Application Management. Click Create Site Collection. Select the new web application you just created. Set the title to Forms Site Collection and select the Team Site template. Specify the SHAREPOINT\Administrator account as the Primary Site Collection Administrator.
The web.config files are located in two different folders: The root folder for the Forms Web application is located under C:\inetpub\wwwroot\wss\VirtualDirectories\888. The root folders for Central Administration are located under C:\inetpub\wwwroot\wss\VirtualDirectories\28522. The root folder for the Security Token Service is located under C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions \14\WebServices\SecurityToken. Add the following connection string to the web.config files (as a child of the <configuration> node):
Note: Be sure to place this node after the configSections node; otherwise, you will get an error stating that configSections must be the first child of the configuration node.
<providers> <clear /> <add connectionStringName="fbaSQL" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" passwordAttemptWindow="10" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" name="fbaMembers" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </providers> </membership>
Task 5: Define membership and role providers for the Forms Web application
Update the membership and role provider information contained within Form Web applications web.config file with the following text:
<roleManager enabled="true" cacheRolesInCookie="false" cookieName=".ASPXROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All" defaultProvider="c" createPersistentCookie="false" maxCachedResults="25"> <providers> <clear /> <add connectionStringName="fbaSQL" applicationName="/" name="fbaRoles" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
10
<add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <add name="c" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthRoleP rovider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" /> </providers> </roleManager> <membership defaultProvider="i" userIsOnlineTimeWindow="15" hashAlgorithmType=""> <providers> <clear /> <add connectionStringName="fbaSQL" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" passwordAttemptWindow="10" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" name="fbaMembers" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <add name="i" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthMembe rshipProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" /> </providers> </membership>
11
Task 6: Define membership and role providers for the Security Token Service application
Update the membership and role provider information contained within the Security Token Services web.config with the following information:
Note: <system.web> does not exist in a default out-of-box installation. Add the following as the last child of the <configuration> node.
<system.web> <membership> <providers> <add connectionStringName="fbaSQL" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" passwordAttemptWindow="10" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" name="fbaMembers" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </providers> </membership> <roleManager enabled="true"> <providers> <add connectionStringName="fbaSQL" applicationName="/" name="fbaRoles" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </providers> </roleManager> </system.web>
12
Task 7: Use Central Administration to designate the first FBA user for the Forms Web application
1. 2. 3. In Central Administration, click on Application Management. Under Site Collections, click Change Site Collection Administrators. Select the site collection you created in Task 1.
4. Set one of the FBA users you created in Task 2 as a site collection administrator and click OK. If all associations have been properly set, the Central Administration site should be able to locate the FBA users.
Choose Forms Authentication. Login using the credentials of the user created in Exercise 1, Task 2. Once on the home page, select the user control that displays your user name (upper right corner).
b. c.
d. Select My Settings. 4. Verify that your login name has the new claims-based format.
13
14
15
Lab Answer Key: Designing for Page and Data Access Performance
Module 13
Lab Answer Key: Designing for Page and Data Access Performance
Contents:
Exercise 1: Using the SharePoint Server 2010 Developer Dashboard to Capture Performance Metrics Exercise 2: Leveraging the SharePoint Server 2010 Search API for Large Data Queries 2 8
Lab Answer Key: Designing for Page and Data Access Performance
2.
Lab Answer Key: Designing for Page and Data Access Performance
2. 3. 4. 5. 6. 7.
8. 9.
Add a custom monitor subscope to the GetListItems method to capture metrics for the query against the target SPList object. Click the plus sign to the left of the Methods region.
Lab Answer Key: Designing for Page and Data Access Performance
11. Wrap the preceding code in a new using statement and instantiate a new SPMonitoredScope. Because this scope is executed inside of the previous scope, it is displayed as a child object of the parent scope.
using (SPMonitoredScope getListItemsScope_Query = new SPMonitoredScope(GetListItems_Query)) { //Existing code }
Lab Answer Key: Designing for Page and Data Access Performance
12. Click the Contoso.Performance.ListViewWebPart project. In the Properties window, change the Site URL property to http://sharepoint/student /module13/. 13. Press F5 to build and deploy the solution automatically. 14. Alternatively, right-click the Contoso.Performance.ListViewWebPart project and select Deploy.
Lab Answer Key: Designing for Page and Data Access Performance
The Developer Dashboard will load at the bottom of the page. Note that the custom scopes added to the ListViewWebPart do not appear in the list of monitored events:
8.
In the Contoso Performance List View Web Part, select the Contoso Widgets list option from the drop-down list box, and then click Get List Items.
Lab Answer Key: Designing for Page and Data Access Performance
9.
Review the updated information in the Developer Dashboard. Note that the custom GetListItems scope is present, along with the associated GetListItems_Query subscope.
10. Review the performance metrics provided. Take note of the additional entries in the Database Queries section and the difference in overall execution time.
Results: After this exercise, you should have instrumented the code to write output results to the Developer Dashboard and deployed the solution to SharePoint.
Lab Answer Key: Designing for Page and Data Access Performance
Exercise 2: Leveraging the SharePoint Server 2010 Search API for Large Data Queries
Task 1: Create a search query to retrieve list items
1. 2. 3. 4. 5. Locate and expand the Contoso.Performance.ListViewWebPart project in the Contoso.Performance solution. Click the plus sign to the right of the ListViewSearchWebPart project item. Click the plus sign to the right of ListViewSearchWebPartUserControl.ascx. Double-click the ListViewSearchWebPartUserControl.ascx.cs file. Modify the GetListItems method to retrieve list items from the search results by retrieving the specified list using the Web and ListName parameters passed into the method:
SPList list = web.Lists[ListName];
6.
Remove spaces from the list name to match the value of the managed metadata property created in the previous task:
ListName = ListName.Replace(" ", "");
7.
9.
Assign a search query string to the searchQuery object. This query selects specific columns from the search results using the previously assigned managed metadata properties and the default search scope:
searchQuery.QueryText = "SELECT Title, ProductID, ProductQuantity FROM Scope() WHERE CONTAINS (*, '" + ListName + "')";
Lab Answer Key: Designing for Page and Data Access Performance
11. Create a custom monitor subscope to measure the search query execution:
using (SPMonitoredScope getListItemsScope_Query = new SPMonitoredScope("GetListItemsSearch_SqlQuery")) { }
14. Populate the previously created DataTable object with the query results:
dt.Load(relevantResults, LoadOption.OverwriteChanges);
15. Bind the DataTable to the GridView to display the query results in the Web Part:
ListViewGrid.DataSource = dt; ListViewGrid.DataBind(); ListViewGrid.Visible = true;
10
Lab Answer Key: Designing for Page and Data Access Performance
5. 6. 7.
Click Stop Editing on the ribbon. Click the Developer Dashboard icon located in the upper right of the page. If you get a dialogue box asking that the page needs to be resent, click Retry. In the Contoso Performance List View Web Part, select the Contoso Widgets option from the drop-down list, and click the Get List Items button.
Lab Answer Key: Designing for Page and Data Access Performance
11
8.
Review the execution metrics in the Developer Dashboard and compare them to the metrics reported when retrieving items with the ListViewWebPart that does not use the Search API. The performance of the Search Web Part should be significantly better. Also, note the additional performance data available in the Developer Dashboard from the Search query.
Results: After this exercise, you should have configured Search, modified the code to retrieve list items using the Search API, and compared the performance metrics in the Developer Dashboard.
Module 14
Lab Answer Key: Designing a Testing Strategy
Contents:
Exercise 1: Conducting Unit Testing Exercise 2: Conducting Performance Testing Exercise 3: Conducting Load Testing 2 8 10
Create a new test project. a. Right-click the GetListAsGridView method within the Contoso.Testing.WebParts.ListView_View class.
b.
Select Create Unit Tests from the context menu. In the Create Unit Tests dialog box, be sure that the GetListAsGridView method is selected. In the Output Project options at the bottom of the dialog, select Create a new Visual C# test project, and then click OK.
c.
Enter Contoso.Testing.UnitTests as the name of the new project. Microsoft Visual Studio will generate the project and open the ListView_ViewTest.cs class file in the IDE.
d. Add a Using statement for System.Xml to the ListView_ViewTest.cs class file. 3. Author and validate unit tests. a. i. Arrange the test. Locate the automatically generated test method entitled GetListAsGridViewTest (the method will be decorated with the [TestMethod()] attribute).
ii. iii.
Delete the generated code. Prepare the test by creating the necessary objects and variables. The test will require a valid DataTable object with at least one column and one row of data. The data table will need at least one column title that is XML encoded in order to verify the text manipulation functions in the target method. In addition, a string value for the XML Decoded title and an integer value for the number of table rows will be needed to verify that the test returns valid results. Insert the following code into the GetListAsGridViewTest method:
//Arrange string tableColumnName = "Test_x0020_Column"; string tableColumnName_Decoded = XmlConvert.DecodeName(tableColumnName); DataTable testTable = new DataTable(); testTable.Columns.Add(tableColumnName); DataRow row = testTable.NewRow(); row[tableColumnName] = "Test Value"; testTable.Rows.Add(row); int tableRows = testTable.Rows.Count;
b.
Add test actions. Using the newly created DataTable, call the ListView_View.GetListAsGridView method and retrieve the resulting row count and column name into new variables:
//Act GridView testGrid; testGrid = ListView_View.GetListAsGridView(testTable); int gridRows = testGrid.Rows.Count; string gridColumnName = testGrid.HeaderRow.Cells[0].Text;
c. i.
Create test assertions. The result of these assertions determines whether the test passes or fails. Verify that the number of rows in the GridView equal the number of rows in the test DataTable object:
//Assert Assert.AreEqual(tableRows, gridRows);
ii.
Verify that the encoded column name set in the Arrange section has been properly decoded and is equal to the tableColumnName_Decoded variable:
Assert.AreEqual(tableColumnName_Decoded, gridColumnName);
4.
Execute the Unit Test. Right-click the GetListAsGridViewTest method and select Run Tests. After the test completes, the Test Results window will appear. If the test was successful, a Passed value will be displayed in the Results column:
5.
Automate test execution. i. Create a Test List. From the Test menu, select Create New Test List.
ii.
Type UnitTests as the name of the new Test List and click OK.
iii.
Click the All Loaded Tests in the test explorer tree view. Check the box next to the GetListAsGridView_Test test.
iv. v.
Save the solution. This will generate a .vsmdi file needed by the MSTest.exe command-line utility to run the specified tests. Open the Properties window of the Contoso.Testing.WebParts project.
vi.
On the Build Events tab, insert the following command as the value of the post-build event command line:
"$(DevEnvDir)mstest.exe" /testmetadata:"$(SolutionDir)Contoso.Testing.vsmdi" /testlist:UnitTests
This command will invoke the MSTest utility, load the test metadata from the .vsmdi file located in the root of the solution, and execute the tests specified in the UnitTests Test List. vii. viii. Open the Output window (View > Output). Rebuild the Contoso.Testing solution. Note the results of the unit tests in the Output window.
Results: After this exercise, you should have created a unit test, executed the unit test, and automated execution of the unit test as part of the build process for the project.
d. In the Name field, type Contoso.Testing.Performance and click OK. e. By default, Visual Studio will assume that a unit test is desired and create a default class entitled UnitTest1.cs. Select this class in the Solution Explorer and delete it.
2. 3. 4.
Right-click the Contoso.Testing.Performance project and select Add > Web Performance Test. A browser window will appear. Enter the URL http://sharepoint/student/module14/default.aspx and press ENTER. After the page load is complete, click Stop in the Web Test Recorder pane. Visual Studio will automatically generate the test sequence and create a test class entitled WebTest1.webtest. Add a response time parameter to the test. a. b. c. Open WebTest1.webtest. Remove URL references to ScriptResx.ashx from the list of target URLs for the WebTest1 object. Right-click the remaining URL node in WebTest1 and select Properties.
5.
d. In the Properties pane, scroll down to the Response Time Goal parameter and enter a value of 8. This indicates that a successful request for this URL will respond in 8 seconds or fewer. 6. Run the test and analyze the results. a. Review the performance data in the test result report. Note the Status, Total Time, and Request Time statistics for the base URL.
b. c. 7.
Expand the base URL node and note the statistics for each linked resource.
Review the Details window to view results of the default validations for Response URL and Response Time Goal. Close the Test Results tab.
Add a validation rule and run the test again to execute the rule. a. b. c. Right-click the WebTest1 node and select Add Validation Rule. Select the Find Text rule. In the Find Text field, type Contoso Performance List View and click OK.
Note: This step requires either that Exercise 1 be completed and the Contoso Performance List View Web Part has been deployed or that a sample Web Part of any type be added to the page entitled Contoso Performance List View with the default chrome options enabled.
d. Run the test again. e. Review the Details window to determine the status of the Find Text validation rule.
Results: After this exercise, you should have created a performance test and validated the results of the tests against the target web application.
10
11
b.
In the Enter a name for the load test scenario field, enter Contoso Performance Load Test and select the Do not use think times option. Click Next to continue.
c.
12
d. In the Test Mix Model step, select the Based on the number of virtual users option, and click Next to continue.
e. i. ii.
In the Test Mix step, add a new Web test. Click the Add button. Select WebTest1 and move it to the list of selected tests.
13
iii. iv.
f.
In the Network Mix step, accept the defaults, and click Next to continue.
14
g.
In the Browser Mix step, accept the defaults and click Next to continue.
h.
In the Counter Sets step, add a computer to the counter set. i. ii. Click Add computer. Enter the name of the computer the test is being executed on, and select the ASP.NET check box. Click Next to continue.
iii.
15
i.
In the Run Settings step, change the run duration to 3 minutes. Click Finish to complete the wizard.
2.
Run the load test. a. In the LoadTest1.loadtest tab, click the run icon.
Visual Studio will initiate the load test and load the test monitors during test progress. b. 3. Take note of the various graphs in the test results report while the test is executing.
Results: After this exercise, you should have created a load test and validated the results of the test against the target web application.