SharePoint 2010 Training Session 6

578 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
578
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
31
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

SharePoint 2010 Training Session 6

  1. 1. SharePoint 2010 Session - 6By: Usman Zafar Malik[MCTS: MOSS 2007], [MSCBSS: CRM 3.0 / 4.0], MCP
  2. 2. SharePoint 2010 Development
  3. 3. SharePoint 2010 Development• Site Definitions
  4. 4. SharePoint 2010 Site Definitions
  5. 5. Site DefinitionsWhat are site definitions?• Contains a server-side collection of files that defines the structure of one or more site templates.Possible scopes• Farm Level.
  6. 6. Site Definition Structure (Onet.xml)<?xml version="1.0" encoding="utf-8" ?><Project Title=“CustomCorporateSite" Revision="2" ListDir="" xmlns:ows="Microsoft SharePoint" xmlns="http://schemas.microsoft.com/sharepoint/"> <NavBars> </NavBars> <ListTemplates> </ListTemplates> <DocumentTemplates> </DocumentTemplates> <Configurations> <Configuration ID="-1" Name="NewWeb"/> <Configuration ID="0" Name="CustomCorporateSite" CustomMasterUrl="_catalogs/masterpage/CustomCorporateMaster.Master"MasterUrl="_catalogs/masterpage/CustomCorporCustompplicationMaster.Master"> <Lists> </Lists> <SiteFeatures> </SiteFeatures> <WebFeatures> </WebFeatures> <Modules> </Modules> </Configuration> </Configurations> <Modules> </Modules></Project>
  7. 7. Site Definition Structure- “Project” Element It specifies a default name for sites that are created through any of the site configurations in the site definition and specifies the directory that contains subfolders in which the files for each list definition reside. Also contains information about AlternateCSS and CustomJSUrl etc.- “NavBars” Element It specifies the navigation area of the Site. Not necessarily a top navigation toolbar, it could be tree of links.- “ListTemplates” Element Specifies the List Definition Information in the Site Definition.- “DocumentTemplates” Element Specifies the Document Libraries Information in the Site Definition.
  8. 8. Site Definition Structure- “Configurations” Element Each Configuration element in the Configurations section specifies the lists and modules that are created by default when the site definition configuration is instantiated. The “ID” attribute identifies the configuration (uniquely relative to the other configurations in the site definition) and corresponds to the ID attribute of a Configuration element in “WebTemp.xml”- “Modules” Element The Modules collection specifies the modules to include by default in creating a site collection. Example: Module for MasterPage, DefaultPage of Site,
  9. 9. Site Definition StructureNavigation Bars Pattern<NavBars> <NavBar Name="SharePoint Top Navbar" ID="1002"> </NavBar></NavBars>Example:<NavBars> <NavBar Name="SharePoint Top Navbar" ID="1002"> <NavBarLink Name="Documents and Lists" Url="_layouts/[%=System.Threading.Thread.CurrentThread.CurrentCulture.LCID%]/viewlsts.aspx"></NavBarLink> <NavBarLink Name="Create" Url="_layouts/[%=System.Threading.Thread.CurrentThread.CurrentCulture.LCID%]/create.aspx"> </NavBarLink> <NavBarLink Name="Site Settings" Url="_layouts/[%=System.Threading.Thread.CurrentThread.CurrentCulture.LCID%]/settings.aspx"></NavBarLink> <NavBarLink Name="microsoft" Url="http://example.microsoft.com/"></NavBarLink></NavBar></NavBars>
  10. 10. Site Definition StructureList Templates Pattern<ListTemplates></ListTemplates>Example:<ListTemplates> <ListTemplate Name="meetings" DisplayName="$Resources:xml_onet_mwsidmeetingDisp;" Type="200" BaseType="0" Unique="TRUE" Hidden="TRUE" HiddenList="TRUE" DontSaveInTemplate="TRUE" SecurityBits="11" Description="$Resources:xml_onet_mwsidmeetingDesc;" Image="/_layouts/images/itevent.gif"> </ListTemplate></ListTemplates>
  11. 11. Site Definition StructureDocumentTemplates Pattern<DocumentTemplates></DocumentTemplates>Example:<DocumentTemplates> <DocumentTemplate Path="STS" Name="" DisplayName="$Resources:core,doctemp_None;" Type="100" Default="FALSE"Description="$Resources:core,doctemp_None_Desc;" /> <DocumentTemplate Path="STS" DisplayName="$Resources:core,doctemp_Word97;" Type="101"Description="$Resources:core,doctemp_Word97_Desc;"> <DocumentTemplateFiles> <DocumentTemplateFile Name="doctempwordwdtmpl.doc" TargetName="Forms/template.doc" Default="TRUE"/> </DocumentTemplateFiles> </DocumentTemplate></DocumentTemplates>
  12. 12. Site Definition StructureConfigurations Pattern<Configurations></Configurations>Example:<Configurations> <Configuration ID="-1" Name="NewWeb"/> <Configuration ID="0" Name="CustomCorporateSite" CustomMasterUrl="_catalogs/masterpage/CustomCorporateMaster.Master"MasterUrl="_catalogs/masterpage/CustomCorporCustompplicationMaster.Master"> <Lists> </Lists> <SiteFeatures> </SiteFeatures> <WebFeatures> </WebFeatures> <Modules> </Modules> </Configuration> </Configurations>
  13. 13. Site Definition StructureModules Pattern<Modules></Modules >Example: <Modules> <Module Name="MasterPage" List="116" Url="_catalogs/masterpage"SetupPath="FEATURESCustom.Intranet.UI.Base_Custom.Intranet.UI.Base.MasterPagesCustom.Intranet.UI.Base.MasterPages" RootWebOnly="FALSE"> <File Url="CustomCorporateMaster.Master" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" /> </Module> <Module Name="Default" Url="$Resources:osrvcore,List_Pages_UrlName;" Path=""> <File Url="default.aspx" Type="GhostableInLibrary" > <Property Name="Title" Value="Custom Corp Main Page" /> <Property Name="ContentType" Value="Custom-Corp MainPageCT" /> <Property Name="PublishingPreviewImage" Value="~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/PreviewImages/ArticleLeft.png, ~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/ArticleLeft.png" /> <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/CorpMainPL.aspx, Custom-Corp MainPageCT" /> <Property Name="PublishingAssociatedContentType" Value=";#Custom-CorpMainPageCT;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900f457fdbf1ee44c45a0b0b6def0336d04000d5ed0017169434cbd8b0990ddd9bc74;#" /> </File> </Module> </Modules>
  14. 14. Site DefinitionsSite Templates Gallery
  15. 15. Site DefinitionsCreate Site Definition Project in Visual Studio 2010
  16. 16. Site DefinitionsCreate Site Definition Project in Visual Studio 2010
  17. 17. Site DefinitionsCreate Site Definition Project in Visual Studio 2010
  18. 18. Site DefinitionsCreate Site Definition Project in Visual Studio 2010
  19. 19. Creating Publishing Site1- Go To “C:ProgramFilesCommonFilesMicrosoftSharedWebserverextensions14TemplatesSiteTemplates”2- Click the SiteTemplate “PUBLISHING”3- Click on “XML” folder and open the “onet.xml”file4- Copy and paste in to newly created visual studiosite definition “onet.xml” file with somemodifications where required.
  20. 20. Creating Publishing Site
  21. 21. Creating Publishing Site
  22. 22. Creating Publishing Site
  23. 23. Creating Publishing Site<?xml version="1.0" encoding="utf-8" ?><Project Title="CustomIntranetCorporateSite" Revision="2" ListDir="" xmlns:ows="Microsoft SharePoint" xmlns="http://schemas.microsoft.com/sharepoint/"> <NavBars> <NavBar Name="SharePoint Top Navbar" ID="1002"> </NavBar> </NavBars> <ListTemplates> </ListTemplates> <DocumentTemplates> <DocumentTemplate Path="STS" Name="" DisplayName="$Resources:core,doctemp_None;" Type="100" Default="FALSE" Description="$Resources:core,doctemp_None_Desc;"/> <DocumentTemplate Path="STS" DisplayName="$Resources:core,doctemp_Word97;" Type="101" Description="$Resources:core,doctemp_Word97_Desc;"> <DocumentTemplateFiles> <DocumentTemplateFile Name="doctempwordwdtmpl.doc" TargetName="Forms/template.doc" Default="TRUE"/> </DocumentTemplateFiles> </DocumentTemplate> <DocumentTemplate Path="STS" DisplayName="$Resources:core,doctemp_Excel97;" Type="103" Description="$Resources:core,doctemp_Excel97_Desc;"> <DocumentTemplateFiles> <DocumentTemplateFile Name="doctempxlxltmpl.xls" TargetName="Forms/template.xls" Default="TRUE"/> </DocumentTemplateFiles> </DocumentTemplate> <DocumentTemplate Path="STS" DisplayName="$Resources:core,doctemp_Powerpoint97;" Type="104" Description="$Resources:core,doctemp_Powerpoint97_Desc;"> <DocumentTemplateFiles> <DocumentTemplateFile Name="doctemppptpptmpl.pot" TargetName="Forms/template.pot" Default="TRUE"/> </DocumentTemplateFiles> </DocumentTemplate>
  24. 24. Creating Publishing Site<DocumentTemplate Path="STS" DisplayName="$Resources:core,doctemp_Word;" Type="121" Default="TRUE" Description="$Resources:core,doctemp_Word_Desc;"> <DocumentTemplateFiles> <DocumentTemplateFile Name="doctempwordwdtmpl.dotx" TargetName="Forms/template.dotx" Default="TRUE"/> </DocumentTemplateFiles> </DocumentTemplate> <DocumentTemplate Path="STS" DisplayName="$Resources:core,doctemp_Excel;" Type="122" Description="$Resources:core,doctemp_Excel_Desc;"> <DocumentTemplateFiles> <DocumentTemplateFile Name="doctempxlxltmpl.xlsx" TargetName="Forms/template.xlsx" Default="TRUE"/> </DocumentTemplateFiles> </DocumentTemplate> <DocumentTemplate Path="STS" DisplayName="$Resources:core,doctemp_Powerpoint;" Type="123" Description="$Resources:core,doctemp_Powerpoint_Desc;"> <DocumentTemplateFiles> <DocumentTemplateFile Name="doctemppptpptmpl.pptx" TargetName="Forms/template.pptx" Default="TRUE"/> </DocumentTemplateFiles> </DocumentTemplate> <DocumentTemplate Path="STS" DisplayName="$Resources:core,doctemp_OneNote;" Type="111" Description="$Resources:core,doctemp_OneNote_Desc;"> <DocumentTemplateFiles> <DocumentTemplateFile Name="doctemponenotetemplate.onepkg" TargetName="Forms/template.onepkg" Default="TRUE"/> </DocumentTemplateFiles> </DocumentTemplate> <DocumentTemplate Path="STS" DisplayName="$Resources:core,doctemp_FP;" Type="102" Description="$Resources:core,doctemp_FP_Desc;"> <DocumentTemplateFiles> <DocumentTemplateFile Name="doctempfpfptmpl.htm" TargetName="Forms/template.htm" Default="TRUE"/> </DocumentTemplateFiles> </DocumentTemplate>
  25. 25. Creating Publishing Site<DocumentTemplate Path="STS" DisplayName="$Resources:core,doctemp_BasicPage;" Type="105" Description="$Resources:core,doctemp_BasicPage_Desc;"> <DocumentTemplateFiles> <DocumentTemplateFile Name="doctempblankpgs_basicpage.htm" TargetName="Forms/_basicpage.htm" Default="TRUE"/> </DocumentTemplateFiles> </DocumentTemplate> <DocumentTemplate Path="STS" DisplayName="$Resources:core,doctemp_WebPartPage;" Type="106" Description="$Resources:core,doctemp_WebPartPage_Desc;"> <DocumentTemplateFiles> <DocumentTemplateFile Name="doctempsmartpgs_webpartpage.htm" TargetName="Forms/_webpartpage.htm" Default="TRUE"/> </DocumentTemplateFiles> </DocumentTemplate> <DocumentTemplate XMLForm="TRUE" Path="STS" DisplayName="$Resources:core,doctemp_BlankForm;" Type="1000" Default="TRUE"Description="$Resources:core,doctemp_BlankForm_Desc;"> <DocumentTemplateFiles> <DocumentTemplateFile Name="doctempxmlformsblanktemplate.xml" TargetName="Forms/template.xml" Default="TRUE" /> </DocumentTemplateFiles> </DocumentTemplate></DocumentTemplates>
  26. 26. Creating Publishing Site<Configurations> <Configuration ID="-1" Name="NewWeb"/> <Configuration ID="0" Name="CustomIntranetCorporateSite" CustomMasterUrl="_catalogs/masterpage/CustomCorporateMaster.Master"MasterUrl="_catalogs/masterpage/CustomCorporCustompplicationMaster.Master"> <Lists> </Lists> <SiteFeatures> <!-- Workflow Features --> <!-- Workflow Expiration --> <Feature ID="C85E5759-F323-4EFB-B548-443D2216EFB5" /> <!-- DLC Workflows --> <Feature ID="0AF5989A-3AEA-4519-8AB0-85D91ABE39FF" /> <!-- "Publishing Approval Workflow" --> <!--<Feature ID="A44D2AA3-AFFC-4d58-8DB4-F4A3AF053188" />--> <Feature ID="A392DA98-270B-4e85-9769-04C0FDE267AA"> <!-- PublishingPrerequisites --> </Feature> <Feature ID="7C637B23-06C4-472d-9A9A-7C175762C5C4"> <!-- ViewFormPagesLockDown --> </Feature> <Feature ID="AEBC918D-B20F-4a11-A1DB-9ED84D79C87E"> <!-- PublishingResources --> <Properties xmlns="http://schemas.microsoft.com/sharepoint/"> <Property Key="AllowRss" Value="false"/> <Property Key="SimplePublishing" Value="false" /> </Properties> </Feature>
  27. 27. Creating Publishing Site<Feature ID="F6924D36-2FA8-4f0b-B16D-06B7250180FA"> <!-- Office SharePoint Server Publishing --> </Feature> <!-- SearchCenter Url feature --> <Feature ID="7AC8CC56-D28E-41f5-AD04-D95109EB987A" > <Properties xmlns="http://schemas.microsoft.com/sharepoint/"> <Property Key="SearchCenterUrl" Value="~SiteCollection/Search/" /> </Properties> </Feature> </SiteFeatures> <WebFeatures> <!-- Include the common WSSListTemplateFeatures used by CMS --> <Feature ID="00BFEA71-DE22-43B2-A848-C05709900100" > </Feature> <Feature ID="00BFEA71-E717-4E80-AA17-D0C71B360101" > </Feature> <Feature ID="00BFEA71-52D4-45B3-B544-B1C71B620109" > </Feature> <Feature ID="00BFEA71-A83E-497E-9BA0-7A5C597D0107" > </Feature> <Feature ID="00BFEA71-4EA5-48D4-A4AD-305CF7030140" > </Feature> <Feature ID="00BFEA71-F600-43F6-A895-40C0DE7B0117" > </Feature> <!-- TeamCollab Feature --> <Feature ID="00BFEA71-4EA5-48D4-A4AD-7EA5C011ABE5" /> <Feature ID="22A9EF51-737B-4ff2-9346-694633FE4416">
  28. 28. Creating Publishing Site<!-- Publishing --> <Properties xmlns="http://schemas.microsoft.com/sharepoint/"> <Property Key="ChromeMasterUrl" Value="~SiteCollection/_catalogs/masterpage/nightandday.master"/> <Property Key="WelcomePageUrl" Value="$Resources:osrvcore,List_Pages_UrlName;/default.aspx"/> <Property Key="PagesListUrl" Value=""/> <Property Key="AvailableWebTemplates" Value="*-CustomIntranetStaffSite#0;*-CustomIntranetBlogSite#0"/> <Property Key="AvailablePageLayouts" Value=""/> <Property Key="DefaultPageLayout" Value="~SiteCollection/_catalogs/masterpage/CorpMainPL.aspx"/> <Property Key="AlternateCssUrl" Value="" /> <Property Key="SimplePublishing" Value="false" /> <!--<Property Key="EnableApprovalWorkflowOnPages" Value="true" />--> </Properties> </Feature> <Feature ID="541F5F57-C847-4e16-B59A-B31E90E6F9EA"> <!-- Per-Web Portal Navigation Properties--> <Properties xmlns="http://schemas.microsoft.com/sharepoint/"> <Property Key="InheritGlobalNavigation" Value="true"/> <Property Key="IncludeSubSites" Value="true"/> <Property Key="IncludePages" Value="true"/> </Properties> </Feature> <Feature ID="94C94CA6-B32F-4da9-A9E3-1F3D343D7ECB"> <!-- Office SharePoint Server Publishing --> </Feature> </WebFeatures>
  29. 29. Creating Publishing Site<Modules> <Module Name="MasterPage" /> <Module Name="Default" /> </Modules> </Configuration> </Configurations> <Modules> <Module Name="MasterPage" List="116" Url="_catalogs/masterpage"SetupPath="FEATURESCustom.Intranet.UI.Base_Custom.Intranet.UI.Base.MasterPagesCustom.Intranet.UI.Base.MasterPages" RootWebOnly="FALSE"> <File Url="CustomCorporateMaster.Master" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" /> </Module> <Module Name="Default" Url="$Resources:osrvcore,List_Pages_UrlName;" Path=""> <File Url="default.aspx" Type="GhostableInLibrary" > <Property Name="Title" Value="Custom Corp Main Page" /> <Property Name="ContentType" Value="Custom-Corp MainPageCT" /> <Property Name="PublishingPreviewImage" Value="~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/ArticleLeft.png,~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/ArticleLeft.png" /> <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/CorpMainPL.aspx, Custom-Corp MainPageCT" /> <Property Name="PublishingAssociatedContentType" Value=";#Custom-CorpMainPageCT;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900f457fdbf1ee44c45a0b0b6def0336d04000d5ed0017169434cbd8b0990ddd9bc73;#" /> </File> </Module> </Modules></Project>
  30. 30. Publishing Site- Open “webtemp_CustomSiteName.xml” file- Paste the text given below<?xml version="1.0" encoding="utf-8"?><Templates xmlns:ows="Microsoft SharePoint"> <Template Name=“CustomCorporateSite" ID="100010"> <Configuration ID="0" Title=“Custom Corporate Site " Hidden="FALSE"ImageUrl="/_layouts/images/CPVW.gif" Description=“Custom Corporate SiteTemplate" DisplayCategory=“Custom Site" RootWebOnly="true"SubWebOnly="false"> </Configuration> </Template></Templates>
  31. 31. Publishing Site- RootWebOnly="true"  To make site available at the site collection level- SubWebOnly=“true"  To make site available at the sub site level- If you want to make the site only available at the site collection level then make RootWebOnly="true" and SubWebOnly=“false“.- If you want to make site definition only at sub site then make RootWebOnly=“false" and SubWebOnly=“true“.
  32. 32. Publishing SiteFormats of Defining / make available of Site and Page Layouts- AvailableWebTemplates  "*-CustomDeptSite#0;*-CustomBlogSite#0“ In case of empty (“”)it will show all the site templates.- AvailablePageLayouts - "~SiteCollection/_catalogs/masterpage/MyCustomPageLayout.aspx“ In case of empty (“”)it will show all the page layouts.- DefaultPageLayout  "~SiteCollection/_catalogs/masterpage/MyCustomPageLayout.aspx"
  33. 33. Publishing SiteFeature Stapling<?xml version="1.0" encoding="utf-8"?><Elements xmlns="http://schemas.microsoft.com/sharepoint/"><!-- Site Columns --><FeatureSiteTemplateAssociation Id=“a5689e25-2139-453f-9367-99e4d12e510f"TemplateName=“CustomDeptSite#0"/><!-- Site Content Types --><FeatureSiteTemplateAssociation Id=“19f9d02d-1bbc-45ac-a836-c0c73c0f1987" TemplateName="CustomDeptSite#0 "/><!-- Site List Definitions --><FeatureSiteTemplateAssociation Id=“2c9e8ca5-d893-42b8-a3b3-cae4b18bf133" TemplateName="CustomDeptSite#0 "/><!-- Site Settings List --> <FeatureSiteTemplateAssociation Id=“109dd9fc-6018-4a81-8f8f-9ffdd8c68ef4"TemplateName=“CustomDeptSite#0"/></Elements>
  34. 34. Publishing Site
  35. 35. Publishing Site
  36. 36. Publishing Site
  37. 37. Publishing Site
  38. 38. Publishing Site
  39. 39. Q&A
  40. 40. Thanks !

×