Search code examples
sharepoint-2010mdxperformancepoint

Retrieve MDX from pps dashboard deployed on Sharepoint Site Collection


Is there a way to retrieve the names and corresponding mdx queries of charts and reports deployed on a sharepoint site ?
i am using Shrepoint 2010


Solution

  • SharePoint Server 2010 uses the PPSAuthoringService web service instead of PmService. If you havent seen it yet, check out this post on the PerformancePoint Services team blog: http://blogs.msdn.com/b/performancepoint/archive/2010/09/13/using-the-ppsauthoringservice-web-service.aspx

    The OLAP report's query is stored in the ReportView.CustomData property. Something like this should work (even though this example calls the web service from the API). Warning--I'm an amateur programmer.

    2/4/11 -- Instead of querying the report's CustomData prop as shown below, you can just pass the report location to the GetMdx method.

    static void Main(string[] args)
    {
        string pathToAuthoringService = "http://<serverName>/_vti_bin/PPS/PPSAuthoringService.asmx";
        IBIMonitoringAuthoring service = BIMonitoringAuthoringServiceProxy.CreateInstance(pathToAuthoringService);
    
        string listUrl = "/BICenter/Lists/PerformancePoint Content/";
        FirstClassElementCollection fcos = service.GetListItems(listUrl);
        Dashboard dashboard = new Dashboard();
    
        foreach (FirstClassElement fco in fcos)
        {
            if (fco.ContentType == FCOContentType.PpsDashboard && fco.Name.Text == "Contoso Sales Management")
            {
                dashboard = fco as Dashboard;
            }
        }
    
        // Or if you know the ItemUrl, you can retrieve the dashboard directly.
        //RepositoryLocation dashboardLocation = new RepositoryLocation("/BICenter/Lists/PerformancePoint Content/32._000");
        //Dashboard dashboard = service.GetDashboard(dashboardLocation);
    
        List<RepositoryLocation> childLocations = dashboard.GetChildFCOLocations();
        foreach (RepositoryLocation location in childLocations)
        {
            if (location.ItemType == FirstClassObjectType.ReportView)
            {
                ReportView report = service.GetReportView(location);
    
                if (report.IsAnalyticReport())
                {
                    Console.WriteLine(report.CustomData);
            }
        }
    }
    

    }