A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Access to MailItem properties before opening new inspector ?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 21st 08, 02:08 PM posted to microsoft.public.outlook.program_addins
Marcin
external usenet poster
 
Posts: 9
Default Access to MailItem properties before opening new inspector ?

Hi,

when opening MailItem in a new inspector, certain properties are lost
(SenderEmailAddress for example). I can access those properties before, in
SelectionChange, ItemLoad or Read events, however, that works fine for items
that have not been loaded into memory / cached yet.
If the item had been however read, it is somehow simply loaded from
cache/memory, without triggering those events. Any idea on accessing this
particular cached object properties before opening new inspector or forcing
flushing the cache to cause re-reading ?
Ads
  #2  
Old April 21st 08, 02:35 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Access to MailItem properties before opening new inspector ?

Properties in an item are not lost when you open that item in an Inspector,
why would you say that?

Are you trying to get the properties in the NewInspector event handler? Wait
until the first Activate event for that Inspector, when the object for
Inspector.CurrentItem isn't a weak object reference but is fully filled in.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Marcin" wrote in message
...
Hi,

when opening MailItem in a new inspector, certain properties are lost
(SenderEmailAddress for example). I can access those properties before,
in
SelectionChange, ItemLoad or Read events, however, that works fine for
items
that have not been loaded into memory / cached yet.
If the item had been however read, it is somehow simply loaded from
cache/memory, without triggering those events. Any idea on accessing this
particular cached object properties before opening new inspector or
forcing
flushing the cache to cause re-reading ?


  #3  
Old April 21st 08, 03:04 PM posted to microsoft.public.outlook.program_addins
Marcin
external usenet poster
 
Posts: 9
Default Access to MailItem properties before opening new inspector ?

Ken,

when replying or forwarding an email, I am trying to get original sender
amongst other (also some from Item.Properties). However, the sender is null,
which is probably due to the fact, that the reply is de facto a new email
(new MailItem object). What I need , is access to the original email (that I
am replying to or forwarding), so that I could read some stuff from it. As
already said - I can get it from SelectionChange,Read or ItemLoad events, but
only when reading new item (new - that does not exist in the Outlook cache
yet).
To make it short - when executing action like reply or forward on MailItem,
I need to access the original message.

Kind regards

marcin

"Ken Slovak - [MVP - Outlook]" wrote:

Properties in an item are not lost when you open that item in an Inspector,
why would you say that?

Are you trying to get the properties in the NewInspector event handler? Wait
until the first Activate event for that Inspector, when the object for
Inspector.CurrentItem isn't a weak object reference but is fully filled in.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Marcin" wrote in message
...
Hi,

when opening MailItem in a new inspector, certain properties are lost
(SenderEmailAddress for example). I can access those properties before,
in
SelectionChange, ItemLoad or Read events, however, that works fine for
items
that have not been loaded into memory / cached yet.
If the item had been however read, it is somehow simply loaded from
cache/memory, without triggering those events. Any idea on accessing this
particular cached object properties before opening new inspector or
forcing
flushing the cache to cause re-reading ?



  #4  
Old April 21st 08, 03:37 PM posted to microsoft.public.outlook.program_addins
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Access to MailItem properties before opening new inspector ?

You might find the sample code at http://www.outlookcode.com/codedetail.aspx?id=1714 useful, as it shows how to use the value of the ConversationIndex property to locate the original item from which a reply or forward was created.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Marcin" wrote in message ...

To make it short - when executing action like reply or forward on MailItem,
I need to access the original message.


  #5  
Old April 21st 08, 03:59 PM posted to microsoft.public.outlook.program_addins
Marcin
external usenet poster
 
Posts: 9
Default Access to MailItem properties before opening new inspector ?

Thanks a lot,Sue, will have a look at this immediatelly.

By the way - do you happen to have any references on Outlook caching and
cache access/manipulation from API ?

Kind regards

marcin

"Sue Mosher [MVP-Outlook]" wrote:

You might find the sample code at http://www.outlookcode.com/codedetail.aspx?id=1714 useful, as it shows how to use the value of the ConversationIndex property to locate the original item from which a reply or forward was created.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Marcin" wrote in message ...

To make it short - when executing action like reply or forward on MailItem,
I need to access the original message.



  #6  
Old April 21st 08, 04:37 PM posted to microsoft.public.outlook.program_addins
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Access to MailItem properties before opening new inspector ?

What cache are you referring to? I can think of at least three different contexts in which "cache" would be relevant. Please start a new topic thread with more details.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Marcin" wrote in message ...
Thanks a lot,Sue, will have a look at this immediatelly.

By the way - do you happen to have any references on Outlook caching and
cache access/manipulation from API ?

Kind regards

marcin

"Sue Mosher [MVP-Outlook]" wrote:

You might find the sample code at http://www.outlookcode.com/codedetail.aspx?id=1714 useful, as it shows how to use the value of the ConversationIndex property to locate the original item from which a reply or forward was created.

"Marcin" wrote in message ...

To make it short - when executing action like reply or forward on MailItem,
I need to access the original message.



  #7  
Old April 22nd 08, 11:58 AM posted to microsoft.public.outlook.program_addins
Marcin
external usenet poster
 
Posts: 9
Default Access to MailItem properties before opening new inspector ?

There must be some kind of caching, I don't exactly know what kind of, but in
fact, I would like to prevent caching at all :-), or get possibility of
reading items from cache before they are displayed in inspectors or explorers.

Anyway, thanks a lot for You hint on ConversationTopic. I started playing
with it, however, experienced a small problem using
Application.AdvancedSearch :
string filter = "[ConversationTopic] = '" + Item.ConversationTopic + "'" ;
try
{
StringBuilder SearchScope = new StringBuilder("'" +
Application.Session.GetDefaultFolder(Outlook.OlDef aultFolders.olFolderSentMail).FolderPath + "'");
SearchScope.Append(",'" +
Application.Session.GetDefaultFolder(Outlook.OlDef aultFolders.olFolderInbox).FolderPath + "'");
SearchScope.Append(",'" +
Application.Session.GetDefaultFolder(Outlook.OlDef aultFolders.olFolderDeletedItems).FolderPath + "'");
//exception is caught on line below - "The operation failed."
Outlook.Search SearchPotentialParents =
Application.AdvancedSearch(SearchScope.ToString(), filter, true,
ThisAddIn.AdvancedParentSearchTag);
}

Any idea why would it fail ? The error message is not really meaningful :-(

kind regards

marcin

"Sue Mosher [MVP-Outlook]" wrote:

What cache are you referring to? I can think of at least three different contexts in which "cache" would be relevant. Please start a new topic thread with more details.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Marcin" wrote in message ...
Thanks a lot,Sue, will have a look at this immediatelly.

By the way - do you happen to have any references on Outlook caching and
cache access/manipulation from API ?

Kind regards

marcin

"Sue Mosher [MVP-Outlook]" wrote:

You might find the sample code at http://www.outlookcode.com/codedetail.aspx?id=1714 useful, as it shows how to use the value of the ConversationIndex property to locate the original item from which a reply or forward was created.

"Marcin" wrote in message ...

To make it short - when executing action like reply or forward on MailItem,
I need to access the original message.



  #8  
Old April 22nd 08, 02:01 PM posted to microsoft.public.outlook.program_addins
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Access to MailItem properties before opening new inspector ?

You're using the Find/Restrict format for the search filter string, but AdvancedSearch requires the DASL syntax; see http://www.outlookcode.com/news.aspx?id=30.

Also, if you're searching only default folders, I don't think you need the full path in the scope string, so a string like this should work:

"'Sent Items','Inbox', 'Deleted Items'"

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Marcin" wrote in message ...
There must be some kind of caching, I don't exactly know what kind of, but in
fact, I would like to prevent caching at all :-), or get possibility of
reading items from cache before they are displayed in inspectors or explorers.

Anyway, thanks a lot for You hint on ConversationTopic. I started playing
with it, however, experienced a small problem using
Application.AdvancedSearch :
string filter = "[ConversationTopic] = '" + Item.ConversationTopic + "'" ;
try
{
StringBuilder SearchScope = new StringBuilder("'" +
Application.Session.GetDefaultFolder(Outlook.OlDef aultFolders.olFolderSentMail).FolderPath + "'");
SearchScope.Append(",'" +
Application.Session.GetDefaultFolder(Outlook.OlDef aultFolders.olFolderInbox).FolderPath + "'");
SearchScope.Append(",'" +
Application.Session.GetDefaultFolder(Outlook.OlDef aultFolders.olFolderDeletedItems).FolderPath + "'");
//exception is caught on line below - "The operation failed."
Outlook.Search SearchPotentialParents =
Application.AdvancedSearch(SearchScope.ToString(), filter, true,
ThisAddIn.AdvancedParentSearchTag);
}

Any idea why would it fail ? The error message is not really meaningful :-(

kind regards

marcin

"Sue Mosher [MVP-Outlook]" wrote:

What cache are you referring to? I can think of at least three different contexts in which "cache" would be relevant. Please start a new topic thread with more details.

"Marcin" wrote in message ...
Thanks a lot,Sue, will have a look at this immediatelly.

By the way - do you happen to have any references on Outlook caching and
cache access/manipulation from API ?

Kind regards

marcin

"Sue Mosher [MVP-Outlook]" wrote:

You might find the sample code at http://www.outlookcode.com/codedetail.aspx?id=1714 useful, as it shows how to use the value of the ConversationIndex property to locate the original item from which a reply or forward was created.

"Marcin" wrote in message ...

To make it short - when executing action like reply or forward on MailItem,
I need to access the original message.



  #9  
Old April 25th 08, 07:50 PM posted to microsoft.public.outlook.program_addins
Tim Pulley
external usenet poster
 
Posts: 10
Default Access to MailItem properties before opening new inspector ?

Marcin,

As an alternative to searching you could hook the Item's Forward, Reply and
Reply All events. By hooking these events you can take control of creation
of the forward/reply message and can copy data from the original message to
the new message. This approach requires a little more coding because you'll
need to process the Explorer's Selection event. Since users can run multiple
instances of Outlook, you'll also need to keep track of which items you've
already hooked. If you don't, you'll end up with multiple calls to your
event handler.


"Sue Mosher [MVP-Outlook]" wrote in message
...
You're using the Find/Restrict format for the search filter string, but
AdvancedSearch requires the DASL syntax; see
http://www.outlookcode.com/news.aspx?id=30.

Also, if you're searching only default folders, I don't think you need the
full path in the scope string, so a string like this should work:

"'Sent Items','Inbox', 'Deleted Items'"

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Marcin" wrote in message
...
There must be some kind of caching, I don't exactly know what kind of, but
in
fact, I would like to prevent caching at all :-), or get possibility of
reading items from cache before they are displayed in inspectors or
explorers.

Anyway, thanks a lot for You hint on ConversationTopic. I started playing
with it, however, experienced a small problem using
Application.AdvancedSearch :
string filter = "[ConversationTopic] = '" + Item.ConversationTopic + "'" ;
try
{
StringBuilder SearchScope = new StringBuilder("'" +
Application.Session.GetDefaultFolder(Outlook.OlDef aultFolders.olFolderSentMail).FolderPath
+ "'");
SearchScope.Append(",'" +
Application.Session.GetDefaultFolder(Outlook.OlDef aultFolders.olFolderInbox).FolderPath
+ "'");
SearchScope.Append(",'" +
Application.Session.GetDefaultFolder(Outlook.OlDef aultFolders.olFolderDeletedItems).FolderPath
+ "'");
//exception is caught on line below - "The operation failed."
Outlook.Search SearchPotentialParents =
Application.AdvancedSearch(SearchScope.ToString(), filter, true,
ThisAddIn.AdvancedParentSearchTag);
}

Any idea why would it fail ? The error message is not really meaningful
:-(

kind regards

marcin

"Sue Mosher [MVP-Outlook]" wrote:

What cache are you referring to? I can think of at least three different
contexts in which "cache" would be relevant. Please start a new topic
thread with more details.

"Marcin" wrote in message
...
Thanks a lot,Sue, will have a look at this immediatelly.

By the way - do you happen to have any references on Outlook caching
and
cache access/manipulation from API ?

Kind regards

marcin

"Sue Mosher [MVP-Outlook]" wrote:

You might find the sample code at
http://www.outlookcode.com/codedetail.aspx?id=1714 useful, as it shows
how to use the value of the ConversationIndex property to locate the
original item from which a reply or forward was created.

"Marcin" wrote in message
...

To make it short - when executing action like reply or forward on
MailItem,
I need to access the original message.





 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to execute an external program instead of openning the form when opening an inspector Lucas Campos[_2_] Outlook - Using Forms 1 August 13th 07 10:42 PM
MailItem UserProperties in OWA (Outlook Web Access) [email protected] Outlook and VBA 5 April 23rd 07 11:18 AM
event handler for changes to TO CC and BCC properties of mailitem epsilon_9 Outlook and VBA 3 January 15th 07 03:14 PM
Help with 'MailItem' object of WordMail Inspector [email protected] Add-ins for Outlook 2 May 18th 06 07:28 PM
dialog comes up when trying to access mailItem Neo Add-ins for Outlook 3 January 16th 06 09:56 PM


All times are GMT +1. The time now is 01:00 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2024 Outlook Banter.
The comments are property of their posters.