Delete thumbnail

Created:7/1/2002
Description:

This tip demonstrates how to delete the thumbnail from the metadata without altering the rest of the metadata content.

NOTE: this macro doesn't verify that the selected object supports metadata, whether it already has metadata, or whether the metadata is writable. For an example of how this is accomplished, look at the function HasWritableMD in the CheckMD module provided with the Metadata Spellchecker sample.


How to use:
Sub DeleteThumbnail()
      
    Dim pGxApp As IGxApplication
    Dim pGxView As IGxView
    Dim pMD As IMetadata
    Dim pPS As IPropertySet
    Dim dNow As Date
    
    Set pGxApp = Application
    Set pMD = pGxApp.SelectedObject
    Set pPS = pMD.Metadata
    
    ' delete the thumbnail from the location where it was placed
    ' with ArcCatalog 8.0
    pPS.RemoveProperty "idinfo/browse/browseem"
 
    ' delete the thumbnail from the location where it is managed
    ' with ArcCatalog 8.1 and newer versions
    pPS.RemoveProperty "Binary/Thumbnail"
 
    ' set the time that the metadata was modified, then
    ' save the changes
    dNow = Now
    pPS.SetProperty "Esri/ModDate", Format(dNow, "yyyymmdd")
    pPS.SetProperty "Esri/ModTime", Format(dNow, "HhNnSs") & "00"
    pMD.Metadata = pPS
    
    Set pGxView = pGxApp.View
    If TypeOf pGxView Is IGxDocumentationView Then
        pGxView.Refresh
    End If
 
End Sub