my $doc = Win32::OLE->GetObject($message); my $property = 'X-ICCategory'; my $value = '2'; my $docprops = $doc->CustomDocumentProperties(); unless (defined ($doc->CustomDocumentProperties($property))) { $docprops->Invoke('Add', { Name => $property, LinkToContent => 0, Type => 4, Value => $value, }); } $doc->CustomDocumentProperties($property)->{Value} = $value;