Determining if a mailitem has been forwarded

B

BrassicaNigra

Greetings,

I have written an add-in for Outlook 2007 which adds some functionality to
the ribbon when the user is viewing an email.

I want to enhance this functionality and I need to know if the email in the
Inspector has been forwarded or if it was directly received from the sender.
How can I tell if a MailItem has been forwarded?

TIA,

Dale Hoffman
 
J

\Ji Zhou [MSFT]\

Hello Dale,

Thanks for using Microsoft Newsgroup Support Service, my name is Ji Zhou
[MSFT] and I will be working on this issue with you.

Firstly, I want to ensure I understand our objective correctly. We are
trying to identify if an email is forwarded or written and sent directly
from the sender, right? If I have misunderstood, please feel free to let me
know.

Based on my research, I do not find a consolidated way to achieve this
objective. There is a tool Outlook Spy that can be used to view a mail
item's all object model properties, as well as all the property tag values.
I use it to look through a forwarded mail item from bottom to top on my
side, but nothing contained in the mail item tells the exact information we
want to know. Consequently, I think this may be not possible. I have also
consulted the product team to confirm this. If I get their reply, I will
let you know as soon as possible.

However, may I suggest to judge if the property tag PR_SUBJECT_PREFIX's
value is "FW: " and then perform the corresponding action in our Outlook
Add-in. The code will look like. We can get more information about the
PropertyAccessor and the property tag list from the following two links,
http://msdn.microsoft.com/en-us/library/bb176395.aspx
http://msdn.microsoft.com/en-us/library/ms526356(EXCHG.10).aspx

private void button1_Click(object sender, RibbonControlEventArgs e)
{
Outlook.MailItem mail =
Globals.ThisAddIn.Application.ActiveInspector().CurrentItem as
Outlook.MailItem;
object subjectPrefix =
mail.PropertyAccessor.GetProperty(@"http://schemas.microsoft.com/mapi/propta
g/0x003D001E");
if (subjectPrefix.ToString() == "FW: ")
{
Debug.Print("This email is forwarded and the default subject prefix
is not modified");
}
else
{
Debug.Print("This email may be not forwarded");
}
}

I mention this way because outlook will use the default prefix "FW: " when
a user tries to forward a mail to others. This is not a very good
workaround since it cannot catch the emails whose whole subjects are
modified by the senders. But hope it will help more or less.

If you have any future concerns or questions, please feel free to update
this thread, and I will try my best to follow up. Have a great weekend!


Best regards,
Ji Zhou ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
K

Ken Slovak - [MVP - Outlook]

That's about the only way, to examine the subject, but of course that's
language dependent as to the "FWD". The original message on the sender's
side would have a flag set in PR_LAST_VERB_EXECUTED (0x10810003) for
EXCHIVERB_FORWARD (104), but there's not other indicator on the receiving
end than looking at subject.




""Ji Zhou [MSFT]"" said:
Hello Dale,

Thanks for using Microsoft Newsgroup Support Service, my name is Ji Zhou
[MSFT] and I will be working on this issue with you.

Firstly, I want to ensure I understand our objective correctly. We are
trying to identify if an email is forwarded or written and sent directly
from the sender, right? If I have misunderstood, please feel free to let
me
know.

Based on my research, I do not find a consolidated way to achieve this
objective. There is a tool Outlook Spy that can be used to view a mail
item's all object model properties, as well as all the property tag
values.
I use it to look through a forwarded mail item from bottom to top on my
side, but nothing contained in the mail item tells the exact information
we
want to know. Consequently, I think this may be not possible. I have also
consulted the product team to confirm this. If I get their reply, I will
let you know as soon as possible.

However, may I suggest to judge if the property tag PR_SUBJECT_PREFIX's
value is "FW: " and then perform the corresponding action in our Outlook
Add-in. The code will look like. We can get more information about the
PropertyAccessor and the property tag list from the following two links,
http://msdn.microsoft.com/en-us/library/bb176395.aspx
http://msdn.microsoft.com/en-us/library/ms526356(EXCHG.10).aspx

private void button1_Click(object sender, RibbonControlEventArgs e)
{
Outlook.MailItem mail =
Globals.ThisAddIn.Application.ActiveInspector().CurrentItem as
Outlook.MailItem;
object subjectPrefix =
mail.PropertyAccessor.GetProperty(@"http://schemas.microsoft.com/mapi/propta
g/0x003D001E");
if (subjectPrefix.ToString() == "FW: ")
{
Debug.Print("This email is forwarded and the default subject prefix
is not modified");
}
else
{
Debug.Print("This email may be not forwarded");
}
}

I mention this way because outlook will use the default prefix "FW: " when
a user tries to forward a mail to others. This is not a very good
workaround since it cannot catch the emails whose whole subjects are
modified by the senders. But hope it will help more or less.

If you have any future concerns or questions, please feel free to update
this thread, and I will try my best to follow up. Have a great weekend!


Best regards,
Ji Zhou ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top