Share via


SPDataStore.CreateDashboard - Méthode

Enregistre un objet de tableau de bord sous la forme d'un type de contenu dans une liste SharePoint.

Espace de noms :  Microsoft.PerformancePoint.Scorecards.Store
Assembly :  Microsoft.PerformancePoint.Scorecards.Store (dans Microsoft.PerformancePoint.Scorecards.Store.dll)

Syntaxe

'Déclaration
Public Function CreateDashboard ( _
    listUrl As String, _
    dashboard As Dashboard _
) As Dashboard
'Utilisation
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
)

Paramètres

  • listUrl
    Type : System.String

    L'URL relative de serveur de la liste SharePoint pour enregistrer l'objet. Exemple : /BI Center/Lists/PerformancePoint Content.

Valeur renvoyée

Type : Microsoft.PerformancePoint.Scorecards.Dashboard
Le nouvel objet, qui contient des informations mises à jour ce son numéro de version et d'emplacement.

Implémentations

IBIMonitoringStore.CreateDashboard(String, Dashboard)

Remarques

Cette méthode enregistre un objet de tableau de bord comme un type de contenu dans une liste SharePoint ; Il ne déploie pas le tableau de bord pour l'affichage. Les tableaux de bord est déployés sur SharePoint pour l'afficher à partir de PerformancePoint Dashboard Designeret des tableaux de bord déployés est stockés dans des bibliothèques de documents distincts.

Exemples

L'exemple de code suivant montre comment utiliser une méthode privée pour créer un tableau de bord et d'appeler CreateDashboard(String, Dashboard) pour l'enregistrer dans le référentiel.

Pour pouvoir compiler cet exemple de code, vous procédez comme suit :

  • Configurer votre environnement de développement et créer un projet de bibliothèque de classes c# dans Visual Studio. Pour plus d'informations sur la configuration d'un environnement de développement, voir Configurer un environnement de développement général pour SharePoint 2013.

  • Ajoutez le Microsoft.PerformancePoint.Scorecards.Client, Microsoft.PerformancePoint.Scorecards.ServerCommon, Microsoft.PerformancePoint.Scorecards.Store et System.Windows.Forms DLL en tant que références à votre projet. Pour plus d'informations sur PerformancePoint Services DLL, voir PerformancePoint Services DLLs Used in Development Scenarios.

  • Ajoutez les directives using suivantes à votre classe.

    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);
}

Voir aussi

Référence

SPDataStore classe

SPDataStore - Membres

Microsoft.PerformancePoint.Scorecards.Store - Espace de noms