M
morten_belsvik
Hello,
I have a custom form in Outlook 2000 which is started from a simple
addin written in C#. Before showing the form I want to add a
recipient. The problem is that the added recipient is not displayed in
the "To" field of the custom form. Here is the code:
Outlook._NameSpace olNS = applicationObject.GetNamespace("MAPI");
olNS.Logon("", "", false, false);
Outlook.MAPIFolder oInbox =
olNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
if (oInbox == null)
{
olNS = null;
return;
}
// Add new message using my custom form
Outlook.MailItem oMailItem =
(Outlook.MailItem)oInbox.Items.Add("IPM.Note.MyForm");
if (oMailItem != null)
{
// Use Redemption to avoid security warning when adding recipient
Redemption.SafeMailItem oSafeMailItem = new
Redemption.SafeMailItem();
if (oSafeMailItem != null)
{
oSafeMailItem.Item = oMailItem;
Redemption.SafeRecipient oSafeRecipient =
oSafeMailItem.Recipients.Add("(e-mail address removed)");
oSafeRecipient.Resolve(false);
oMailItem.Display(false);
oSafeMailItem = null;
}
oMailItem = null;
}
olNS.Logoff();
olNS = null;
When using Outlook Spy I can see that the recipient is added, but it
does not show up in the "To" field. If I do not use Redemption, the
recipient is shown, but then I get the security warning. Also if I use
the standard mail form (IPM.Note) instead of my own, it works fine with
Redemption. To ensure that there is nothing wrong with my custom form
I have created a form from the standard mail form and just published it
with the IPM.Note.MyForm classname.
Any ideas?
Thanks,
Morten
I have a custom form in Outlook 2000 which is started from a simple
addin written in C#. Before showing the form I want to add a
recipient. The problem is that the added recipient is not displayed in
the "To" field of the custom form. Here is the code:
Outlook._NameSpace olNS = applicationObject.GetNamespace("MAPI");
olNS.Logon("", "", false, false);
Outlook.MAPIFolder oInbox =
olNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
if (oInbox == null)
{
olNS = null;
return;
}
// Add new message using my custom form
Outlook.MailItem oMailItem =
(Outlook.MailItem)oInbox.Items.Add("IPM.Note.MyForm");
if (oMailItem != null)
{
// Use Redemption to avoid security warning when adding recipient
Redemption.SafeMailItem oSafeMailItem = new
Redemption.SafeMailItem();
if (oSafeMailItem != null)
{
oSafeMailItem.Item = oMailItem;
Redemption.SafeRecipient oSafeRecipient =
oSafeMailItem.Recipients.Add("(e-mail address removed)");
oSafeRecipient.Resolve(false);
oMailItem.Display(false);
oSafeMailItem = null;
}
oMailItem = null;
}
olNS.Logoff();
olNS = null;
When using Outlook Spy I can see that the recipient is added, but it
does not show up in the "To" field. If I do not use Redemption, the
recipient is shown, but then I get the security warning. Also if I use
the standard mail form (IPM.Note) instead of my own, it works fine with
Redemption. To ensure that there is nothing wrong with my custom form
I have created a form from the standard mail form and just published it
with the IPM.Note.MyForm classname.
Any ideas?
Thanks,
Morten