![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
Hi Ken,
Thank you very much for your reply with valuable suggestions. I am very sorry that I missed out on the version of Outlook which sue asked specifically. Actually I want my code to work in both Outlook 2003 as well as 2007 versions. Right now it is working only on version Outlook 2007 and not on Outlook 2003 I don't know why. It installs on Outlook 2003 correctly without any installation problem and shows in the plugin section of outlook 2003 also but never works. Regards, Aninda "Ken Slovak - [MVP - Outlook]" wrote: Sue's on vacation. I see a few flaws in your code. First of all, in an Outlook COM addin, never create a new Outlook.Application object. Always use the Application object passed to you in your startup code handler or in OnConnection. Second, that code will only look at contacts. If a recipient is from the GAL then you never will find anything. As Sue recommended it's really best to work with the Recipients collection and iterate that. You said that didn't work but didn't provide any information as to why. Each Recipient object has an Address property . That's what you should be using. When the Recipient is part of an Exchange domain you won't get back an SMTP style address, you'll get back an Exchange DN type address such as your example: /O=DOMAIN/OU=FIRST ADMINISTRATIVE GROUP/CN=RE/ou=abcd. In those cases you would need to convert the EX address into an SMTP equivalent. Since you never mention which version or versions of Outlook you are targeting it's hard to be specific as to how you would convert the address. Take a look at http://www.outlookcode.com/threads.a...essageid=13469 for some suggestions as to how to do that. Note that since you're using managed code (C#) the CDO option is not available to you, CDO is not supported and should not be used with managed code. You can also search at www.outlookcode.com using something like "convert exchange address to smtp" to look at other forum threads on that topic. -- 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 "anindasen_0609" wrote in message ... Thanks for your reply. I am sorry I could not reply earlier. 1) I think I created a confusion. I actually meant all the email fields ie., From, To, Cc and Bcc. Wherever there is a name for a particular email address in the local address book, I am getting the name instead of the email ID. My function to get email ID against the name is as below: private string GetEmailID(ref string recipientName) { string recipientEmailID = null; string myQuery = null; myQuery = "[FullName] = '" + recipientName + "'"; // Create the Outlook application. Outlook.Application oApp = new Outlook.Application(); // Get the NameSpace information. Outlook.NameSpace oNS = oApp.GetNamespace("mapi"); // Get the default Contacts folder. Outlook.MAPIFolder oContacts = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFo lderContacts); // Get the Items collection from the folder. Outlook.Items oItems = (Outlook.Items)oContacts.Items; // Get the first contact item in the Items collection. Outlook.ContactItem oCt = (Outlook.ContactItem)oItems.Find(myQuery); if (oCt != null) { if (oCt.Email1Address.IndexOf("@") != -1) recipientEmailID = oCt.Email1Address; else recipientEmailID = recipientName; } else { recipientEmailID = recipientName; } oCt = null; oItems = null; oContacts = null; oNS = null; oApp = null; return recipientEmailID; } and I am calling it only when if (emailAddress.IndexOf("@") = 0) { emailAddress = GetEmailID(ref emailAddress); } 2) I will definitely look at the resources that you have kindly shared and try NewMailEx. 3) There is one more problem which I am solving in a rather inelegant way. I am getting the sender's Email ID from Outlook in a form like: /O=DOMAIN/OU=FIRST ADMINISTRATIVE GROUP/CN=RE/ou=abcd if the email ID is - . We are using Active Directory Service and all that I am doing right now is taking out the email name and the domain by string manipulation and getting the email ID from the database against that. But I am looking for a more proper solution to this problem. Thanks. Aninda |
#2
|
|||
|
|||
![]()
Did you compile the code with a reference to the Outlook/Office 2003 PIA's?
If you did it with references to the Outlook/Office 2007 PIA's it would never work with Outlook 2003. You always have to compile on the oldest version of Outlook that you intend to support. If that's not it you're going to have to do some detective work. You should put strategically placed logging statements or MessageBox calls to show where you are in the code, or even if your code is actually loading and running. If the code isn't running then you need to do some Fusion debugging, Fusion is the managed code loader. See http://blogs.msdn.com/vsod/archive/2...-failures.aspx for information on how to do that. -- 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 "anindasen_0609" wrote in message ... Hi Ken, Thank you very much for your reply with valuable suggestions. I am very sorry that I missed out on the version of Outlook which sue asked specifically. Actually I want my code to work in both Outlook 2003 as well as 2007 versions. Right now it is working only on version Outlook 2007 and not on Outlook 2003 I don't know why. It installs on Outlook 2003 correctly without any installation problem and shows in the plugin section of outlook 2003 also but never works. Regards, Aninda |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
The Outlook Express Development Team/s | D. Spencer Hines | Outlook Express | 23 | May 18th 09 09:47 PM |
The Outlook Express Development Team/s | D. Spencer Hines | Outlook Express | 0 | February 2nd 09 04:49 AM |
VS Development environment - Outlook addin | gattsi | Add-ins for Outlook | 1 | January 25th 08 03:21 PM |
Best Outlook Add-In development companies? | Mark B | Add-ins for Outlook | 5 | June 21st 07 12:06 PM |
Outlook Web Access Development | AaronTJ | Outlook - General Queries | 1 | February 16th 06 02:25 AM |