Tuesday, July 17, 2007

MDM Get Attributes

I needed a way to get all the attributes for a repository in MDM. I did that with the MDM COM API like this:


this.catalog = Helper.GetCatalog();


DataTable dt = new DataTable();
dt.Columns.Add(”Name”);
dt.Columns.Add(”ID”);
XCATCOMLib.Attributes allAttributes = new XCATCOMLib.AttributesClass();
allAttributes = catalog.GetAttributes(CATEGORY_TABLE, 0, false);


foreach(XCATCOMLib.Attribute attrib in allAttributes)
{

DataRow row = dt.NewRow();
row[”Name”] = attrib.Name;
row[”ID”] = attrib.ID;
dt.Rows.Add(row);

}

this.dgAttributes.DataSource = dt;

this.dgAttributes.DataBind();