980 likes | 989 Views
Dive deep into defining and implementing policies, featuring Policy Item, Feature, and Resources. Learn Policy Architecture and Resource usage. Step-by-step guide with examples.
E N D
MOSS 2007 Application Development Certification preparation By: Usman Zafar Malik [MCTS : Microsoft Office SharePoint Server 2007]
Agenda • Policy • Auditing • Creating Business Intelligence(BI) Solutions by using MOSS • Working with KPIs
Policy • What is the Policy? • Policy Architecture. • How to define Policy? • How to implement the Policy by using Code?
What is the Policy? • Policy is a collection of instruction sets for one or more policy features. • Each policy feature provides a specific kind of content management functionality. • You can assign a policy to either a content type or a list.
Policy Item • Each policy feature that you want to include in a policy, you include an instruction set, called a policy item, in the policy. • Policy item is an XML node within a policy that contains the settings for only one policy feature, includes like ID, NAME of Policy Feature.
Policy Feature • A policy feature is an assembly that provides some content management functionality to Office SharePoint Server 2007. • You can include the same policy feature in multiple policies. • A policy feature can use one or more policy resources • Example: Audit. Expiration ,Labels, Bar Codes
Policy Resource • A policy resource is an assembly that assists the policy feature by providing some functionality the feature needs. • For example, the Bar Code policy feature uses a Bar Code Provider, which generates the bar codes, as a policy resource. • Expiration policy feature applies an Expiration Formula Calculator as a policy resource to determine a document's actual expiration date. Policy feature also uses an Expiration Action policy resource to determine what action to take when an item reaches its expiration date. • Policy Resources are not shared between Policy Features.
How to define policy? • Implement Interface IPolicyFeature . • Reference: • Microsoft.Office.Policy.dll • NameSpace: • Microsoft.Office.RecordsManagement.InformationPolicy • Include these methods • OnCustomDataChange • OnGlobalCustomDataChange • ProcessListItem • ProcessListItemOnRemove • Register • UnRegister
Create policy Manifest <?xml version="1.0" encoding="utf-8" ?> <p:PolicyFeature id="TST.POC.PolicyFeatures.PolicyOfTruth" xmlns:p="urn:schemas-microsoft-com:office:server:policy" group="Policy"> <p:LocalizationResources>dlccore</p:LocalizationResources> <p:Name>Policy of Truth</p:Name> <p:Description> This policy helps us to achieve the goals set in our "one version of the truth" project </p:Description> <p:Publisher>Ton Stegeman</p:Publisher> <p:ConfigPage>policyoftruthsettings.ascx</p:ConfigPage> <p:ConfigPageInstructions> You can add keywords here. If any of these keywords is found in the item"s metadata and the metadata also has the word "truth" or "proof", then the item is considered to be the "truth". And our truth is something we need to manage. Separate your keywords with a ";" </p:ConfigPageInstructions> <p:AssemblyName> TST.POC.PolicyOfTruth, Version=1.0.0.0, Culture=neutral, PublicKeyToken=503edd7b21a430b3 </p:AssemblyName> <p:ClassName>TST.POC.PolicyFeatures.PolicyOfTruth</p:ClassName> </p:PolicyFeature>
Create policy Control <!-- _lcid="1033" _version="12.0.4518" _dal="1" --> <!-- _LocalBinding --> <%@ Assembly Name="TST.POC.PolicyOfTruth, Version=1.0.0.0, Culture=neutral, PublicKeyToken=503edd7b21a430b3"%> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Control Language="C#" Inherits="TST.POC.PolicyOfTruth.PolicyOfTruthSettings" %> <p> <table cellpadding="0" class="ms-authoringcontrols"> <tr> <td> </td> <td><asp:Label runat="server" Text="Enter your keywords, separated by ";""></asp:Label></td> </tr> <tr> <td> </td> <td> <asp:TextBox id="TextBoxKeywords" runat="server" MaxLength="1024" class="ms-input" ToolTip="Enter your keywords here." /> <asp:RequiredFieldValidator id="RequiredValidatorKeywords" ControlToValidate="TextBoxKeywords" ErrorMessage="At least one keyword is required." Text="Please enter on or more keywords separated by a semicolon." EnableClientScript="false" runat="server"/> </td> </tr> </table> </p>
Create policy Control • Creating the Policy Control you have to inherit the control from abstract class CustomSettingsControl. • Important part are “CustomData” property and “onLoad” Method. • In the “CustomData” property the xml is generated with the values of the controls. • The “OnLoad” reads the xml string and sets the values for the usercontrol(s) in your editor.
Deploy Policy • Add the Control in the “LAYOUTS” folder of the MOSS Deployed Path. • Deploy the Assemblies.
Register Policy • Register your policy in the Policy Catalog. PolicyFeatureCollectionpolicyFeatures = PolicyCatalog.FeatureList; foreach (PolicyFeaturepolicyFeature in policyFeatures) { if (policyFeature.Id=="TST.POC.PolicyFeatures.PolicyOfTruth") { MessageBox.Show("Policy was already installed"); return; } } string manifest = System.IO.File.ReadAllText("manifest.xml"); PolicyFeature.ValidateManifest(manifest); PolicyFeatureCollection.Add(manifest);
UnRegister Policy • Unregister your policy in the Policy Catalog. PolicyFeatureCollectionpolicyFeatures = PolicyCatalog.FeatureList; foreach (PolicyFeaturepolicyFeature in policyFeatures) { if (policyFeature.Id == "TST.POC.PolicyFeatures.PolicyOfTruth") { PolicyFeatureCollection.Delete(policyFeature.Id); return; } }
Building Policy XML <p:Policy xmlns:p="office.server.policy" local="false" id="62bb137b-e4c5-4dab-9b90-c9b3e54384c5"> <p:Name>The truth about SharePoint</p:Name> <p:Description>This policy manages "truth" items on SharePoint in our portal</p:Description> <p:Statement> SharePoint list items and documents that are considered to be the truth about SharePoint Technologies, will be managed by our "truth manager". </p:Statement> <p:PolicyItems> <p:PolicyItem featureId="TST.POC.PolicyFeatures.PolicyOfTruth"> <p:Name>Policy of Truth</p:Name> <p:Description>This policy helps us to achieve the goals set in our "one version of the truth" project</p:Description> <p:CustomData> <data> <keywords>SharePoint; MOSS; WSS</keywords> </data> </p:CustomData> </p:PolicyItem> </p:PolicyItems> </p:Policy>
MOSS Demo • Demo (Label Policy)
Useful Policy Links • http://msdn2.microsoft.com/en-us/library/ms499244.aspx • http://jack.whyyoung.com/blog/www-sharepointblogs-com-MainFeed-aspx-GroupID-3/MOSS-Custom-policies-part-1--Creat.htm
auditing • What is the Auditing? • Demos
Auditing ? • Audits are performed to ascertain the validity and reliability of information. • Track data such as which users viewed and updated records and documents, check-in, check-out etc.
Demos Demo - Create a Custom Audit Report Demo - Use auditing feature in MOSS Demo - Create a Custom File Submission Demo - Create a Custom Legal Hold
Custom File Submission • Implement interface “IRouter” • Only one method “OnSubmitFile” • Reference: • Microsoft.Office.Policy.dll • NameSpace: • Microsoft.Office.RecordsManagement.RecordsRepository
Useful Custom File Submission links • http://blog.thekid.me.uk/archive/2007/04/15/creating-a-custom-router-for-records-center-in-sharepoint.aspx
Business intelligence Solution in MOSS 2007 • What is Business Intelligence? • How many ways we can use BI in MOSS?
Business intelligence ? • The promise of Microsoft BI is to help decision makers at all levels throughout your organization have confidence that their decisions support your company’s goals and initiatives.
Business intelligence in moss • Report Center • Excel Services • Connections to external data sources • Key Performance Indicators (KPIs) • Filter Web Parts • Dashboards
Report center • The Report Center site provides a central location for business-intelligence-related information.
Excel Services • Excel Services enables you to store an Excel workbook on a server and then publish any part of that workbook on a Web page. • Users need only a browser to view and interact with the live data. • The workbook is published on the Web page by using the Excel Web Access (EWA) Web Part
Connections to external data sources • You can use data from other business applications, such as SAP and Siebel, in SharePoint lists, pages, and Web Parts. • You can build Web Pages and SharePoint lists that allow users to interact with the data in the external source without ever leaving the SharePoint page.
Key Performance Indicators (KPIs) • A Key Performance Indicator (KPI) is a visual cue that communicates the amount of progress made toward a goal. • KPIs are created by using KPI lists and then are displayed by using special KPI Web Parts.
Filter Web Parts • Filters allow you to display only the subset of data that you are interested in view. • Office SharePoint Server 2007 has 10 Filter Web Parts. • Example : Current User Filter Web Part.
Dashboards • Dashboards, also known as multi-report summary pages, contain one or more Web Parts, such as business data Web Parts, Excel Web Access Web Parts, or KPIs etc. • You can create your own dashboard page by using various Web Parts.
Useful Business intelligence in moss links • http://office.microsoft.com/en-us/sharepointserver/HA100872181033.aspx
Working with KPI’s • Indicator using data in SharePoint list A SharePoint list that contains items from which you want to create an aggregate value, such as a sum, minimum, or maximum. Before you set up the KPI, make sure the SharePoint list already is in the view that you want to use. You must first display the appropriate columns in order for the KPI to work. • Indicator using data in Excel workbook An Excel workbook where the KPI is calculated in the workbook. • Indicator using data in SQL Server 2005 Analysis Services A SQL Server 2005 Analysis Services cube. • Indicator using manually entered information Information that is not in a system and therefore entered manually. • Demo
Useful Working with KPI’s links • http://office.microsoft.com/en-us/sharepointserver/HA100800271033.aspx
Agenda • Extend Page Authoring Toolbar • Create Pages Dynamically. • Modify Page Layouts by using Content Placeholders • Create Custom Field Control • Variations • Deploy Content between servers.
Extend Page Authoring Toolbar • Demo • Files
Extend Page Authoring Toolbar • Class: ConsoleAction • A class provided by MOSS for you to create new menu items. • Method: RaisePostBackEvent • It basically does all the heavy lifting required at the time the action is clicked
Extend Page Authoring Toolbar • Class: ConsoleNode • This feature to be presented as a top level menu with children not just a single menu item. • Method: InitNode • Will be run on every page load, when the object is created so we use this method to determine whether the current page is in edit mode. • Method: EnsureChildNodes • Will construct the correct list of links which are to be displayed to the user.
Extend Page Authoring Toolbar • Steps involved to change the custom XML file: • Using SharePoint Designer, check out the CustomEditingMenu.xml file under the master page gallery: ”_Catalogs\masterpage\Editing Menu”, Then, modify the custom XML file with the following changes. • Add some references to the top of the file so that the new actions from the assemblies can be referenced. Make sure you use the right PublicKeyToken key and the namespace so that the references are clear.
Useful Extend Page Authoring Toolbar links • http://blogs.msdn.com/ecm/archive/2007/03/04/customize-the-page-editing-toolbar-in-moss-2007.aspx
Creating Page Dynamically • PageLayout • PublishingPage
Modify Page layout by using content placeholders • Go to “Site Actions” “Site Settings” “Modify All Site Settings” “Site columns” “Create” • Enter the Column Name “NewsHtmlColumn” • Select Column type to “Full HTML content with formatting and constraints for publishing. • Enter the Group Name “ColumnsGroup” in a new Group Section and Press the Ok Button. • The Go to “Site content type” “Page (link under the “Publishing Content Types Group”)” “Add from existing site columns” • Add the “NewsHtmlColumn” Demo
Create custom field control • Create an “.ascx” file with a “Sharepoint :RenderingTemplate” control. • We need to implement its code behind class must derives “BaseFieldControl” and overrides the Property “Value”.
Create custom field control • Create a custom “field type” class, must inherit the base class “SPField”. • Override method “GetValidatedString” to check the validity of input and return value. • Override method “GetFieldValue” to get the field value • Override “FieldRenderingControl” property returns the user control that created above.
Create custom field control • The custom type must include a custom field type definition and name convention should be “fldtypes_*.xml”.
Create custom field controlDeployment Procedure • Build the solution and sign the assembly • Put the assembly into GAC • Copy the user control to \program files\...\web server extensions\12\template\controltemplates • Copy fldtypes_name.xml to \program files\...\web server extensions\12\template\xml\ • Run iisreset command.
Create custom field controlExamples • SPFieldBoolean Represents a Boolean field type. • SPFieldChoice Represents a choice field type. • SPFieldCurrency Represents a currency field type. • SPFieldDateTime Represents a date-time field type. • SPFieldMultiColumn Represents a multicolumn field type • Demo
Useful Create custom field control links • http://msdn2.microsoft.com/en-US/library/aa830815.aspx#Office2007SSBrandingWCMPart2_CreatingCustomFieldControls • http://www.sharepointblogs.com/jimyang/default.aspx
Variations • Variations can be used for publishing related sites or pages, purpose is to support Multilingual in MOSS. • Instead, you will have sub sites under the web root representing your variations.