Outlook profiles and MAPI folders

  • Thread starter Thread starter bawjaws
  • Start date Start date
B

bawjaws

Hi
I have a db with a table containing alist of mailboxes and folders.
What i'm trying to do is loop through the list and create linked table
to the folders. Ican create the first link but get "Runtime 3710: Mapi
folder or address book not found" message when i try to link to the
next mailbox.
Can any one please help??
Here's the code i'm using

Dim dbs As Database
Dim tdf As TableDef
Dim qy As QueryDef
Dim str As String, MAPIpath As String, prof As String, fold As String,
box As String
Dim rs As Recordset

Set dbs = CurrentDb
Set rs = CurrentDb.OpenRecordset("folders to link to")

With rs
Do While rs.EOF = False

MAPIpath = ![Path] 'folder path
fold = ![folder] 'folder name
box = ![mailbox]
str = "Exchange 4.0;MAPILEVEL=Mailbox - " & box & "" _
& "|" & MAPIpath & "\;TABLETYPE=0;" _
& "tablename=" & fold & ";" _
& "DATABASE=C:\DOCUME~1\KHO01\LOCALS~1\Temp\" & fold & ";"

Set tdf = dbs.CreateTableDef(fold)
tdf.Connect = str
tdf.SourceTableName = fold
dbs.TableDefs.Append tdf
RefreshDatabaseWindow

..MoveNext
Loop
End With

Thanks in advance
 
Back
Top