Delete BuiltInDocumentProperties items?

Add-in Express™ Support Service
That's what is more important than anything else

Delete BuiltInDocumentProperties items?
 
Steve Obarowski




Posts: 16
Joined: 2017-01-24
Is it possible to delete items from the BuiltInDocumentProperties object? I get an error when I try. Basically, I am trying to replicate the behavior in Word's Check For Issues->Inspect Document where you can remove the Author for example.

Here is the current code:

var props = activeDocument.BuiltInDocumentProperties as DocumentProperties;
List<metadataClass> metaList = clbMetadata.CheckedItems.Cast<metadataClass>().ToList();
foreach (metadataClass item in metaList)
{
DocumentProperty prop = props[item.Name];
if (prop != null)
{
//props[item.Name].Delete();
props[item.Name].Value = "";
//Marshal.ReleaseComObject(prop);
}
}
activeDocument.Save();

When I use the Delete() method, I get an error. When I blank out the value, it simply gets repopulated the next time I save it. Any thoughts here would be appreciated.
Posted 02 Feb, 2017 16:02:23 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Hello Steve,

I don't think deleting a *built-in* property should work. I've tried to set the Author property to "{undefined}" and it persists for me.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 03 Feb, 2017 03:32:40 Top