View Single Post
  #1  
Old April 7th 10, 06:36 AM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default 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



Ads