Which way should I add an AddressEntry?
by Shelby » Tue, 15 Jun 2004 14:14:53 GMT
Hi,
how do I add a ContactItem to a specific AddressList?
I have populate a ListBox with user's Address Book.
User will select the specific Address Book and an AddressEntry will be added
into that AddressList.
So do I add the entry like this:
AddressList = oNs.AddressLists.Item(UserSelectedIndex)
myentry = AddressList.AddressEntries.Add("SMTP", "testtest",
" XXXX@XXXXX.COM ")
myentry.Update()
(If I add it this way, I do not have access to other properties such as
CompanyName, Birthday etc etc)
Or like this:
sCtact = oApp.CreateItem(Outlook.OlItemType.olContactItem)
sCtact.FullName = "Test 123"
sCtact.CompanyName = "His Company Name"
sCtact.Birthday= "His birthday"
sCtact.Email1Address = XXXX@XXXXX.COM
sCtact.Close(Outlook.OlInspectorClose.olSave)
(If I add it this way, it will not be added to user's specified address
book)
Thanks.
Re: Which way should I add an AddressEntry?
by Ken Slovak - [MVP - Outlook] » Tue, 15 Jun 2004 22:02:47 GMT
The second way adds it to the default Contacts folder. Either use the Add
method of the Items collection of the folder you want or create it in the
default Contacts folder and use the Move function to move it to the folder
you want after creating it.
--
Ken Slovak
[MVP - Outlook]
http://www.**--****.com/
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.**--****.com/
added
Re: Which way should I add an AddressEntry?
by Shelby » Wed, 16 Jun 2004 11:28:30 GMT
Hi,
yes I notice that the second method adds to the default Contacts folder.
So if I use the second method, I need to parse the folder path to the Move
method.
The question is, how can I get the folder path with the"AddressList Index"?
Because I have populated a list box with the AddressList Name and Index.
When user select the specific AddressList, it will be added to that
AddressList.
Thanks
Shelby
Re: Which way should I add an AddressEntry?
by Ken Slovak - [MVP - Outlook] » Wed, 16 Jun 2004 22:32:54 GMT
The Index property of an AddressList just gives you the current number of
that list in the AddressLists collection. That is not necessarily a
persistent value and can even change during an Outlook session if additional
AddressList's are added to that collection. So I would not depend on that
value for anything.
AFAIK there is no direct way to correlate an AddressList with a specific
Contacts folder other than brute force. I would iterate recursively all the
folders below Inbox.Parent for folders and subfolders that are Contacts
folders and store that information along with the folder paths and then try
to match up the names of the folders with the AddressList name. There may be
better ways but I'm not aware of them.
--
Ken Slovak
[MVP - Outlook]
http://www.**--****.com/
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.**--****.com/
Index"?
Similar Threads:
1.Adding new entries to AddressList.AddressEntries...
Hi again,
i have a form with a list displaying addresses that i read via OOM,
"NameSpace.AddressLists(x)". Works well so far. I now want to add a
new address entry to one of the AddressLists. I've learned that it's
not possible via "AdressList.AddressEntries.Add", so i've tried to get
a pointer to the underlying contacts folder via
NameSpace.GetFolderFromID(AddressList.ID)
or
NameSpace.GetItemFromID(AddressEntry.ID).Parent
This will fail 'cause the "ID" is no "EntryID" or "StoreID".
"AddressList.Parent" points to "AddressLists" instead to the folder
from which the entries are selected and thus also isn't of much help.
Question is now: How do i get a pointer to the appropiated contacts
folder to add a new entry directly? Or do i have to dig deeper into
CDO for a solution? Thanks for any hint...
--
So long...
...Bomi
> !!! EMail??? Please use Reply-To address and remove underscores (_) !!!
2.AddressEntries Not Working for Server-Side Script
I have an Agent Server-Side Script running to process new messages arriving
in a Public Folder. This includes accessing the Members for a Recipient that
is a Distribution Group located in the Global Address List.
This portion of code works just fine:
Set oAddrEntry = oRecip.AddressEntry
But this line fails with error MAPI_E_NO_SUPPORT:
Set oAddrEntries = oAddrEntry.Members
We weren't getting this error when we were using WinNT 4.0 Server and
Exchange 5.5. But we're now planning a switch to Windows 2000 Server
5.00.2195 SP2 and Exchange 2000 Ver 6 Build 5762.4 SP2 and the error occurs
on our test setup.
I believe that I've got the permissions set correctly. We've got the Event
Service running under the Administrator account, and the Administrator
permissions on the container that holds the Distribution Groups looks okay.
I'd appreciate any suggestions.
Thanks.
3.Address Book/Global Address List & Visual Basic 6 Part II (AddressEntry)
4.ContactItem from AddressEntry
Hi,
How do I get a ContactItem from an AddressEntry object? Its good to see that
Outlook 2007 has AddressEntry.GetContact() and AddressEntry.GetExchangeUser()
methods but how do I do this in Outlook 2003 (Outlook11)? I've tried:
Outlook.ContactItem contactItem =
addressEntry.Session.GetItemFromID(addressEntry.ID,
System.Reflection.Missing.Value) as Outlook.ContactItem;
and
Outlook.ContactItem contactItem =
addressEntry.Session.GetItemFromID(addressEntry.Address,
System.Reflection.Missing.Value) as Outlook.ContactItem;
But both fail with a "Cannot open item. Try again." error.
What I really want to do is access information such as OfficeLocation,
Company, etc. that is displayed when I call the AddressEntry.Details() method.
5.Error: AddressEntry.Members
Hi,
i get an runtime error [-1975500798 (8a404002)] if i use the Members
property of
an AddressEntry object of type olPrivateDistList (Outlook 2000, VB6 Addin).
Anyone know this problem?
Thanx in advance
Michael
6. getting the AddressEntry object to update for a Personal Address Book
7. Cdo Contacts and AddressEntry.Details
8. How to find that AddressEntry belongs to which AddressList using CDO