Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Importing Outlook Address Book Groups
Message
From
17/05/2005 17:05:11
 
 
To
17/05/2005 14:31:47
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01015018
Message ID:
01015097
Views:
23
This message has been marked as the solution to the initial question of the thread.
>I am using the following code (taken from John Koziol's ROC program) to import addresses into a foxpro table:
>
>
>oOlApp = CreateObject("Outlook.Application")		&& Open Outlook
>oOlNS  = oOlApp.GetNameSpace("MAPI")			   && Set name space
>oOlC   = oOlNS.GetDefaultFolder(10)					&& 10 = Default contacts folder
>SELECT vfpcontacts
>FOR i = 1 TO oOlC.Items.Count		
>  WAIT WIND "Record # "+ALLT(STR(i))+" of "+ALLT(STR(oOlC.Items.Count)) NOWAIT
>  INSERT INTO vfpcontacts (lastname,firstname,fullname,company,email1addr,email1disp,;
>                           email2addr,email2disp,email3addr,email3disp,nickname) ;
>                           VALUES ;
>                          (oOlC.Items(i).LastName,;
>                           oOlC.Items(i).FirstName,;
>                           oOlC.Items(i).FullName,;
>                           oOlC.Items(i).CompanyName,;
>                           oOlC.Items(i).Email1Address,;
>                           oOlC.Items(i).Email1DisplayName,;
>                           oOlC.Items(i).Email2Address,;
>                           oOlC.Items(i).Email2DisplayName,;
>                           oOlc.Items(i).Email3Address,;
>                           oOlC.Items(i).Email3DisplayName,;
>                           oOlC.Items(i).NickName)
>
>ENDFOR
>
>
>This works fine until it reaches a group list in my address book. At which point it returns and error. I can ignore the error and it will continue until it reaches the next group.
>
>1. Is there a way to import the group into a foxpro table? If so, suggestions would be appreciated.
>
>2. If not, how can I determine that the address book entry is a group and ignore it?
>
>Thanks in advance for your help!


Hi Russel,

Try this:
#Define  olDistributionList  69

If (oOlC.Items(i).Class == olDistributionList)
   For nX = 1 to oOlc.Items(i).MemberCount
      oMemberList = oOlc.Items(i).GetMember( nX )
      ? oMemberList.Name, oMemberList.Address
   Next nX
else
   *** Usual Contact Item
endif
HTH
Herman
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform