K
Krishna
Outlook 2003, Custom forms, C#.
I have a custom message form, published into Personal Outlook Folders.
I want to use the form whenever I open an email. The message remains in
Inbox and I don't have any custom folder for which my custom form is
the default form. In the mail-item-open event handler, I am setting the
mesasgeclass to my custom form class. But, I get the default form only.
OutlookSpy shows the mesasgeclass is IPM.Note. If I change the filed
manually in OutlookSpy and save the changes, close outlook and re-open,
I get the custom form.
I tried accessing PR_MESSAGE_CLASS in C# using CDO, but I am unable to
do so. Is there any documentation for C# version of CDO1.21.
I cannot save the mail-item because I want to use the custom-form only
to display the message and when user closes the form, I need to store
the message with default form and original message-body. (In the
mail-item-open event handler, I change the message-body
programmatically.)
My code snippet is as follows:
private void myMailItem_Open(ref bool Cancel)
{
if (myMailItem.SenderEmailAddress != null)
{
myMailItem.MessageClass = "IPM.Note.MyNewMailForm";
myMailItem.HTMLBody = " this should be a custom form.";
}
.....
}
my other approach:
private void myMailItem_Open(ref bool Cancel)
{
if (myMailItem.SenderEmailAddress != null)
{
// trying to access PR_MESSAGE_CLASS.
CDO.SessionClass newSession = new CDO.SessionClass();
newSession.MAPIOBJECT =
MailItem.Application.Session.MAPIOBJECT;
CDO.Message newMsg =
CDO.Message)newSession.GetMessage(myMailItem.EntryID, myMissing);
CDO.Fields oFields = (CDO.Fields)newMsg.Fields;
int idx = 0;
oFields.get_Item(idx,
CDO.CdoPropTags.CdoPR_MESSAGE_CLASS);
}
....
}
For me, the GetMesage(..) itself is failing. Also, I could not find the
docuementation for C#, CDO1.21. I coudldn't figure out the first
argument, 'object index' for Fileds.get_Item(..).
Any suggestion/help would be of great help.
Thanks,
Krishna.
I have a custom message form, published into Personal Outlook Folders.
I want to use the form whenever I open an email. The message remains in
Inbox and I don't have any custom folder for which my custom form is
the default form. In the mail-item-open event handler, I am setting the
mesasgeclass to my custom form class. But, I get the default form only.
OutlookSpy shows the mesasgeclass is IPM.Note. If I change the filed
manually in OutlookSpy and save the changes, close outlook and re-open,
I get the custom form.
I tried accessing PR_MESSAGE_CLASS in C# using CDO, but I am unable to
do so. Is there any documentation for C# version of CDO1.21.
I cannot save the mail-item because I want to use the custom-form only
to display the message and when user closes the form, I need to store
the message with default form and original message-body. (In the
mail-item-open event handler, I change the message-body
programmatically.)
My code snippet is as follows:
private void myMailItem_Open(ref bool Cancel)
{
if (myMailItem.SenderEmailAddress != null)
{
myMailItem.MessageClass = "IPM.Note.MyNewMailForm";
myMailItem.HTMLBody = " this should be a custom form.";
}
.....
}
my other approach:
private void myMailItem_Open(ref bool Cancel)
{
if (myMailItem.SenderEmailAddress != null)
{
// trying to access PR_MESSAGE_CLASS.
CDO.SessionClass newSession = new CDO.SessionClass();
newSession.MAPIOBJECT =
MailItem.Application.Session.MAPIOBJECT;
CDO.Message newMsg =
CDO.Message)newSession.GetMessage(myMailItem.EntryID, myMissing);
CDO.Fields oFields = (CDO.Fields)newMsg.Fields;
int idx = 0;
oFields.get_Item(idx,
CDO.CdoPropTags.CdoPR_MESSAGE_CLASS);
}
....
}
For me, the GetMesage(..) itself is failing. Also, I could not find the
docuementation for C#, CDO1.21. I coudldn't figure out the first
argument, 'object index' for Fileds.get_Item(..).
Any suggestion/help would be of great help.
Thanks,
Krishna.