![]() |
DistList members are not resolved if the contact is not in default folder
Hello All,
I am developing an Outlook 2007 addin using VisualStudio 2008 and C#. My goal is to create a distList inside a contacts folder which is not the default contacts folder. When I say "default contacts folder" I refer to the one inside "Personal Folders". I successfully create the distribution list and add members to it. However I am not able to resolve the contact and as a result the member name shows same as the member e-mail address. When I investigate this using redemption I noticed that there is a high level "IAddrBook" button which brings up a list of the contacts inside default contacts folder. And then there is a "IMAPIFolder" button which brings up a dialog box with many tabs. One of these tabs is "GetContentsTable" which lists the contacts that are not resolved correctly. I believe I have spotted the problem but I could not figure out how I can tell outlook object model to resolve the distList members from the "IMAPIFolder". My code looks like this (a bit simplified): using Outlook = Microsoft.Office.Interop.Outlook; Outlook.Folder olFolder = olParentFolder.Folders.Add("AContactFolder", OlDefaultFolders.olFolderContacts); Outlook.DistListItem olDistList = olFolder.Items.Add(OlItemType. olDistributionListItem); Outlook.Recipient olRecipient = olFolder.Session.CreateRecipient(emailAddress) ; foreach(emailAddress in emailAddressList) { if(olRecipient.Resolve()) { olDistList.AddMember; } } Thanks in advance |
DistList members are not resolved if the contact is not in default folder
That folder must be used by OAB for the name resolution to work - set the
MAPIFolder.ShowAsOutlookAB property to true. -- Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool - "cbukeo" u59160@uwe wrote in message news:a618b6a00eac0@uwe... Hello All, I am developing an Outlook 2007 addin using VisualStudio 2008 and C#. My goal is to create a distList inside a contacts folder which is not the default contacts folder. When I say "default contacts folder" I refer to the one inside "Personal Folders". I successfully create the distribution list and add members to it. However I am not able to resolve the contact and as a result the member name shows same as the member e-mail address. When I investigate this using redemption I noticed that there is a high level "IAddrBook" button which brings up a list of the contacts inside default contacts folder. And then there is a "IMAPIFolder" button which brings up a dialog box with many tabs. One of these tabs is "GetContentsTable" which lists the contacts that are not resolved correctly. I believe I have spotted the problem but I could not figure out how I can tell outlook object model to resolve the distList members from the "IMAPIFolder". My code looks like this (a bit simplified): using Outlook = Microsoft.Office.Interop.Outlook; Outlook.Folder olFolder = olParentFolder.Folders.Add("AContactFolder", OlDefaultFolders.olFolderContacts); Outlook.DistListItem olDistList = olFolder.Items.Add(OlItemType. olDistributionListItem); Outlook.Recipient olRecipient = olFolder.Session.CreateRecipient(emailAddress) ; foreach(emailAddress in emailAddressList) { if(olRecipient.Resolve()) { olDistList.AddMember; } } Thanks in advance |
DistList members are not resolved if the contact is not in default folder
Thanks Dmitry,
Your suggestion and creating the distlist member with the name (instead of e- mail address) solved the problem! For the benefit of the community fix is: using Outlook = Microsoft.Office.Interop.Outlook; Outlook.Folder olFolder = olParentFolder.Folders.Add("AContactFolder", OlDefaultFolders.olFolderContacts); olFolder.ShowAsOutlookAB = true; Outlook.DistListItem olDistList = olFolder.Items.Add(OlItemType. olDistributionListItem); foreach(contactName in contactNameList) { Outlook.Recipient olRecipient = olFolder.Session.CreateRecipient (contactName); if(olRecipient.Resolve()) { olDistList.AddMember; } } -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...ddins/201004/1 |
All times are GMT +1. The time now is 05:07 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com