how send header from user A to user B

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

how send header from user A to user B
 
Giancarlo


Guest


If user A do:


procedure TAddInModule.adxOutlookAppEvents1ItemSend(ASender: TObject; const Item: IDispatch; var Cancel: WordBool);
var
FMail: TMailItem; 
begin
FMail.UserProperties.Add('MyProp', olText, false, false).Value := 'test'; 
Cancel := False;
end;


the user B can't read 'MyProp'.

I think that i need to send an header information.
It's possible?
Posted 13 Sep, 2016 08:03:39 Top
Giancarlo


Guest


a bit like the property


FMail.Importance = olImportanceHigh
Posted 13 Sep, 2016 10:07:03 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Giancarlo,

Giancarlo writes:
the user B can't read 'MyProp'.


In the generic case, a UserProperty can't reach the recipient.

You can add a custom element to the Internet headers using this pattern:

PropertyAccessor.SetProperty('http://schemas.microsoft.com/mapi/string/{00020386-0000-0000-C000-000000000046}/X-{element name such as ProjectID}', '{some value such as Project #123}')

On how to get a PropertyAccessor object, see https://www.add-in-express.com/forum/read.php?FID=1&TID=10233.


Andrei Smolin
Add-in Express Team Leader
Posted 14 Sep, 2016 08:39:21 Top
Giancarlo


Guest


I tried to implement the solution in this way:
Before Outlook send the e-mail, i hook this code

procedure TAddInModule.adxOutlookAppEvents1ItemSend(ASender: TObject;
  const Item: IDispatch; var Cancel: WordBool);
var
  IMai : _MailItem;
  FMai: TMailItem;
  prop: string;
begin
  Cancel := True;
  prop := 'http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/MyProperty';
  OleVariant(Item).PropertyAccessor.SetProperty(prop,'HelloProperty');
  showmessage(OleVariant(Item).PropertyAccessor.GetProperty(prop)); //ok i read the property
  IMai:=nil;
  Item.QueryInterface(IID__MailItem, IMai);
  if (Assigned(IMai)) then begin
    Try

      FMai := TMailItem.Create(nil);
      FMai.ConnectTo(IMai);


      FMai.Body := 'test'; //i change the body content of e-mail
      FMai.Save;
      Cancel := False;

    Finally
      IMai := nil;
    end;
  end;
end;


when i receive the e-mail, i see the body changed (test)
but into header i don't found MyProperty


I tried to read the property.
On a button I added this code:


FMail: TMailItem; //see adxOutlookAppEvents1ItemLoad event
prop := 'http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/MyProperty';
showmessage(OleVariant(FMail.Parent).PropertyAccessor.GetProperty(prop));


i got this error:
MyProperty unknow or not fouded
Posted 15 Sep, 2016 05:33:53 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hello Giancarlo,

Note the "X-" part in this string:

PropertyAccessor.SetProperty('http://schemas.microsoft.com/mapi/string/{00020386-0000-0000-C000-000000000046}/X-{element name such as ProjectID}', '{some value such as Project #123}')

Does it work if you fix your code?


Andrei Smolin
Add-in Express Team Leader
Posted 15 Sep, 2016 09:52:51 Top
Giancarlo


Guest


I tried to change

  prop := 'http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/MyProperty';


into


  prop := 'http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/X-MyProperty';



and does not work :-(
Posted 15 Sep, 2016 10:33:07 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hi Giancarlo,

You use an incorrect GUID.


Andrei Smolin
Add-in Express Team Leader
Posted 16 Sep, 2016 09:15:14 Top
Giancarlo


Guest


What is the correct GUID?
Posted 16 Sep, 2016 09:20:57 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
You use {00020329-0000-0000-C000-000000000046}. I use {00020386-0000-0000-C000-000000000046}


Andrei Smolin
Add-in Express Team Leader
Posted 16 Sep, 2016 09:34:05 Top