報表範例案例:如何將儀表板和報表納入自訂檢視
發行︰ 2016年5月
適用於: System Center 2012 SP1 - Service Manager、System Center 2012 R2 Service Manager、System Center 2012 - Service Manager
System Center 2012 – Service Manager 仰賴 Microsoft SharePoint,以及在 Service Manager 方塊中加入新 Microsoft Online Analytical Processing (OLAP) Cube 的其中一項優勢在於,您可以非常輕易地使用 Microsoft SharePoint Server 2010 或 Microsoft Excel 中的 PerformancePoint Services 建立 SharePoint 儀表板。 接著,您可以在 Service Manager 中建立自訂檢視以顯示這些儀表板。
請使用下列程序在 Service Manager 主控台中建立自訂檢視,以便顯示環境的 SharePoint 儀表板。 請依照文中的順序完成下列三個程序。
若要建立儀表板管理組件
按一下 Service Manager 主控台中的 [系統管理]。
按一下 [工作] 窗格中的 [啟動 PowerShell 工作階段]。
在 Windows PowerShell 視窗中輸入以下內容,然後按下 Enter 鍵:
New-SCManagementPack –DisplayName Dashboards
按一下 Service Manager 主控台中的 [工作項目]。 在 [工作項目] 窗格中,以滑鼠右鍵按一下 [事件管理],然後按一下 [建立資料夾]。
在 [建立新資料夾] 對話方塊中,輸入 Dashboards 以使其成為資料夾名稱。 將 Dashboards 選為 [管理組件],然後按一下 [確定]。
在 Windows PowerShell 中輸入以下兩個命令:
Get-SCManagementPack –DisplayName Dashboards | Export-SCManagementPack –Path C:\DashBoards
Get-SCManagementPack –DisplayName Dashboards | Remove-SCManagementPack
若要在 Visual Studio 中編輯儀表板管理組件
啟動 Microsoft Visual Studio。
在 Visual Studio 中依序按一下 [檔案]、[開啟]、[檔案],在 [開啟檔案] 對話方塊中指向 C:\DashBoards 資料夾,然後開啟剛匯出的管理組件檔案。 檔案名稱的格式為 ManagementPack.<GUID>.xml。
依照以下幾個步驟所述,在 Visual Studio 中編輯管理組件檔案。
找出 <Assembly> 標記,並將其取代為以下程式碼:
<Assembly>EnterpriseManagement!WpfViewsAssembly</Assembly>
將目前的識別碼取代為 IncidentDashboards,如下所示:
找出以下程式碼區塊:
<Identity> <ID>ManagementPack.aded6801e732473d80731943d22d33dc</ID> <Version>7.5.1088.276</Version> </Identity>
在該區塊內,將 <ID> 區塊更新為以下內容:
<ID>IncidentDashboards</ID>
接著,找出以下程式碼區塊:
<DisplayStrings> <DisplayString ElementID="ManagementPack.aded6801e732473d80731943d22d33dc"> <Name>Dashboards</Name> </DisplayString>
在該區塊內,將 <DisplayString> 標記更新為以下內容:
<DisplayString ElementID="IncidentDashboards">
選取 [檔案] [將 ManagementPack.<GUID>.xml 另存為],然後在 [將檔案另存為] 對話方塊中輸入 C:\DashBoards\IncidentDashboards.xml 做為 [檔案名稱]。
在 <References> 區段中新增 System.Library 管理組件的參考。 產生的 <References> 區段應如下所示:
<References> <Reference Alias="EnterpriseManagement"> <ID>Microsoft.EnterpriseManagement.ServiceManager.UI.Console</ID> <Version>7.5.1088.276</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> <Reference Alias="IncidentManagement"> <ID>ServiceManager.IncidentManagement.Library</ID> <Version>7.5.1088.276</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> <Reference Alias="System"> <ID>System.Library</ID> <Version>7.5.1088.276</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> </References>
儲存更新的檔案。
在 PresentationsType 和 </Categories> 區段間新增 <Presentation> 區段。 新增內容的最終結果應如下所示:
</Categories> <PresentationTypes> <ViewTypes> <ViewType ID="Dashboard" Accessibility="Public"> <Configuration> <xsd:any minOccurs="0" maxOccurs="unbounded" processContents="skip" xmlns:xsd="http://www.w3.org/2001/XMLSchema" /> </Configuration> <ViewImplementation> <Assembly>Console!WpfViewsAssembly</Assembly> <Type>Microsoft.EnterpriseManagement.UI.WpfViews.Overview</Type> </ViewImplementation> </ViewType> </ViewTypes> </PresentationTypes> <Presentation>
儲存更新的檔案。
在 <Presentation> 和 <Folders> 標記之間新增以下內容,以新增檢視宣告。 產生的程式碼應如下所示:
<Presentation> <Views> <View ID="View.IncidentDashboard" Accessibility="Public" Enabled="true" Target="System!System.Entity" TypeID="Dashboard" Visible="true"> <Category>NotUsed</Category> <Configuration> <Presentation> <Header /> <Content> <WebBrowser xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml" Name="wb1" Source="http://Dashboards/IncidentDashboard.aspx"/> </Content> </Presentation> </Configuration> </View> </Views> <Folders>
注意
將 Source 屬性中的 URL 取代為環境中儀表板的 URL。 此 URL 應顯示使用者之瀏覽器能在內部網路或網際網路中存取的內容。儲存更新的檔案。
在 FolderItem 區段中新增 FolderItems 元素。 產生的程式碼應如下所示:
<Folders> <Folder ID="Folder.dd2ff258eca54d93a4f10c312df00673" Accessibility="Public" ParentFolder="IncidentManagement!ServiceManager.Console.IncidentManagement" /> </Folders> <FolderItems> <FolderItem ElementID="View.IncidentDashboard" ID="FolderItem.View.IncidentDashboard" Folder="Folder.dd2ff258eca54d93a4f10c312df00673"/> <FolderItem ElementID="EnterpriseManagement!Microsoft.EnterpriseManagement.ServiceManager.UI.Console.Task.CreateGridView" ID="FolderItem.695321a1458140e7af75fe3a95888f8e" Folder="Folder.dd2ff258eca54d93a4f10c312df00673" /> </FolderItems>
重要
[Folder ID](assetId:///Folder ID) 是主控台於資料夾建立時產生的,因此每次都會不同。 請複製 ID 元素中的 <Folder> 屬性,然後貼入 Folder 元素中使其成為 FolderItem 屬性。 請確認 Folder 元素 ID 屬性的值與 FolderItem 元素 Folder 屬性的值相同。儲存更新的檔案。
利用前一步驟的內容更新 DisplayString 的 ID。 找出以下程式碼:
<DisplayString ElementID="Folder.<ID>”
利用前一步驟的內容更新 ID。 這段程式碼現在應該與以下程式碼相似:
<DisplayString ElementID="Folder.dd2ff258eca54d93a4f10c312df00673">
在 ImageReference 區段中新增 ImageReferences 元素。 產生的程式碼應如下所示:
<ImageReferences> <ImageReference ElementID="View.IncidentDashboard" ImageID="IncidentManagement!IncidentMgmt_AllIncidents_16"/> <ImageReference ElementID="Folder.dd2ff258eca54d93a4f10c312df00673" ImageID="EnterpriseManagement!Microsoft.EnterpriseManagement.ServiceManager.UI.Console.Image.Folder" /> </ImageReferences>
注意
此 ImageReference 元素指向 Service Manager 主控台中 [所有事件] 檢視使用的預設 [事件] 圖示。 您可以改用自訂影像來源。儲存更新的檔案。
在 DisplayString 區段中新增 DisplayStrings 元素。 產生的程式碼應如下所示:
<LanguagePacks> <LanguagePack ID="ENU" IsDefault="true"> <DisplayStrings> <DisplayString ElementID="View.IncidentDashboard"> <Name>Incident Dashboard</Name> </DisplayString> <DisplayString ElementID="IncidentDashboards"> <Name>Dashboards</Name> </DisplayString> <DisplayString ElementID="Folder.dd2ff258eca54d93a4f10c312df00673"> <Name>Dashboards</Name> </DisplayString> </DisplayStrings> </LanguagePack> </LanguagePacks>
儲存更新的檔案。
若要在自訂檢視中顯示儀表板
在 Service Manager Windows PowerShell 工作階段中,執行以下命令以驗證 IncidentDashboards 管理組件:
Test-SCManagementPack –FullName C:\DashBoards\IncidentDashboards.xml
如果驗證成功,請執行以下命令以匯入管理組件:
Import-SCManagementPack –FullName C:\DashBoards\IncidentDashboards.xml
關閉 Service Manager 主控台,然後再重新開啟。
按一下 [工作項目]。 展開 [工作項目] 窗格中的 [事件管理],然後展開 [儀表板]。 選取 [事件儀表板] 檢視以檢視 Service Manager 主控台主控之 SharePoint 網站的儀表板。
注意
如果您在缺少 Service Manager 資料倉儲的環境中執行此程序,儀表板可能會無法顯示實際的資料。