Freigeben über


SPDataStore.CreateDashboard-Methode

Speichert ein Dashboard-Objekt als Inhaltstyp in einer SharePoint-Liste.

Namespace:  Microsoft.PerformancePoint.Scorecards.Store
Assembly:  Microsoft.PerformancePoint.Scorecards.Store (in Microsoft.PerformancePoint.Scorecards.Store.dll)

Syntax

'Declaration
Public Function CreateDashboard ( _
    listUrl As String, _
    dashboard As Dashboard _
) As Dashboard
'Usage
Dim instance As SPDataStore
Dim listUrl As String
Dim dashboard As Dashboard
Dim returnValue As Dashboard

returnValue = instance.CreateDashboard(listUrl, _
    dashboard)
public Dashboard CreateDashboard(
    string listUrl,
    Dashboard dashboard
)

Parameter

  • listUrl
    Typ: System.String

    Die serverrelative URL der SharePoint-Liste um das Objekt zu speichern. Beispiel: /BI Center/Lists/PerformancePoint Content.

Rückgabewert

Typ: Microsoft.PerformancePoint.Scorecards.Dashboard
Das neue Objekt, das enthält aktualisierte Informationen so ihre Nummer und Version.

Implementiert

IBIMonitoringStore.CreateDashboard(String, Dashboard)

Hinweise

Diese Methode speichert ein Dashboard-Objekt als Inhaltstyp in einer SharePoint-Liste; Es stellt nicht das Dashboard für die Anzeige bereit. Dashboards sind für die Anzeige von PerformancePoint Dashboard-Designerin SharePoint bereitgestellt und bereitgestellte Dashboards in separaten Dokumentbibliotheken gespeichert sind.

Beispiele

Im folgenden Codebeispiel wird veranschaulicht, wie Sie eine private Methode verwenden, um ein Dashboard erstellen und Aufrufen von CreateDashboard(String, Dashboard) , um sie im Repository zu speichern.

Bevor Sie dieses Codebeispiel kompilieren können, müssen Sie Folgendes tun:

  • Konfigurieren Sie die Entwicklungsumgebung, und erstellen Sie ein C#-Klassenbibliotheksprojekt in Visual Studio. Informationen zum Konfigurieren einer Entwicklungsumgebung finden Sie unter Einrichten einer allgemeinen Entwicklungsumgebung für SharePoint 2013.

  • Die Microsoft.PerformancePoint.Scorecards.Client, Microsoft.PerformancePoint.Scorecards.ServerCommon, Microsoft.PerformancePoint.Scorecards.Store und System.Windows.Forms DLLs als Verweise auf Ihr Projekt hinzufügen. Weitere Informationen zu PerformancePoint-Dienste DLLs finden Sie unter PerformancePoint Services DLLs Used in Development Scenarios.

  • Fügen Sie die folgenden using Direktiven zu Ihrer Klasse.

    using Microsoft.PerformancePoint.Scorecards;
    using Microsoft.PerformancePoint.Scorecards.Store;
    
// Create a dashboard that contains a scorecard and a report, based on the following parameters:
//   - dashboardName is the name for the dashboard.
//   - listUrl is the server-relative URL of the list to save the dashboard to. Example: 
//      "/BI Center/Lists/PerformancePoint Content"
//   - sc is a scorecard to add to the dashboard.
//   - report is a report to add to the dashboard.
// This method returns the new dashboard.
private Dashboard CreateDashboard(string dashboardName, string listUrl, Scorecard sc, ReportView report)
{
    if (String.IsNullOrEmpty(dashboardName))
        throw new ArgumentException("The name must not be null or empty.");
    if (String.IsNullOrEmpty(listUrl))
        throw new ArgumentException("The list URL must not be null or empty.");
    if (null == sc)
        throw new ArgumentNullException("sc");
    if (null == report)
        throw new ArgumentNullException("report");

    Dashboard newDashboard = Dashboard.CreateNew();
    newDashboard.Name.Text = dashboardName;
    newDashboard.Description.Text = "Created with the SDK.";

    // The dashboard has a single page with two zones.
    DashboardElementContainer page = new DashboardElementContainer();
    page.Guid = Guid.NewGuid();
    page.Orientation = LayoutOrientation.VerticalTopJustified;
    newDashboard.TemplateType = DashboardTemplateId.Rows2;
    for (int rowNumber = 1; rowNumber <= 2; rowNumber++)
    {
        DashboardElementContainer row = new DashboardElementContainer();
        row.Guid = Guid.NewGuid();
        row.Name.Text = String.Format("Row {0}", rowNumber);
        row.Height = new DashboardElementSize();
        row.Height.Units = System.Windows.Forms.SizeType.Percent;
        row.Height.Measurement = 50; // 50 percent
        row.Orientation = LayoutOrientation.HorizontalLeftJustified;

        DashboardItem newItem = new DashboardItem();
        newItem.Guid = Guid.NewGuid();
        newItem.Height.Measurement = 50;
        newItem.Height.Units = System.Windows.Forms.SizeType.Percent;
        FirstClassElement currentElement;
        if (rowNumber == 1)
        {
            // The scorecard in the first zone.
            currentElement = sc;
            newItem.AutoSizeHeight = true;
            newItem.AutoSizeWidth = true;
        }
        else
        {
            // The report view in the second zone.
            currentElement = report;
            newItem.AutoSizeHeight = false;
            newItem.AutoSizeWidth = false;
        }
        newItem.UnderlyingElementType = currentElement.GetType();
        newItem.UnderlyingElementLocation = currentElement.Location;
        row.DashboardElements.Add(newItem);
        page.DashboardElements.Add(row);
    }

    newDashboard.Pages.Add(page);

    // Call the CreateDashboard method to save the new dashboard to the specified list.
    // TODO: Handle exceptions from this call.
    return SPDataStore.GlobalDataStore.CreateDashboard(listUrl, newDashboard);
}

Siehe auch

Referenz

SPDataStore Klasse

SPDataStore-Member

Microsoft.PerformancePoint.Scorecards.Store-Namespace