![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hi
As experienced VBA-programmer in ms-access I try to do something in outlook but do not exactly know the right approach. Situation: outlook 2003 and exchange and ms-access Objectives: 1) create structure public folders as windows folders ( done = OK) 2) get mail content in ms-access tables (linked tables to exchange/ mapilevel) (done=OK) 3) save attachments as in created windows folders ( done=OK) 4) save items as *.MSG (?? works only certain mails, reason unknown ???) From within ms-access I enumerate recursive folders in folders. The following code is from line XX in a recursive folders in folders enumeration: ? 1 : what is the difference between olMailItem and olPostItem (Said before access programmer, not outlook ? 2 : why can't i set MyOutlookMailItem = objMapiSubFolder.Items(i) but do I have to use MyUndefindeObject = objMapiSubFolder.Items(i) Advice is appreciated (please don't bother for the dutch name in the code: THANKS Peter van den Hooff '---------------------------------------------------------------------------------------------------------------------------- onwards line XX in ap_FoldersInFolder objMapiSubFolder ---- ---- ---- ap_LogFolderStructuur nivo, prepad, objMapiSubFolder.Name, objMapiSubFolder.DefaultItemType prepad = prepad & "\" & objMapiSubFolder.Name '-- mkdir to save attachments ap_maakpad prepad, "C:\" If objMapiSubFolder.DefaultItemType = 6 And volgnr0 = 1 (MAPIlevel0 public folders) Then i = objMapiSubFolder.Items.Count If i 0 Then Teller = Teller + 1 For i = 1 To objMapiSubFolder.Items.Count '-- objItem = object, '-- objItem = OUTLOOK.MAILITEM does not work Set objItem = objMapiSubFolder.Items(i) sGUID = objItem.EntryID j = objItem.Attachments.Count If j 0 Then For j = 1 To objItem.Attachments.Count Set myAttachment = objItem.Attachments.Item(j) Set o = myAttachment.Parent If o.Class = olMail Then Set myMailItem = o On Error GoTo FoutBijSaveAs '-- WORKS ONLY FOR ABOU 20% OF THE MAILS ????????????????????????? myMailItem.SaveAs "c:\" & prepad & "\" & DatumTijdMail & "_" & myMailItem.SenderEmailAddress & ".msg", olMSG On Error GoTo Foutafhandeling Set myMailItem = Nothing End If myAttachment.SaveAsFile "c:\" & prepad & "\" & myAttachment.FileName sSQL = "INSERT INTO tbl_attachments " & _ "([EntryID],[folder],[file], [datumtijdmail]) " & _ " values (""" & sGUID & """,""" & prepad & """,""" & myAttachment.FileName & """,""" & DatumTijdMail & """)" CurrentDb.Execute sSQL SysCmd acSysCmdSetStatus, "c:\" & prepad & "\" & myAttachment.FileName Next j End If Next i End If End If ap_FoldersInFolder objMapiSubFolder Next objMapiSubFolder |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
OL2k3 Automatically Adding Public Folders to 'Favorite Folders' list in Mail | Ben | Outlook - General Queries | 0 | October 4th 06 04:19 PM |
How do I configure Public Folders to be default contact folders? | RobinBaral | Outlook - Using Contacts | 2 | September 27th 06 04:12 PM |
Is there a way to display Public Folders in the All Mail Folders view? Outlook2003 | Cappy | Outlook - General Queries | 1 | July 20th 06 02:20 AM |
Is there a way to display Public Folders in the All Mail Folders view? Outlook2003 | Cappy | Outlook - Installation | 1 | July 20th 06 02:20 AM |
Problems with Public Calendar | CalendarGirl | Outlook - Calandaring | 0 | March 7th 06 12:51 AM |