Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / March 2008

Tip: Looking for answers? Try searching our database.

get value from contacts folder

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pippo - 13 Mar 2008 16:04 GMT
hy

this is a simple code to send mail ....

Sub InviaEmail()
      Dim AppOut As Outlook.Application
      Set AppOut = New Outlook.Application
      Set NewMail = AppOut.CreateItem(olMailItem)

      NewMail.To = someone@some.it
      NewMail.CC = someone@some.it
      NewMail.BCC = someone@some.it

      NewMail.Subject = "blabla"
      NewMail.Body = " blabla"
      NewMail.Attachments.Add "C:\myfile.txt"
'       NewMail.Send
      NewMail.Display
End Sub

...but i need to get the "NewMail.To" value directly from my contacts
folder. ( i've a group list named "clientii" with 100/120 members that
sometimes can change  and it would be a very boring job to write all the
names to hand or to cancel them and rewrite when they change)

tanks
Dmitry Streblechenko - 13 Mar 2008 18:30 GMT
Read the ContactItem.Email1Address property from the contact.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool

> hy
>
[quoted text clipped - 22 lines]
>
> tanks
Pippo - 17 Mar 2008 13:06 GMT
> Read the ContactItem.Email1Address property from the contact.

..
hy
i've done it

http://msdn2.microsoft.com/en-us/library/bb220057.aspx
"Returns or sets a String representing the e-mail address of the first
e-mail entry for the contact."

...but i don't know how to use it in my code...

NewMail.To = someone@some.it
NewMail.CC = someone@some.it
NewMail.BCC = someone@some.it

i would be able to write in "NewMail.To=" directly the distribution list
name stored in my contacts folder (NewMail.To="Clienti" or
NewMail.to="query" and not "cliente1@dom.it; cliente2@dom.it;
cliente3@dom.it; ecc ecc"

i don't need to change the DL

...manually from outlook adress book interface i can add and remove members
from the distribution list as i need

tanks
Dmitry Streblechenko - 17 Mar 2008 18:12 GMT
If the DL comes from one of the contacts folders that are used by the
automatic name resolution (such as the default Contacts folder), you can
just set the MailItem.To property to the name DL. The DL name will be
resolved when you call MailItem.Recipients.ResolveAll or when teh mesage is
sent.
Otherwise you can either set the To property to a ";" separated list of DL
member addresses (loop through the DistListItem.Members collection) or call
MailItem.Recipients.Add for each DL member address.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool

>> Read the ContactItem.Email1Address property from the contact.
>>
[quoted text clipped - 23 lines]
>
> tanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.