Re: How do I know whether a mail is replied/forwarded ?



Great, That's working. Thanks alot.
But I started getting one exception while reading "Undeliverable Mails(by
System Administrator) which are in my mailbox. The exception is "Specified
Cast is Invalid".
The code I have written is below :

for(int j=1; j<=folder.Items.Count; j++)
{
subjectItem = (Outlook.MailItemClass)(folder.Items[j]); //error
statement
}

but it is giving an exception mentioned above, while reading "Undeliverable
Mails".


More help is needed on how to handle such mails........


Thanks
Bhanu

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

That field isn't a default field. In other words it's not always there. If
an item in Inbox hasn't had any action taken on it that field won't be
there. After you send a reply, reply all or forward is when the field is
added.

With any code in CDO or RDO or MAPI you need to handle those cases. Where
the field doesn't exist clear the error and go on to the next item.

On Error Resume Next

For Each objmsg In cdoInbox.Messages
Set cdoField = objmsg.Fields(cdoPR_LAST_VERB_EXECUTED) 'error statement
If Err.Number <> 0 Then
Err.Clear
Else
MsgBox (cdoField.Value)
End If
Next

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Bhanu" <Bhanu@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C62EA317-FD0C-47ED-8546-9E07650A627B@xxxxxxxxxxxxxxxx
Thanks for your reply.

As per your reply, I tried to implement the same in VBA(not using C#.Net).
But, I got an error which is mentioned below.
"cdoPR_LAST_VERB_EXECUTED" is giving error.

Run-time error '-2147221233(8004010f)':
Collaboration Data Objects
[Collaboration Data Objects - [MAPI_E_NOT_FOUND(8004010F)]]

'Code I have implemented
Dim cdoInbox As MAPI.Folder
Dim cdoSession As MAPI.Session
Dim objmsg As MAPI.Message
Dim cdoField As MAPI.Field


Set cdoSession = CreateObject("MAPI.Session")
cdoSession.Logon "outlook", "", False, False
'cdoSession.Logon newSession:=False
Set cdoInbox = cdoSession.Inbox

For Each objmsg In cdoInbox.Messages
Set cdoField = objmsg.Fields(cdoPR_LAST_VERB_EXECUTED) 'error
statement
MsgBox (cdoField.Value)
Next

Do you have any idea as to what could be the reason ?

Thanks
Bhanu



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

The Outlook object model doesn't let you find that. You would need to use
a
different API such as CDO 1.21 or Extended MAPI or Redemption
(www.dimastr.com/redemption). Neither CDO or Extended MAPI can be used
from
..NET languages.

The property you would read would be PR_LAST_VERB_EXECUTED (0x10810003).

EXCHIVERB_REPLYTOSENDER = 102
EXCHIVERB_REPLYTOALL = 103
EXCHIVERB_FORWARD = 104

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Bhanu" <Bhanu@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:28765A50-9688-466E-93DD-B9BB5941A7C1@xxxxxxxxxxxxxxxx
Iam using C#.net for outlook programming.
I want to know whether a mail is replied/forwarded or not in my Inbox.
Are there any properties like replied/Isreplied/forwarded/Isforwarded
for a MailItem ??






.



Relevant Pages

  • whats up? reading xml
    ... I'm doing something wrong in the reading of this file. ... Dim doc As Xml.XmlDocument = New Xml.XmlDocument ... Dim writer As New Xml.XmlTextWriter ... Catch ex As Exception ...
    (microsoft.public.dotnet.languages.vb)
  • Re: DropDownList has SelectedValue which in invalid
    ... resulting in the invalid SelectedValue error. ... Dim ddl1 As DropDownList = CType, ... From your description you want to avoid getting the exception: ... Microsoft Online Support ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: How is it possible ...
    ... Dim myExportFile As String = CType, ... Catch ex As Exception ... 'Throw exc ... Private Sub Page_Init(ByVal sender As System.Object, ...
    (microsoft.public.dotnet.languages.vb)
  • Attempted to read or write protected memory (vb.Net 2005)
    ... When I excute the below code I get an exception. ... Dim lconn As New OleDb.OleDbConnection ... Dim lstrsql As String ...
    (microsoft.public.vsnet.general)
  • Object reference not set to an instance of an object.
    ... Object reference not set to an instance of an object. ... An unhandled exception occurred during the execution of the ... Dim myJobRequest As New skillsDB.jobRequest ... Session= "The skills database has been updated ...
    (microsoft.public.dotnet.general)