PerformancePoint Planning: Deleting a Custom Member Property – A Solution

I had a bit of a rant yesterday about the fact I have had to compromise naming custom member properties when I’ve inadvertently created them with the wrong data type.  As I mentioned, I found a Dimension attribute collection method in the Planning client assemblies that hinted that it might allow me to delete a member property so I decided to give it a go.

Below is some really rough and ready C# code that actually does delete a dimension member property.  I will improve the code and probably add it in to my PPSCMD GUI interface as a ‘feature pack’ bonus at some stage, however, if you are in desperate need for the code to delete a member property, and you can’t wait for PPSCMD GUI v0.2 or PerformancePoint Version 2 (I’m not sure which will come first !) the code is below (Use at your own risk !!)

Note:  Replace “MyApp“, “MyDimension“, “MyAttribute“, oh, and the server address, accordingly..

    using Microsoft.PerformancePoint.Planning.Client.Common;
    using Microsoft.PerformancePoint.Planning.Bmo.Core;
 // Setup the PPS Application Metadata Manager  
ServerHandler serverHandler = new ServerHandler("http://localhost:46787");  
MetadataManager manager = new MetadataManager(); 
manager.ServerHandler = serverHandler; 

// Get the system metadata  BizSystem system = manager.GetSystem(true);  

// Get hold of the PPS Application  BizApplication ppsApp = system.Applications["MyApp"];  

// Obtain the root model site from the application  BizModelSite site = ppsApp.RootModelSite;  

// Obtain the dimension that contains the member property  BizDimension dimension = site.Dimensions["MyDimension"];  

// Obtain the member property  BizDimensionAttribute attribute = dimension.Attributes["MyAttribute"];  

// Check out the dimension  manager.CheckOut(dimension.Id, dimension.ParentModelSite.Id);  

// Perform the delete  dimension.DeleteDimensionAttribute(attribute, null);  

// Submit the change  manager.SubmitModelSite(ppsApp.Id, dimension.ParentModelSite, Microsoft.PerformancePoint.Planning.Bmo.Interfaces.SubmissionType.Update);  

// Check in the dimension  manager.CheckIn(dimension.Id, dimension.ParentModelSite.Id);

Update:  I’ve since discovered that you can obtain an unsupported utility from Microsoft Support that reportedly does the same thing, doh !
Oh well, always nice to have the code ..J