problem with DelegateSentItemsStyle

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

problem with DelegateSentItemsStyle
 
Karim




Posts: 170
Joined: 2006-01-02
Hi,

Please, before see this topic
https://www.add-in-express.com/forum/read.php?FID=1&TID=13069&MID=66547#message66547

When i use DelegateSentItemsStyle and i catch Sent Items event i have problem if there are a lot user send mail in same time.
For example, User A send message and User B send other message in same time
in my plug in, the User A catch (in ItemSend event) message of User B

I don't have problem if in registre DelegateSentItemsStyle = 0
Posted 18 Feb, 2016 06:41:14 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hello Karim,

And the problem is: you need to filter out emails sent by the user who started Outlook, correct?

I suggest that you check the Sender and SendeAddress properties; one of them is set to the user (or its address) who actually sends the message.


Andrei Smolin
Add-in Express Team Leader
Posted 18 Feb, 2016 07:16:34 Top
Karim




Posts: 170
Joined: 2006-01-02
Hello Andrei,


And the problem is: you need to filter out emails sent by the user who started Outlook, correct?
--> Exactly !

I suggest that you check the Sender and SendeAddress properties; one of them is set to the user (or its address) who actually sends the message.


--> I'll try your solution

Thanks a lot
Posted 18 Feb, 2016 07:47:07 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hello Karim,

Please let me know about your result.


Andrei Smolin
Add-in Express Team Leader
Posted 19 Feb, 2016 01:12:21 Top
Karim




Posts: 170
Joined: 2006-01-02
Hi Andrei,

I like to change my code below. I left one day turned on the customer
The customer told me it is better than before but the event still occurs.

...
ol2010objFolder := ol2010.Session.GetDefaultFolder(olFolderSentMail);
...
ol2010objFolder.Items.GetFirst;
...

str_fltr :='[SenderName] = "' +OutlookApp.GetNamespace('MAPI').CurrentUser.Name + '"';
myItems := ol2010objFolder.items.Restrict(str_fltr);
FItems.ConnectTo(outlook2000._Items(myItems));
...
FItems.OnItemAdd := MyMessage;

Is this the right way ?
Posted 11 Mar, 2016 08:50:38 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hello Karim,

If you ask about connecting to the events of the filtered Items collection, this is correct.

I suppose, however, that you need to check the name of the actual sender. If so, try to filter on the Changed By field. It isn't exposed in the MailItem interface but you can access it using the PropertyAccessor obect. At https://social.msdn.microsoft.com/Forums/office/en-US/9aed0a03-6532-4d24-a62c-44442937d103/access-exchange-shared-calendars-with-vsto-addin?forum=outlookdev, Ken Slovak explains that the DASL property tag (not a URL) for PR_LAST_MODIFIER_NAME would be "http://schemas.microsoft.com/mapi/proptag/0x3FFA001E", and for PR_LAST_MODIFIER_NAME_W would be "http://schemas.microsoft.com/mapi/proptag/0x3FFA001F". I suppose PR_LAST_MODIFIER_NAME_W is what you are after.

To construct the corresponding SQL string, you can use the Advanced tab of the Filter dialog (View | View Settings | Filter). To get the SQL, switch to the SQL tab, copy the SQL and pass it to the Restrict method prepending the SQL string with '@SQL='; find more details at https://msdn.microsoft.com/en-us/library/office/ff869597%28v=office.15%29.aspx.


Andrei Smolin
Add-in Express Team Leader
Posted 14 Mar, 2016 03:01:41 Top