// For complete examples and data files, please go to https://github.com/groupdocs-metadata/GroupDocs.Metadata-for-.NET
// get xmp metadata
XmpPacketWrapper xmpWrapper = MetadataUtility.ExtractXmpPackage(Common.MapSourceFilePath(filePath));
if (xmpWrapper == null)
{
xmpWrapper = new XmpPacketWrapper();
}
// add iptc4xmpcore if not exist
if (!xmpWrapper.ContainsPackage(Namespaces.Iptc4XmpCore))
{
xmpWrapper.AddPackage(new IptcCorePackage());
}
// get iptc4XmpCore package
IptcCorePackage iptcCorePackage = (IptcCorePackage)xmpWrapper.GetPackage(Namespaces.Iptc4XmpCore);
// 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));