![]() |
| 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. |
|
|||||||
| Tags: 2003, folders, offline, outlook, programmatically, setting, use |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
I'm trying get all the folders and subfolders for a Mailbox and Public
Folders / Favorites to be programmatically set for offline use in Outlook 2003. Below is code that works for traversing the folder trees and setting the inappfoldersyncobject property. The problem is that the inappfoldersyncobject property works for subfolders of the users mailbox folder tree, but not for the subfolders of a Public Folders / Favorites / Folders. Only the first level folders can be set or cleared. There seems to be no information on this subject, and I'm wondering if anyone has run into this problem. Is this a bug, or registry setting in Outlook 2003? Option Explicit '------------------------------------------------------------------------------------------------------------ Sub SetTreeOffline() Dim nsMAPI As NameSpace Dim soAppFldr As SyncObject Dim fTopFldr As MAPIFolder Set nsMAPI = Application.GetNamespace("MAPI") Set soAppFldr = nsMAPI.SyncObjects.appfolders '- Set the entire Mailbox and subfolders offline Set fTopFldr = nsMAPI.GetDefaultFolder(olFolderInbox) Set fTopFldr = fTopFldr.Parent SetFolderOffline fTopFldr '- Set the entire Mailbox and subfolders offline Set fTopFldr = nsMAPI.Folders("Public Folders").Folders("Favorites") SetFolderOffline fTopFldr soAppFldr.Start End Sub '------------------------------------------------------------------------------------------------------------ Public Sub SetFolderOffline(fldr As MAPIFolder) Dim i As Integer '- Set the current folder offline fldr.InAppFolderSyncObject = True Debug.Print fldr.Name & " set to offline" '- If there are subfolders, recursively call the routine If fldr.Folders.Count 0 Then For i = 1 To fldr.Folders.Count SetFolderOffline fldr.Folders(i) Next End If End Sub '------------------------------------------------------------------------------------------------------------ -- Joseph Awe Technology Management Group |
| Ads |
|
#2
|
|||
|
|||
|
So, what happens when the code tries to iterate the PFFavs collection?
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Joseph Awe" wrote in message ... I'm trying get all the folders and subfolders for a Mailbox and Public Folders / Favorites to be programmatically set for offline use in Outlook 2003. Below is code that works for traversing the folder trees and setting the inappfoldersyncobject property. The problem is that the inappfoldersyncobject property works for subfolders of the users mailbox folder tree, but not for the subfolders of a Public Folders / Favorites / Folders. Only the first level folders can be set or cleared. There seems to be no information on this subject, and I'm wondering if anyone has run into this problem. Is this a bug, or registry setting in Outlook 2003? Option Explicit '------------------------------------------------------------------------------------------------------------ Sub SetTreeOffline() Dim nsMAPI As NameSpace Dim soAppFldr As SyncObject Dim fTopFldr As MAPIFolder Set nsMAPI = Application.GetNamespace("MAPI") Set soAppFldr = nsMAPI.SyncObjects.appfolders '- Set the entire Mailbox and subfolders offline Set fTopFldr = nsMAPI.GetDefaultFolder(olFolderInbox) Set fTopFldr = fTopFldr.Parent SetFolderOffline fTopFldr '- Set the entire Mailbox and subfolders offline Set fTopFldr = nsMAPI.Folders("Public Folders").Folders("Favorites") SetFolderOffline fTopFldr soAppFldr.Start End Sub '------------------------------------------------------------------------------------------------------------ Public Sub SetFolderOffline(fldr As MAPIFolder) Dim i As Integer '- Set the current folder offline fldr.InAppFolderSyncObject = True Debug.Print fldr.Name & " set to offline" '- If there are subfolders, recursively call the routine If fldr.Folders.Count 0 Then For i = 1 To fldr.Folders.Count SetFolderOffline fldr.Folders(i) Next End If End Sub '------------------------------------------------------------------------------------------------------------ -- Joseph Awe Technology Management Group |
|
#3
|
|||
|
|||
|
Sue,
The comment over the PFF Tree should have read... '- Set the entire Public Folder \ Favorites tree offline - DOES NOT WORK! Set fTopFldr = nsMAPI.Folders("Public Folders").Folders("Favorites") SetFolderOffline fTopFldr When you do somthing direct like... Dim nsMAPI As NameSpace Dim soAppFldr As SyncObject Dim fldr As MAPIFolder Set nsMAPI = Application.GetNamespace("MAPI") Set soAppFldr = nsMAPI.SyncObjects.appfolders Set fldr = nsMAPI.Folders("Public Folders").Folders("Favorites").Folders("My Folder") fldr.InAppFolderSyncObject = True 'THIS WORKS Set fldr = nsMAPI.Folders("Public Folders").Folders("Favorites").Folders("My Folder").Folders("My Sbufolder") fldr.InAppFolderSyncObject = True 'THIS DOES NOT WORK I ended up paying MS IT Support to look it the problem. The engineer can reproduce the problem, but they have not gotten back to me with an answer. -- Joseph Awe Technology Management Group "Sue Mosher [MVP-Outlook]" wrote: So, what happens when the code tries to iterate the PFFavs collection? -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Joseph Awe" wrote in message ... I'm trying get all the folders and subfolders for a Mailbox and Public Folders / Favorites to be programmatically set for offline use in Outlook 2003. Below is code that works for traversing the folder trees and setting the inappfoldersyncobject property. The problem is that the inappfoldersyncobject property works for subfolders of the users mailbox folder tree, but not for the subfolders of a Public Folders / Favorites / Folders. Only the first level folders can be set or cleared. There seems to be no information on this subject, and I'm wondering if anyone has run into this problem. Is this a bug, or registry setting in Outlook 2003? Option Explicit '------------------------------------------------------------------------------------------------------------ Sub SetTreeOffline() Dim nsMAPI As NameSpace Dim soAppFldr As SyncObject Dim fTopFldr As MAPIFolder Set nsMAPI = Application.GetNamespace("MAPI") Set soAppFldr = nsMAPI.SyncObjects.appfolders '- Set the entire Mailbox and subfolders offline Set fTopFldr = nsMAPI.GetDefaultFolder(olFolderInbox) Set fTopFldr = fTopFldr.Parent SetFolderOffline fTopFldr '- Set the entire Mailbox and subfolders offline Set fTopFldr = nsMAPI.Folders("Public Folders").Folders("Favorites") SetFolderOffline fTopFldr soAppFldr.Start End Sub '------------------------------------------------------------------------------------------------------------ Public Sub SetFolderOffline(fldr As MAPIFolder) Dim i As Integer '- Set the current folder offline fldr.InAppFolderSyncObject = True Debug.Print fldr.Name & " set to offline" '- If there are subfolders, recursively call the routine If fldr.Folders.Count 0 Then For i = 1 To fldr.Folders.Count SetFolderOffline fldr.Folders(i) Next End If End Sub '------------------------------------------------------------------------------------------------------------ -- Joseph Awe Technology Management Group |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Offline Folders not Synchronising | SimonPerryman | Outlook - Installation | 1 | June 25th 06 08:05 PM |
| Programmatically changing settings in Outlook 2003 | Jonathan | Add-ins for Outlook | 1 | April 7th 06 08:49 PM |
| Microsoft Office Outlook Offline Folders startup error popping up | DAD | Outlook - Installation | 0 | March 14th 06 07:08 PM |
| Problem with Offline Folders | Sue Mosher [MVP-Outlook] | Outlook - Installation | 2 | January 25th 06 10:52 PM |
| Outlook 2003 Instance Won't Close If Opened Programmatically | Michael Bauer | Outlook and VBA | 3 | January 11th 06 04:19 PM |