How do I check if the Word document custom property exists?
And how to remove it?
object customProps = wordDoc.CustomDocumentProperties;
Type typeCustomProps = customProps.GetType();
object[] args =
{"CompanyName",
false,
Microsoft.Office.Core.MsoDocProperties.msoProperty TypeString,
"Microsoft Corporation"};
// I know how to add the property by
typeCustomProps.InvokeMember("Add",
BindingFlags.Default | BindingFlags.InvokeMethod,
null,
customProps,
args);
But I want to check if it exists then delete it, and then add it back?