GroupDocsGists
10/19/2017 - 11:40 AM

RemoveCustomPropertyDocFormat.cs

// For complete examples and data files, please go to https://github.com/groupdocsmetadata/GroupDocs_Metadata_NET
// initialize DocFormat
DocFormat docFormat = new DocFormat(Common.MapSourceFilePath(filePath));

// initialize DocMetadata
DocMetadata metadata = docFormat.DocumentProperties;

string propertyName = "New Custom Property";

// check if property is not built-in
if (metadata.ContainsKey(propertyName))
{
    if (!metadata.IsBuiltIn(propertyName))
    {
        // remove property
        metadata.Remove(propertyName);

    }
    else
    {
        Console.WriteLine("Can not remove built-in property.");
    }
}
else
{
    Console.WriteLine("Property does not exist.");
}

bool isexist = metadata.ContainsKey(propertyName);
                    
// save file in destination folder
docFormat.Save(Common.MapDestinationFilePath(filePath));