A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

DistList members are not resolved if the contact is not in default folder



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 5th 10, 11:42 PM posted to microsoft.public.outlook.program_addins
cbukeo
external usenet poster
 
Posts: 1
Default 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

Ads
  #2  
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



  #3  
Old April 12th 10, 11:16 PM posted to microsoft.public.outlook.program_addins
cbukeo via OfficeKB.com
external usenet poster
 
Posts: 4
Default 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

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Default Search Contact folder Mal Reeve Outlook - Calandaring 1 December 12th 06 02:12 AM
how to set some contact folder as default Johny Outlook - Using Forms 1 September 4th 06 12:54 AM
Change default Contact folder Holo20 Outlook - Using Contacts 4 August 1st 06 12:39 AM
How do i change default contact folder Darrin Outlook - Using Contacts 1 July 28th 06 08:49 PM
Contact list as default folder Orcas2369 Outlook - Using Contacts 3 April 14th 06 10:13 AM


All times are GMT +1. The time now is 06:27 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.