Added UserProperties Printing

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

Added UserProperties Printing
 
GKoehn


Guest


Is there a way to create a UserProperty that would not show up when printing the Outlook Item?
I have created UserProperties on emails.
Now when I print the email it has my UserProperties Names and Values showing on paper.
Posted 08 Dec, 2011 10:30:58 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Posted 09 Dec, 2011 04:25:14 Top
GKoehn


Guest


After much searching I came up with a way to set and get a property that does not print.
Here is the code for setting a property with a value...

var
  MailItem: _MailItem;
  prop: string;
begin
  OutlookAppObj.ActiveInspector.CurrentItem.QueryInterface(IID__MailItem,MailItem);
  if Assigned(MailItem) then
    begin
      prop := 'http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/MyProperty';
      OleVariant(OutlookAppObj.ActiveInspector.CurrentItem).PropertyAccessor.SetProperty(prop,'HelloProperty');
    end;
end;


Here is the code to read the property...

var
  prop: string;
  MailItem: _MailItem;
begin
  OutlookAppObj.ActiveInspector.CurrentItem.QueryInterface(IID__MailItem,MailItem);
  if Assigned(MailItem) then
    begin
      prop := 'http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/MyProperty';
      showmessage(OleVariant(OutlookAppObj.ActiveInspector.CurrentItem).PropertyAccessor.GetProperty(prop));
    end;
end;


Hope this helps someone in the future!
Posted 22 Dec, 2011 18:01:49 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Hello,

Thank you very much for posting this!


Andrei Smolin
Add-in Express Team Leader
Posted 23 Dec, 2011 01:37:29 Top
GKoehn


Guest


To clarify one thing...
I had to add the "Save" to the MailItem to get it to persist.

var 
  MailItem: _MailItem; 
  prop: string; 
begin 
  OutlookAppObj.ActiveInspector.CurrentItem.QueryInterface(IID__MailItem,MailItem); 
  if Assigned(MailItem) then 
    begin 
      prop := 'http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/MyProperty'; 
      OleVariant(OutlookAppObj.ActiveInspector.CurrentItem).PropertyAccessor.SetProperty(prop,'HelloProperty'); 
      MailItem.Save;
    end; 
end;
Posted 04 Jan, 2012 13:54:40 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Thank you again! Great attitude! Just super!


Andrei Smolin
Add-in Express Team Leader
Posted 05 Jan, 2012 05:27:20 Top