General information
Category:
COM/DCOM and OLE Automation
>>I have a custom folder in Outlook Contact Folder and need to add contacts from
>>this custom folder to a distribution lists through vfp 6.0...
>>A problem I have ran into is that Outlook can not see any contacts in this
>>custom folder. Any ideas? Eric
>
>Can you show your code on where and how you reference the Custom Folder under Contacts?
oOL = CREATEOBJECT("Outlook.Application")
if isnull(oOl) or vartype(oOL) <> 'O'
messagebox('Unable to open Outlook, goodbye!', 16, 'Add Outlook Distribution list')
clear all
return
endif
oNameSpace = oOl.GetNameSpace("MAPI")
oContacts = oNamespace.GetDefaultFolder(10)
loContact = oContacts.folders.Add("New Dist Lists")
mytemp = locontact.Items.Add(0) && mail item
myDist = loContact.Items.Add(7) && distribution list item
myDist.DLName = "New Sub List"
myRecipients = myTemp.Recipients
SELE USERS
scan
myRecipients.Add(allt(userid))
endscan
myDist.AddMembers(myRecipients)
mydist.save
* create entire new list
mytemp = loContact.Items.Add(0) && mail item
myDist = loContact.Items.Add(7) && distribution list item
myDist.DLName = "New Main List"
myRecipients = myTemp.Recipients
myRecipients.Add("New Sub List")
myDist.AddMembers(myRecipients)
mydist.save
My "New Sub List" is created fine, but the "New Main List" contains nothing.
If I run this code and do not use the folder to save the distribution lists
everything works fine.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only