Select to view content in your preferred language

Accessing Metadata through ArcObjects

4127
3
05-27-2010 01:31 PM
MeleKoneya
Frequent Contributor
We are currently updating feature classes in SDE by a weekly process which involves uploading shapefiles derived from files drafted in Microstation.

I would like to be able to run ArcObjects code (in C#) to retrieve the date of the last update so that we can track if an update process has not occurred recently.

I have composed some code in VBA prior to implementing a C# solution but can't seem to find out exactly how to access the properties that show when a process was last run on the feature class (usually featureclass to featureclass).    The documentation on Imetadata does not give me enough to extract the information I am looking for.

Any suggestions on how to access metadata is appreciated.

Thanks,

Mele
3 Replies
JamesCrandall
MVP Alum
Which Database is SDE running?

I have not done this, but I've seen threads discussing this topic and a solution for Oracle db's is to query All_objects data dictionary table, which apperantly has a "created" column.  I'm not too familiar with these tables and you'd have to determine what is available.

Edit:  Are you sure you cannot get at the values thru the IMetadata interface?  From an older thread that I have not tested:

Dim pMetadata As IMetadata = pFClass
Dim pPSet As IPropertySet = pMetadata.Metadata
Dim vValues As Variant = pPSet.GetProperty("Esri/CreaDate")



re: http://forums.esri.com/Thread.asp?c=93&f=993&t=103799
0 Kudos
JamesMacKay
Deactivated User
Do this to get an XML property set:

IName nameObj = (get a name object for your dataset however you prefer)
IMetadata metadata = (IMetadata)nameObj;
IXmlPropertySet2 xmlPropertySet2 = (IXmlPropertySet2)metadata.Metadata;
String xmlDoc = xmlPropertySet2.GetXml("");


Once you get the metadata as a string, pass it into your preferred .NET XML API of choice, i.e. classes from the System.Xml or System.Xml.Linq namespaces. Working with the XML through the XmlDocument class or XDocument class is much easier than using the IPropertySet or IXmlPropertySet(2) interfaces directly.

Cheers,
James
0 Kudos
MeleKoneya
Frequent Contributor
Thanks to both of you for responding.

James thanks for the reply and the code referring to how to get the metadata as an XML propertyset.    I just started to work with the code and was able to return the XML propertyset.    I will now work on getting the information out of the propertyset that I am looking for.

I hadn't checked the forums for a few weeks and did not know how to automatically subscribe to my threads.   I do now.    Always hard to get used to new things.

Mele
0 Kudos