SPDataStore.CreateScorecard method

Saves a scorecard object as a content type in a SharePoint list.

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

public Scorecard CreateScorecard(
	string listUrl,
	Scorecard newElement


Type: System.String

The server-relative URL of the SharePoint list to save the object to. Example: /BI Center/Lists/PerformancePoint Content.

Type: Microsoft.PerformancePoint.Scorecards.Scorecard

The scorecard object to save, which specifies a value for the required Name property.

Return value

Type: Microsoft.PerformancePoint.Scorecards.Scorecard
The new object, which contains updated information such its location and version number.


IBIMonitoringStore.CreateScorecard(String, Scorecard)

The following code example shows how to use a private method to create a scorecard and to call CreateScorecard(String, Scorecard) to save it to the repository.

Before you can compile this code example, you must do the following:

  • Configure your development environment and create a C# class library project in Visual Studio. For information about configuring a development environment, see Set up a general development environment for SharePoint 2013.

  • Add the Microsoft.PerformancePoint.Scorecards.Client, Microsoft.PerformancePoint.Scorecards.ServerCommon, Microsoft.PerformancePoint.Scorecards.Store, and System.Drawing DLLs as references to your project. For more information about PerformancePoint Services DLLs, see PerformancePoint Services DLLs Used in Development Scenarios.

  • Add the following using directives to your class.

    using Microsoft.PerformancePoint.Scorecards;
    using Microsoft.PerformancePoint.Scorecards.Store;
    using System.Drawing;
// Create a scorecard that contains two KPIs, based on the following parameters:
//   - scorecardName is the name for the scorecard.
//   - listUrl is the server-relative URL of the list to save the scorecard to. Example: 
//      "/BI Center/lists/PerformancePoint Content"
//   - kpi1 is the first KPI.
//   - kpi2 is the second KPI.
// This method returns the new scorecard.
private Scorecard CreateScorecard(string scorecardName, string listUrl, Kpi kpi1, Kpi kpi2)
    if (String.IsNullOrEmpty(scorecardName))
        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 == kpi1)
        throw new ArgumentNullException("kpi1");
    if (null == kpi2)
        throw new ArgumentNullException("kpi2");

    // Create a reference to the global data store for convenience.
    SPDataStore globalStore = SPDataStore.GlobalDataStore;  
    List<string> actualHeaders = new List<string>();
    List<string> targetHeaders = new List<string>();

    Scorecard newScorecard = Scorecard.CreateNew();
    newScorecard.Name.Text = scorecardName;
    newScorecard.Description.Text = "Created with the SDK.";

    // Define the fonts and colors for the grid.
    Font scFont = new Font(FontFamily.GenericSansSerif, 9);
    newScorecard.ConfiguredView = ConfiguredView.CreateDefaultConfiguredView(

    KpiCollection kpis = new KpiCollection();
    GridViewDefinition gvd = newScorecard.ConfiguredView.GridViewDefinition;

    foreach (Kpi includedKpi in kpis)
        // Add the KPIs to the scorecard.
        GridHeaderItem rowItem = GridHeaderItem.CreateKpiHeader(includedKpi.Location);

        // Find unique actuals.
        for (int i = 0; i < includedKpi.Actuals.Count; i++)
            if (!actualHeaders.Contains(includedKpi.Actuals[i].Name.Text))

        // Find unique targets.
        for (int i = 0; i < includedKpi.Targets.Count; i++)
            if (!targetHeaders.Contains(includedKpi.Targets[i].Name.Text))

    // Add the actual headings to the scorecard.
    foreach (string actualHeader in actualHeaders)
        GridHeaderItem actualItem = GridHeaderItem.CreateActualHeader(actualHeader);

    // Add the target headings to the scorecard.
    foreach (string targetHeader in targetHeaders)
        GridHeaderItem targetItem = GridHeaderItem.CreateTargetHeader(targetHeader);


    // Call the CreateScorecard method to save the new scorecard to the specified list.
    // TODO: Handle exceptions from this call.
    return globalStore.CreateScorecard(listUrl, newScorecard);