public static string ReadANamedCustomProperty(Microsoft.Office.Interop.Visio.Shape customPropertyShape, string cellName, bool isLocalName) { Microsoft.Office.Interop.Visio.Cell customPropertyCell = null; if (customPropertyShape != null || cellName != null) { const string CUST_PROP_PREFIX = "Prop."; string propName; try { if (cellName.Length == 0) { throw new System.ArgumentNullException("cellName", "Zero length string input."); } propName = CUST_PROP_PREFIX + cellName; if (isLocalName) { if (customPropertyShape.get_CellExists(propName, (short)Microsoft.Office.Interop.Visio.VisExistsFlags.visExistsAnywhere) != 0) { customPropertyCell = customPropertyShape.get_Cells(propName); } } else if (customPropertyShape.get_CellExistsU(propName, (short)Microsoft.Office.Interop.Visio.VisExistsFlags.visExistsAnywhere) != 0) { customPropertyCell = customPropertyShape.get_CellsU(propName); } } catch (Exception err) { System.Windows.Forms.MessageBox.Show(err.Message); throw; } } return((customPropertyCell != null) ? customPropertyCell.get_ResultStr(Microsoft.Office.Interop.Visio.VisUnitCodes.visNoCast) : ""); }