Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to access Outlook 98 Contacts in Public Folders
Message
From
28/06/2001 17:39:16
 
 
To
27/06/2001 21:19:45
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00524478
Message ID:
00524942
Views:
15
Dejan,

Here is a little snippet of code to get the Folder structure from outlook.

********************************************************************************
*--Program...........: OutLookFolders
*--Description.......: This Program Will Cycle Through Outlook and Produce a Cursor of the Available
*.....................: Folders and there Heirarchical Position.
*--Parameters........:
*--Author............: MATT LANDON
*--DevNotes1.........:
*--DevNotes2.........:
*--History...........:
*---6-28-2001-MPL-1.0.: Creation
********************************************************************************
CLOS ALL
CLEAR ALL
RELEASE ALL

*--6-28-2001-MPL: Create Outlook
loOutlook = CREATEOBJECT('Outlook.Application')
loNameSpace = loOutlook.GetNameSpace('MAPI')
CREATE CURSOR Outlookfolders( folderid c(10), folderlevel N(3),foldername c(50),parentfolder c(10))
*--6-28-2001-MPL: Start with the NameSpace and Get all SubFolders inside it.
GetSubFolders(loNameSpace,1,'Top Level')


FUNCTION GetSubFolders(toCurrentFolder,tnLevel,tcParentID)
PRIVATE toCurrentFolder,tnLevel,tcParentID,i,lctabvar
lctabvar = space(4*tnLevel)
FOR i = 1 TO toCurrentFolder.folders().COUNT
lcNextID = GetNextId('OutlookFolders')
INSERT INTO Outlookfolders VALUES (lcNextID,tnLevel,toCurrentFolder.folders(i).NAME,tcParentID)
?lctabvar + toCurrentFolder.folders(i).name
*--6-28-2001-MPL: Call the function recursively to get the subfolders for the current folder..
GetSubFolders(toCurrentFolder.folders(i),tnLevel+1,lcNextID)
ENDFOR
RETURN
ENDFUNC GetSubFolders

FUNCTION GetNextId(tcAlias)
SELECT MAX(VAL(folderid)) AS RecId FROM (tcAlias) INTO CURSOR Tada
PRIVATE lcNextID
lcNextID = PADL(ALLTRIM(STR(Tada.RecId + 1)),10,'0')
USE IN Tada
RETURN lcNextID
ENDFUNC GetNextId

********************************************************************************
After you have the appropriate folder try the following.

loContacts = loNameSpace.Folders('Folder1name').folders('folder2name')
for I = 1 to loContacts.items.count
?loContacts.items.item[i].FIRSTNAME + ' ' +;
loContacts.items.item[i].LASTNAME
ENDFOR
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform