sharepoint 2010 training session 6

40
SharePoint 2010 By: Usman Zafar Malik [MCTS: MOSS 2007], [MSCBSS: CRM 3.0 / 4.0], MCP Session - 6

Upload: usman-zafar-malik

Post on 21-Jan-2015

368 views

Category:

Technology


2 download

DESCRIPTION

 

TRANSCRIPT

Page 1: SharePoint 2010 Training Session 6

SharePoint 2010

By: Usman Zafar Malik

[MCTS: MOSS 2007], [MSCBSS: CRM 3.0 / 4.0], MCP

Session - 6

Page 2: SharePoint 2010 Training Session 6

SharePoint 2010 Development

Page 3: SharePoint 2010 Training Session 6

SharePoint 2010 Development• Site Definitions

Page 4: SharePoint 2010 Training Session 6

SharePoint 2010 Site Definitions

Page 5: SharePoint 2010 Training Session 6

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.

Page 6: SharePoint 2010 Training Session 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>

Page 7: SharePoint 2010 Training Session 6

Site Definition Structure

- “Project” ElementIt 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” ElementIt specifies the navigation area of the Site. Not necessarily a top navigation toolbar, it could be tree of links.

- “ListTemplates” ElementSpecifies the List Definition Information in the Site Definition.

- “DocumentTemplates” ElementSpecifies the Document Libraries Information in the Site Definition.

Page 8: SharePoint 2010 Training Session 6

Site Definition Structure

- “Configurations” ElementEach 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” ElementThe Modules collection specifies the modules to include by default in creating a site collection.Example: Module for MasterPage, DefaultPage of Site,

Page 9: SharePoint 2010 Training Session 6

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>

Page 10: SharePoint 2010 Training Session 6

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>

Page 11: SharePoint 2010 Training Session 6

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="doctemp\word\wdtmpl.doc" TargetName="Forms/template.doc" Default="TRUE"/> </DocumentTemplateFiles> </DocumentTemplate>

</DocumentTemplates>

Page 12: SharePoint 2010 Training Session 6

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>

Page 13: SharePoint 2010 Training Session 6

Site Definition StructureModules Pattern<Modules></Modules >

Example: <Modules> <Module Name="MasterPage" List="116" Url="_catalogs/masterpage" SetupPath="FEATURES\Custom.Intranet.UI.Base_Custom.Intranet.UI.Base.MasterPages\Custom.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-Corp MainPageCT;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900f457fdbf1ee44c45a0b0b6def0336d04000d5ed0017169434cbd8b0990ddd9bc74;#" /> </File> </Module> </Modules>

Page 14: SharePoint 2010 Training Session 6

Site DefinitionsSite Templates Gallery

Page 15: SharePoint 2010 Training Session 6

Site DefinitionsCreate Site Definition Project in Visual Studio 2010

Page 16: SharePoint 2010 Training Session 6

Site DefinitionsCreate Site Definition Project in Visual Studio 2010

Page 17: SharePoint 2010 Training Session 6

Site DefinitionsCreate Site Definition Project in Visual Studio 2010

Page 18: SharePoint 2010 Training Session 6

Site DefinitionsCreate Site Definition Project in Visual Studio 2010

Page 19: SharePoint 2010 Training Session 6

Creating Publishing Site

1- Go To “C:\ProgramFiles\CommonFiles\MicrosoftShared\Webserverextensions\14\Templates\SiteTemplates\”2- Click the SiteTemplate “PUBLISHING”3- Click on “XML” folder and open the “onet.xml” file4- Copy and paste in to newly created visual studio site definition “onet.xml” file with some modifications where required.

Page 20: SharePoint 2010 Training Session 6

Creating Publishing Site

Page 21: SharePoint 2010 Training Session 6

Creating Publishing Site

Page 22: SharePoint 2010 Training Session 6

Creating Publishing Site

Page 23: SharePoint 2010 Training Session 6

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="doctemp\word\wdtmpl.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="doctemp\xl\xltmpl.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="doctemp\ppt\pptmpl.pot" TargetName="Forms/template.pot" Default="TRUE"/> </DocumentTemplateFiles> </DocumentTemplate>

Page 24: SharePoint 2010 Training Session 6

Creating Publishing Site<DocumentTemplate Path="STS" DisplayName="$Resources:core,doctemp_Word;" Type="121" Default="TRUE" Description="$Resources:core,doctemp_Word_Desc;"> <DocumentTemplateFiles> <DocumentTemplateFile Name="doctemp\word\wdtmpl.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="doctemp\xl\xltmpl.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="doctemp\ppt\pptmpl.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="doctemp\onenote\template.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="doctemp\fp\fptmpl.htm" TargetName="Forms/template.htm" Default="TRUE"/> </DocumentTemplateFiles> </DocumentTemplate>

Page 25: SharePoint 2010 Training Session 6

Creating Publishing Site<DocumentTemplate Path="STS" DisplayName="$Resources:core,doctemp_BasicPage;" Type="105" Description="$Resources:core,doctemp_BasicPage_Desc;"> <DocumentTemplateFiles> <DocumentTemplateFile Name="doctemp\blankpgs\_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="doctemp\smartpgs\_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="doctemp\xmlforms\blank\template.xml" TargetName="Forms/template.xml" Default="TRUE" /> </DocumentTemplateFiles> </DocumentTemplate>

</DocumentTemplates>

Page 26: SharePoint 2010 Training Session 6

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>

Page 27: SharePoint 2010 Training Session 6

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">

Page 28: SharePoint 2010 Training Session 6

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>

Page 29: SharePoint 2010 Training Session 6

Creating Publishing Site<Modules> <Module Name="MasterPage" /> <Module Name="Default" /> </Modules> </Configuration> </Configurations> <Modules> <Module Name="MasterPage" List="116" Url="_catalogs/masterpage" SetupPath="FEATURES\Custom.Intranet.UI.Base_Custom.Intranet.UI.Base.MasterPages\Custom.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-Corp MainPageCT;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900f457fdbf1ee44c45a0b0b6def0336d04000d5ed0017169434cbd8b0990ddd9bc73;#" /> </File> </Module> </Modules></Project>

Page 30: SharePoint 2010 Training Session 6

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 Site Template" DisplayCategory=“Custom Site" RootWebOnly="true" SubWebOnly="false"> </Configuration> </Template></Templates>

Page 31: SharePoint 2010 Training Session 6

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“.

Page 32: SharePoint 2010 Training Session 6

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"

Page 33: SharePoint 2010 Training Session 6

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>

Page 34: SharePoint 2010 Training Session 6

Publishing Site

Page 35: SharePoint 2010 Training Session 6

Publishing Site

Page 36: SharePoint 2010 Training Session 6

Publishing Site

Page 37: SharePoint 2010 Training Session 6

Publishing Site

Page 38: SharePoint 2010 Training Session 6

Publishing Site

Page 39: SharePoint 2010 Training Session 6

Q & A

Page 40: SharePoint 2010 Training Session 6

Thanks !