Creating%20a%20 Custom%20 Site%20 Definition%20for%20 Microsoft%20 Windows%20 Share Point%20 Services
Upcoming SlideShare
Loading in...5
×
 

Creating%20a%20 Custom%20 Site%20 Definition%20for%20 Microsoft%20 Windows%20 Share Point%20 Services

on

  • 1,039 views

 

Statistics

Views

Total Views
1,039
Views on SlideShare
1,039
Embed Views
0

Actions

Likes
0
Downloads
6
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Creating%20a%20 Custom%20 Site%20 Definition%20for%20 Microsoft%20 Windows%20 Share Point%20 Services Creating%20a%20 Custom%20 Site%20 Definition%20for%20 Microsoft%20 Windows%20 Share Point%20 Services Document Transcript

  • Creating a Custom Site Definition for Microsoft Windows SharePoint Services
  • Table of Contents Creating a Custom Site Definition for Microsoft Windows SharePoint Services ..... 1 Exercise 1 Creating a Windows SharePoint Services Site Definition .................................................................2 Exercise 2 Modifying the Menu Bar for a SharePoint Site....................................................................................5 Exercise 3 Adding Custom Client-side Script Commands....................................................................................6 Exercise 4 Create a New Site Based on the Custom Definition ..........................................................................9
  • Creating a Custom Site Definition for Microsoft Windows SharePoint Services Creating a Custom Site Definition for Microsoft Windows SharePoint Services After competing this lab, you will be able to: Objectives Create a Windows SharePoint Services site definition Modify the site's menu bar Add custom commands to the user interface Create a new site based on the custom site definition The purpose of this lab is to learn how to create a new Windows SharePoint Scenario Services site definition, and how to customize specific appearances and behaviors for sites created using this new site definition. Estimated Time to 60 Minutes Complete This Lab Page 1 of 9
  • Creating a Custom Site Definition for Microsoft Windows SharePoint Services Exercise 1 Creating a Windows SharePoint Services Site Definition Scenario In this exercise, you will learn how to create a new global site definition. The easiest, most reliable way to do so is to copy an existing site definition and edit it. Tasks Detailed Steps 1. Connect to the a. Click inside the virtual machine window. virtual machine b. Press Right-ALT + DEL. c. Logon as Administrator to the CONTOSO domain with the password pass@word1. 2. Copy the default a. Double click the Jeff Teper.RDP remote desktop connection on the desktop. definition b. Enter the password pass@word1 if promoted. The Warm Up Demo script will run. This will take a few minutes. Please wait for it to finish and close. c. Minimize Internet Explorer. If the Contoso SharePoint page does not load up, click the Home icon, then minimize. d. On the desktop, double click My Computer and navigate to C:Program FilesCommon FilesMicrosoft Sharedweb server extensions60TEMPLATE1033. e. Right-click the STS directory and click Copy. f. Click Edit | Paste. g. Right click on the Copy of STS directory and click Rename. Type FOO to rename the directory and click in the white space in the folder. 3. Copy the definition a. Double-click the XML directory to open it. instruction file b. Right click on the WEBTEMP.XML file and click Copy. c. Click Edit | Paste. d. Right click on the Copy of WEBTEMP.XML file and select Rename. Type WEBTEMPFOO.XML to rename the file. 4. Edit the definition a. Right-click the WEBTEMPFOO.XML file and choose Edit with Visual Studio file .NET 2003. The WEBTEMP.XML file b. Highlight the following text (the MPS template section) and press DELETE: contains references to all of the standard site definitions included <Template Name=quot;MPSquot; ID=quot;2quot; > with Windows SharePoint <Configuration ID=quot;0quot; Title=quot;Basic Meeting Workspacequot; Services. We only need to keep Hidden=quot;FALSEquot; ImageUrl=quot;/_layouts/images/mwsprev.pngquot; one of the entries in Description=quot;All the basics to plan, organize and track WEBTEMPFOO.XML, so the your meeting. This Meeting Workspace contains the rest of the entries need to be following lists: Objectives, Attendees, Agenda, and removed. Document Library.quot;> </Configuration> <Configuration ID=quot;1quot; Title=quot;Blank Meeting Workspacequot; Hidden=quot;FALSEquot; ImageUrl=quot;/_layouts/images/mwsprev.pngquot; Description=quot;A blank Meeting Workspace for you to customize based on your requirements.quot;> </Configuration> <Configuration ID=quot;2quot; Title=quot;Decision Meeting Page 2 of 9
  • Creating a Custom Site Definition for Microsoft Windows SharePoint Services Tasks Detailed Steps Workspacequot; Hidden=quot;FALSEquot; ImageUrl=quot;/_layouts/images/mwsprev.pngquot; Description=quot;A Meeting Workspace in which to review relevant documents and record decisions. This Meeting Workspace contains the following lists: Objectives, Attendees, Agenda, Document Library, Tasks, and Decisions.quot;> </Configuration> <Configuration ID=quot;3quot; Title=quot;Social Meeting Workspacequot; Hidden=quot;FALSEquot; ImageUrl=quot;/_layouts/images/mwsprev.pngquot; Description=quot;A planning tool for social occasions, featuring a discussion board and a picture library to post pictures of the event. This Meeting Workspace contains the following lists and Web Parts: Attendees, Directions, Image/Logo, Things To Bring, Discussions, and Picture Library.quot;> </Configuration> <Configuration ID=quot;4quot; Title=quot;Multipage Meeting Workspacequot; Hidden=quot;FALSEquot; ImageUrl=quot;/_layouts/images/mwsprev.pngquot; Description=quot;All the basics to plan, organize and track your meeting with multiple pages. This Meeting Workspace contains the following lists: Objectives, Attendees and Agenda in addition to two blank pages for you to customize based on your requirements.quot;> </Configuration> </Template> c. Highlight the line that begins with the following text and press DELETE: <Configuration ID=quot;1quot; Title=quot;Blank Sitequot; d. Highlight the line that begins with the following text and press DELETE: <Configuration ID=quot;2quot; Title=quot;Document Workspacequot; e. Find the following line of text, highlight the name STS and press DELETE: <Template Name=quot;STSquot; ID=quot;1quot;> f. In its place, type FOO (the same name as you gave the directory you created above). g. In the same line of text, highlight the numeral 1 and press DELETE: h. In its place, type the number 97. i. Find the configuration line that begins with the following text: <Configuration ID=quot;0quot; Title=quot;Team Sitequot; j. Highlight the word Team Site and press DELETE. In its place, type FOO Site k. The file should now look like this: <?xml version=quot;1.0quot; encoding=quot;utf-8quot; ?> <!-- _lcid=quot;1033quot; _version=quot;11.0.5510quot; _dal=quot;1quot; --> <!-- _LocalBinding --> <Templates xmlns:ows=quot;Microsoft SharePointquot;> <Template Name=quot;FOOquot; ID=quot;97quot;> <Configuration ID=quot;0quot; Title=quot;Team Sitequot; Hidden=quot;FALSEquot; ImageUrl=quot;/_layouts/images/stsprev.pngquot; Description=quot;This template creates a site for teams to create, organize, and share information quickly and easily. It includes a Document Library, and basic lists such as Announcements, Events, Contacts, and Quick Links.quot;> </Configuration> </Template> </Templates> l. Click File | Save All. Page 3 of 9
  • Creating a Custom Site Definition for Microsoft Windows SharePoint Services Tasks Detailed Steps m. Click File | Exit. 5. Restart IIS a. Click Start | Run. b. In the Run dialog, type IISRESET /timeout:120 and press ENTER. Wait for the popup window to close. Page 4 of 9
  • Creating a Custom Site Definition for Microsoft Windows SharePoint Services Exercise 2 Modifying the Menu Bar for a SharePoint Site Scenario In this exercise, you will learn how to modify the menu bar (the HTML menu that appears at the top of all pages) for sites created from a your new custom site definition. Tasks Detailed Steps 6. Open the site a. In Windows file explorer, navigate to C:Program FilesCommon definition file FilesMicrosoft Sharedweb server extensions60TEMPLATE1033FOOXML. b. Right-click the file ONET.XML and click Edit with Visual Studio .NET 2003. 7. Add a link to My a. Locate the NavBars section in the ONET.XML file. It begins with the following Site text: <NavBars> b. Locate the NavBar named SharePoint Top Navbar. It is the line that begins with the following text: <NavBar Name=quot;SharePoint Top Navbarquot; c. On a new blank line beneath the line you just located, create a new node in the SharePoint Top Navbar by typing the following text: <NavBarLink Name=quot;My Sitequot; Url=quot;/MySitequot;> </NavBarLink> d. Click File | Save All. 8. Restart IIS a. Click Start | Run. b. In the Run dialog, type IISRESET /timeout:120 and press ENTER. Wait for the popup window to close. Page 5 of 9
  • Creating a Custom Site Definition for Microsoft Windows SharePoint Services Exercise 3 Adding Custom Client-side Script Commands Scenario In this exercise, you will learn how to configure custom client side scripts for the item menu. This setting is applied at site creation time, so you will not modify the behavior of existing sites. Tasks Detailed Steps 9. Add the a. In Visual Studio, find the Project element that begins with the following text: CustomJSUrl <Project Title=quot;Team Web Sitequot; parameter to new b. Place the cursor at the end of the element, immediately before the final > and press sites SPACEBAR. c. Type the following text in a single line to add an attribute to the node: CustomJSUrl=quot;/_layouts/[%=System.Threading.Thread.CurrentT hread.CurrentUICulture.LCID%]/new_ows.jsquot; d. When you are done, the full line should look something like this: <Project Title=quot;Team Web Sitequot; ListDir=quot;Listsquot; xmlns:ows=quot;Microsoft SharePointquot; CustomJSUrl=quot;/_layouts/ [%=System.Threading.Thread.CurrentThread.CurrentUICulture. LCID%]/new_ows.jsquot;> e. Click File | Save All. f. Click File | Exit. 10. Restart IIS a. Click Start | Run. b. In the Run dialog, type IISRESET /timeout:120 and press ENTER. Wait for the popup window to close. 11. Create the a. Return to the file explorer and navigate to C:Program FilesCommon new_ows.js file FilesMicrosoft Sharedweb server The command list for a extensions60TEMPLATELAYOUTS1033. document in a document library b. Click File | New | Text Document. is populated with custom JScript commands. You just instructed c. Type new_ows.js and press ENTER. Click Yes when prompted. the site definition to have all sites d. Right-click on the newly-created new_ows.js file and click Edit with Visual created based on it reference an Studio .NET 2003. additional JScript file named new_ows.js. e. Add the following JScript code to the file: This file need s to be created, function AddCheckinCheckoutMenuItem(m, ctx, url) and it must contain functions to { manipulate the command list and if (currentItemCheckedOutUserId == null) to react to the user choosing the { new custom command. currentItemCheckedOutUserId = itemTable.COUId; The command we will add will } pass the filename to a new ASP.NET page that checks out a if (currentItemCheckedOutUserId != quot;quot;) file and immediately issues a { HTTP GET that downloads it to strDisplayText = L_Checkin_Text; the user's local PC. strAction = quot;NavigateToCheckinAspx('quot; + ctx.HttpRoot + quot;', 'FileName=quot; + url + quot;')quot;; strImagePath = ctx.imagesPath + quot;checkin.gifquot;; CAMOpt(m, strDisplayText, strAction, strImagePath); } Page 6 of 9
  • Creating a Custom Site Definition for Microsoft Windows SharePoint Services Tasks Detailed Steps else { strDisplayText = L_Checkout_Text; strAction = quot;NavigateToCheckinAspx('quot; + ctx.HttpRoot + quot;', 'FileName=quot; + url + quot;&Checkout=true')quot;; strImagePath = ctx.imagesPath + quot;checkout.gifquot;; CAMOpt(m, strDisplayText, strAction, strImagePath); if (ctx.listTemplate == 101) { strAction = quot;CheckOutAndDownload('quot; + ctx.HttpRoot + quot;', 'FileName=quot; + url + quot;&Checkout=true')quot;; CAMOpt(m, quot;Check Out & Downloadquot;, strAction, strImagePath); CAMSep(m); } } } function CheckOutAndDownload(strHttpRoot, strArgs) { window.onfocus = RefreshOnNextFocus; SubmitFormPost(strHttpRoot + quot;/_layouts/quot; + L_Language_Text + quot;/CheckOutAndDownload.aspx?quot; + strArgs + quot;&Source=quot; + GetSource()); } f. Click File | Save All. g. Click File | Exit. 12. Create the ASPX a. In Windows file explorer, navigate to C:Program FilesCommon page used by the FilesMicrosoft Sharedweb server custom Check Out extensions60TEMPLATELAYOUTS1033. and Download b. Click File | New | Text Document. function c. Type CheckOutAndDownload.aspx and press ENTER. Click Yes when The custom JScript function prompted. CheckOutAndDownload will send the user's browser to an d. Double-click on the CheckOutAndDownload.aspx file to open it for editing in ASP.NET page named Visual Studio .NET. CheckOutAndDownload.aspx. It e. Add the following code to the file: will pass the document's URL as a parameter so the page can do <%@ Page language=quot;C#quot; EnableViewStateMac=quot;falsequot; %> two things that normally involve <%@ Register Tagprefix=quot;SharePointquot; separate steps in Windows Namespace=quot;Microsoft.SharePoint.WebControlsquot; SharePoint Services, checking Assembly=quot;Microsoft.SharePoint, Version=11.0.0.0, out the file and downloading it to one's local computer. Culture=neutral, PublicKeyToken=71e9bce111e9429cquot; %> <%@ Import Namespace=quot;Microsoft.SharePointquot; %> The ASP.NET file's code will, if the document is available for checkout, check out the file <script runat=quot;serverquot;> using the Windows SharePoint void Page_Load() Services object model, and then { send it down to the user via the SPWeb web = SPControl.GetContextWeb(Context); ASP.NET Response object. To string strPath = Request.QueryString[quot;FileNamequot;]; ensure that the document is saved locally rather than simple SPFile file=web.GetFile(strPath); being opened, the download will be marked as a simple octet if ((file.Exists) && (file.CheckOutStatus == stream rather than as a specific Microsoft.SharePoint.SPFile.SPCheckOutStatus.None)) Page 7 of 9
  • Creating a Custom Site Definition for Microsoft Windows SharePoint Services Tasks Detailed Steps document format for which an { application may be registered. Response.Clear(); file.CheckOut(); Response.AddHeader(quot;Content-Dispositionquot;, quot;attachment; filename=quot; + file.Name); Response.AddHeader (quot;Content-Lengthquot;, file.Length.ToString()); Response.ContentType = quot;application/octet-streamquot;; Response.BinaryWrite(file.OpenBinary()); } else { Response.Write(quot;The file does not existquot; + quot; or is already checked out.quot;); } } </script> f. Click File | Save All. g. Click File | Exit. Page 8 of 9
  • Creating a Custom Site Definition for Microsoft Windows SharePoint Services Exercise 4 Create a New Site Based on the Custom Definition Scenario In this exercise, you will create a new site with your changes. Tasks Detailed Steps 1. Create a new site a. Maximize Internet Explorer. b. In the top navigation bar, click Sites. c. In the left navigation bar, under Actions, click Create Site. d. In the Title field, type New FOO Site. e. In the URL name field, type FOO. f. Click Create. g. Click OK. h. Select the FOO Site template you just created and click OK. i. Explore the site. Notice the My Site link in the top navigation bar. 2. Test the menu a. Return to the home page of the site you just created. b. In the left navigation bar, click Shared Documents. c. In the toolbar, click Upload Document. d. Click Browse. e. Navigate to C:Sales Fileshare, select Annual Report.doc and click Open. f. Click Save and Close. g. Once the document has been uploaded, let your mouse pointer hover over the uploaded document on the Shared Documents page. When the command list menu appears, click on the down arrow to display the list of possible commands. h. Select the Check Out command. i. Select the Edit in Microsoft Office Word command. The document will open in a new instance of Word. j. Click Ok to open the document. Page 9 of 9