/// <summary> /// Uses TOM TDSE and not Core Service. /// TOM XML Method is fastest /// </summary> /// <param name="comp">Component</param> /// <param name="fieldname">Metadata fieldname</param> /// <returns>Value of Metadata field</returns> private string GetMetadataValue(Component comp, string fieldname) { // TOM API - slow 12 seconds //if (comp.MetadataFields.Count > 0) //{ // if (comp.MetadataFields[fieldname] != null) // { // attrValue = comp.MetadataFields[fieldname].value[1]; // } //} // TOM XML - Fastest, only 2 seconds string value = ""; XmlDocument xmlDoc = GetXmlDoc(); xmlDoc.LoadXml(comp.GetXML(Tridion.ContentManager.Interop.TDSDefines.XMLReadFilter.XMLReadDataContent)); string xPath = String.Format("//*[local-name()='{0}']", fieldname); if (xmlDoc.SelectSingleNode(xPath) != null) { value = xmlDoc.SelectSingleNode(xPath).InnerText; } return value; }