usmanazizgroupdocs
6/7/2016 - 7:16 AM

UpdateIPTCPhotoMetadataFromXMP.vb

' For complete examples and data files, please go to https://github.com/groupdocs-metadata/GroupDocs.Metadata-for-.NET
' get xmp metadata
Dim xmpWrapper As XmpPacketWrapper = MetadataUtility.ExtractXmpPackage(Common.MapSourceFilePath(filePath))

If xmpWrapper Is Nothing Then
    xmpWrapper = New XmpPacketWrapper()
End If

' add iptc4xmpcore if not exist
If Not xmpWrapper.ContainsPackage(Namespaces.Iptc4XmpCore) Then
    xmpWrapper.AddPackage(New IptcCorePackage())
End If

' get iptc4XmpCore package
Dim iptcCorePackage As IptcCorePackage = DirectCast(xmpWrapper.GetPackage(Namespaces.Iptc4XmpCore), IptcCorePackage)

' set country code
iptcCorePackage.CountryCode = "new country code"

' set sublocation
iptcCorePackage.Sublocation = "new sublocation"

' update intellectual genre
iptcCorePackage.IntellectualGenre = "music"

' save changes to another file
MetadataUtility.UpdateMetadata(Common.MapSourceFilePath(filePath), New XmpMetadata(xmpWrapper), Common.MapDestinationFilePath(filePath))