Hi everyone,
I am converting C# code from ArcGIS 9.3 to 10.1 and have hit a wall trying to set the metadata stylesheet in code. In 9.3 the code to change the stylesheet was:
IMetadataViewWindow metadataWindow = new MetadataViewWindowClass();
metadataWindow.Layer = pLayer;
metadataWindow.Application = m_application;
metadataWindow.DataSource = pDataLayer.DataSourceName as IDatasetName;
metadataWindow.MetadataHelper.Stylesheet = "FGDC ESRI";
The main problem is that the Stylesheet property on the IMetadataViewWindow interface is read only in 10.1 where it used to be read/write in 9.3.
My attempt at the 10.1 code using the IMetadataHelper Stylesheet Example is:
IExtension pExtension = m_application.FindExtensionByName("ESRI Metadata Extension") as IExtension;
IMetadataHelper pMetadataHelper = pExtension as IMetadataHelper;
pMetadataHelper.Stylesheet = "ARCGIS";
I also tried pMetadataHelper.Stylesheet = "FGDC ESRI"; and pMetadataHelper.Stylesheet = "FGDC CSDGM Metadata";
The code produces no errors but it does not work either.
Opening some metadata after running the code produces the default "Item Description" metadata style. I can change it manually by going to Customize > Options and on the Metadata tab choose the style I want but I need to do this in code because most of the users accessing our code are not very ArcGIS literate so the more things I can automate, the better.
I have looked through the old forums as well as the new ones and found very few posts dealing with metadata.
Thanks for your time,
Carlos