PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Setting Folder Aging Properties Prob

Reply

Setting Folder Aging Properties Prob

 
Thread Tools Rate Thread
Old 25-02-2005, 08:04 PM   #1
Lando
Guest
 
Posts: n/a
Default Setting Folder Aging Properties Prob


I am trying to set the default autoarchive settings for user created folders
within Outlook 2003 using the code below yet I keep getting the error Object
doesn't support this property or method on the line: objMessage.Add
"IPC.MS.Outlook.AgingProperties". Does anyone know what is wrong here? I
would also like to change it to be recursive in case of subfolders. Any
revised sample code would be appreciated.

Thanks,
Lando
------------------------------------------------

Sub Arc()

' MAPI property tags for aging properties
Const CdoPR_AGING_PERIOD = &H36EC0003
Const CdoPR_AGING_GRANULARITY = &H36EE0003
Const CdoPR_AGING_PATH = &H6856001E
Const CdoPR_AGING_ENABLED = &H6857000B
Const CdoPR_AUTOARCHIVE_TYPE = &H685E0003
Const CdoPR_AGING_AGE_FOLDER = &H6857000B
Const CdoPR_CONTAINER_CLASS = &H3613001E

' Properties for aging granularity
Const AG_MONTHS = 0
Const AG_WEEKS = 1
Const AG_DAYS = 2

' Declare variables
Dim objSession As MAPI.Session
Dim objInfoStore As Object
'Dim objInboxFolder As MAPI.Folder
'Dim colFolders As MAPI.Folders


' Initialize variables
Set objSession = Nothing
Set objInboxFolder = Nothing

' Create CDO session and logon
Set objSession = New MAPI.Session

' CDO session logon
objSession.Logon "", "", ShowDialog:=True, NewSession:=False

Set objInfoStore = objSession.InfoStores.Item(1)
Set objRootFolder = objInfoStore.RootFolder
Set colFolders = objRootFolder.Folders

Set objFolCalendar = objSession.GetDefaultFolder(CdoDefaultFolderCalendar)
Set objFolContacts = objSession.GetDefaultFolder(CdoDefaultFolderContacts)
Set objFolDeleted =
objSession.GetDefaultFolder(CdoDefaultFolderDeletedItems)
Set objFolJournal = objSession.GetDefaultFolder(CdoDefaultFolderJournal)
Set objFolNotes = objSession.GetDefaultFolder(CdoDefaultFolderNotes)
Set objFolSent = objSession.GetDefaultFolder(CdoDefaultFolderSentItems)
Set objFolTasks = objSession.GetDefaultFolder(CdoDefaultFolderTasks)
Set objFolInbox = objSession.GetDefaultFolder(CdoDefaultFolderInbox)
Set objFolOutbox = objSession.GetDefaultFolder(CdoDefaultFolderOutbox)


For Each objFolder In colFolders

' Get hidden message collection
Set objHiddenMessages = objFolder.HiddenMessages

' Loop through the hidden messages collection
For Each objMessage In objHiddenMessages


Select Case objFolder.ID
Case objFolInbox.ID
Case objFolOutbox.ID
Case objFolJournal.ID
Case objFolContacts.ID
Case objFolCalendar.ID
Case objFolDeleted.ID
Case objFolNotes.ID
Case objFolTasks.ID
Case objFolSent.ID
Case Else

If Not objMessage.Type = "IPC.MS.Outlook.AgingProperties" Then
objMessage.Add "IPC.MS.Outlook.AgingProperties"
End If

' Change the autoarchive mode (none,default,param)
objMessage.Fields.Item(CdoPR_AUTOARCHIVE_TYPE).Value = 0

' Change aging properties to 14 months/weeks/days
objMessage.Fields.Item(CdoPR_AGING_PERIOD).Value = 3

' Change aging granularity to days
objMessage.Fields.Item(CdoPR_AGING_GRANULARITY).Value = AG_MONTHS

' Change the path to the archive file
objMessage.Fields.Item(CdoPR_AGING_PATH).Value = "C:\Temp\archive.pst"

' Enable aging for this folder
objMessage.Fields.Item(CdoPR_AGING_ENABLED).Value = True

' Enable aging age for this folder
objMessage.Fields.Item(CdoPR_AGING_AGE_FOLDER).Value = True

' Update hidden message
objMessage.Update True, True

'End If
End Select
Next

Next
End Sub


  Reply With Quote
Old 26-02-2005, 07:55 AM   #2
Michael Bauer
Guest
 
Posts: n/a
Default Re: Setting Folder Aging Properties Prob

Hi Lando,

I never worked with HiddenMessages so far and can´t find the class in
the Objectbrowser. Is it the Messages class, too?

If so, not objMessage, but objMessages has the Add method, and you´d
need to re-design your code: You´d need to loop through the whole
collection for searching the specified type and add it only if there is
no match. Maybe the loop have not to be if you can use the Item method?

BTW: If this is the complete code why do you check the objFolder.ID in
each objMessage loop?

--
Viele Grüße
Michael Bauer


"Lando" <lando@noemails.com> wrote in message
news:#DOErU3GFHA.2704@tk2msftngp13.phx.gbl...
> I am trying to set the default autoarchive settings for user created

folders
> within Outlook 2003 using the code below yet I keep getting the error

Object
> doesn't support this property or method on the line: objMessage.Add
> "IPC.MS.Outlook.AgingProperties". Does anyone know what is wrong here?

I
> would also like to change it to be recursive in case of subfolders.

Any
> revised sample code would be appreciated.
>
> Thanks,
> Lando
> ------------------------------------------------
>
> Sub Arc()
>
> ' MAPI property tags for aging properties
> Const CdoPR_AGING_PERIOD = &H36EC0003
> Const CdoPR_AGING_GRANULARITY = &H36EE0003
> Const CdoPR_AGING_PATH = &H6856001E
> Const CdoPR_AGING_ENABLED = &H6857000B
> Const CdoPR_AUTOARCHIVE_TYPE = &H685E0003
> Const CdoPR_AGING_AGE_FOLDER = &H6857000B
> Const CdoPR_CONTAINER_CLASS = &H3613001E
>
> ' Properties for aging granularity
> Const AG_MONTHS = 0
> Const AG_WEEKS = 1
> Const AG_DAYS = 2
>
> ' Declare variables
> Dim objSession As MAPI.Session
> Dim objInfoStore As Object
> 'Dim objInboxFolder As MAPI.Folder
> 'Dim colFolders As MAPI.Folders
>
>
> ' Initialize variables
> Set objSession = Nothing
> Set objInboxFolder = Nothing
>
> ' Create CDO session and logon
> Set objSession = New MAPI.Session
>
> ' CDO session logon
> objSession.Logon "", "", ShowDialog:=True, NewSession:=False
>
> Set objInfoStore = objSession.InfoStores.Item(1)
> Set objRootFolder = objInfoStore.RootFolder
> Set colFolders = objRootFolder.Folders
>
> Set objFolCalendar =

objSession.GetDefaultFolder(CdoDefaultFolderCalendar)
> Set objFolContacts =

objSession.GetDefaultFolder(CdoDefaultFolderContacts)
> Set objFolDeleted =
> objSession.GetDefaultFolder(CdoDefaultFolderDeletedItems)
> Set objFolJournal =

objSession.GetDefaultFolder(CdoDefaultFolderJournal)
> Set objFolNotes = objSession.GetDefaultFolder(CdoDefaultFolderNotes)
> Set objFolSent =

objSession.GetDefaultFolder(CdoDefaultFolderSentItems)
> Set objFolTasks = objSession.GetDefaultFolder(CdoDefaultFolderTasks)
> Set objFolInbox = objSession.GetDefaultFolder(CdoDefaultFolderInbox)
> Set objFolOutbox = objSession.GetDefaultFolder(CdoDefaultFolderOutbox)
>
>
> For Each objFolder In colFolders
>
> ' Get hidden message collection
> Set objHiddenMessages = objFolder.HiddenMessages
>
> ' Loop through the hidden messages collection
> For Each objMessage In objHiddenMessages
>
>
> Select Case objFolder.ID
> Case objFolInbox.ID
> Case objFolOutbox.ID
> Case objFolJournal.ID
> Case objFolContacts.ID
> Case objFolCalendar.ID
> Case objFolDeleted.ID
> Case objFolNotes.ID
> Case objFolTasks.ID
> Case objFolSent.ID
> Case Else
>
> If Not objMessage.Type = "IPC.MS.Outlook.AgingProperties" Then
> objMessage.Add "IPC.MS.Outlook.AgingProperties"
> End If
>
> ' Change the autoarchive mode (none,default,param)
> objMessage.Fields.Item(CdoPR_AUTOARCHIVE_TYPE).Value = 0
>
> ' Change aging properties to 14 months/weeks/days
> objMessage.Fields.Item(CdoPR_AGING_PERIOD).Value = 3
>
> ' Change aging granularity to days
> objMessage.Fields.Item(CdoPR_AGING_GRANULARITY).Value = AG_MONTHS
>
> ' Change the path to the archive file
> objMessage.Fields.Item(CdoPR_AGING_PATH).Value =

"C:\Temp\archive.pst"
>
> ' Enable aging for this folder
> objMessage.Fields.Item(CdoPR_AGING_ENABLED).Value = True
>
> ' Enable aging age for this folder
> objMessage.Fields.Item(CdoPR_AGING_AGE_FOLDER).Value = True
>
> ' Update hidden message
> objMessage.Update True, True
>
> 'End If
> End Select
> Next
>
> Next
> End Sub
>
>


  Reply With Quote
Old 28-02-2005, 02:47 PM   #3
Ken Slovak - [MVP - Outlook]
Guest
 
Posts: n/a
Default Re: Setting Folder Aging Properties Prob

HiddenMessages is a collection in CDO 1.21 of the Folder object, it's what's
shown in OutlookSpy as Associated Messages and contains all the hidden items
in the folder.

As Michael said, the error is coming from Message.Add, which doesn't exist.
Once you get your Messages collection from HiddenMessages you would use
Messages.Add.

There's some information about the properties for archiving at
www.cdolive.com/cdo10.htm. Also, take a look at
http://www.cdolive.com/archiveviewer.htm, which uses those properties to
view autoarchive settings. It does a lot of what you want to do.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Michael Bauer" <mib00@t-online.de> wrote in message
news:%23KlJCf9GFHA.2428@TK2MSFTNGP10.phx.gbl...
> Hi Lando,
>
> I never worked with HiddenMessages so far and can´t find the class in
> the Objectbrowser. Is it the Messages class, too?
>
> If so, not objMessage, but objMessages has the Add method, and you´d
> need to re-design your code: You´d need to loop through the whole
> collection for searching the specified type and add it only if there is
> no match. Maybe the loop have not to be if you can use the Item method?
>
> BTW: If this is the complete code why do you check the objFolder.ID in
> each objMessage loop?
>
> --
> Viele Grüße
> Michael Bauer


  Reply With Quote
Old 28-02-2005, 05:20 PM   #4
Lando
Guest
 
Posts: n/a
Default Re: Setting Folder Aging Properties Prob

Thanks for the information! Unfortunately I'm not that experienced with VB.
I've looked at the code from the links you gave me and below is what I have
written on my own. I keep getting the error [Collaboration Data Objects -
[MAPI_E_NOT_FOUND(8004010F)] when I run the code below.
If I change:
Set objField = objFields.Item(CdoPR_AGING_FILENAME)
to
Set objField = objFields.Item(CdoPR_AUTOARCHIVE_TYPE)
or any other value it works.

I know I'm asking alot but does anyone have some sample code or could modify
my code below that would apply archive settings to a folder or all folders
in a mailbox with the values I chose? It seems I keep missing things I think
a savvy programmer would catch and could do much faster than I could ever
hope to.

Thanks again for all your help! I really appreciate it!

Lando
----------------------------------------------

Sub LandoCode()

' MAPI property tags for aging properties
Const CdoPR_AGING_PERIOD = &H36EC0003
Const CdoPR_AGING_GRANULARITY = &H36EE0003
Const CdoPR_AGING_PATH = &H6856001E
Const CdoPR_AGING_ENABLED = &H6857000B
Const CdoPR_AUTOARCHIVE_TYPE = &H685E0003
Const CdoPR_AGING_AGE_FOLDER = &H6857000B
Const CdoPR_CONTAINER_CLASS = &H3613001E
Const CdoPR_AGING_FILENAME = &H6856001E

' Properties for aging granularity
Const AG_MONTHS = 0
Const AG_WEEKS = 1
Const AG_DAYS = 2

' Declare variables
Dim objSession As MAPI.Session
Dim objInfoStore As Object
Dim objHiddenMessages As MAPI.Messages
Dim objMessage As MAPI.Message
Dim objFields As MAPI.Fields

' Initialize variables
Set objSession = Nothing
Set objInboxFolder = Nothing

' Create CDO session and logon
Set objSession = New MAPI.Session

' CDO session logon
objSession.Logon "", "", ShowDialog:=True, NewSession:=False

' Get the inbox folder of a mailbox
Set objFolder = objSession.Inbox

' Get the hidden messages collection
Set objMessages = objFolder.HiddenMessages

' Loop through the hidden messages
For Each objMessage In objMessages

' Check the message class
If objMessage.Type = "IPC.MS.Outlook.AgingProperties" Then
MsgBox (objMessage.Type)
Set objFields = objMessage.Fields

Set objField = objFields.Item(CdoPR_AGING_FILENAME)
MsgBox (objField.Value)

' For Each objField In objFields
' MsgBox (objField.Value)
' Next
End If
Next

End Sub


"Ken Slovak - [MVP - Outlook]" <kenslovak@mvps.org> wrote in message
news:ee1IBYaHFHA.400@TK2MSFTNGP14.phx.gbl...
> HiddenMessages is a collection in CDO 1.21 of the Folder object, it's
> what's shown in OutlookSpy as Associated Messages and contains all the
> hidden items in the folder.
>
> As Michael said, the error is coming from Message.Add, which doesn't
> exist. Once you get your Messages collection from HiddenMessages you would
> use Messages.Add.
>
> There's some information about the properties for archiving at
> www.cdolive.com/cdo10.htm. Also, take a look at
> http://www.cdolive.com/archiveviewer.htm, which uses those properties to
> view autoarchive settings. It does a lot of what you want to do.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
> Reminder Manager, Extended Reminders, Attachment Options
> http://www.slovaktech.com/products.htm
>
>
> "Michael Bauer" <mib00@t-online.de> wrote in message
> news:%23KlJCf9GFHA.2428@TK2MSFTNGP10.phx.gbl...
>> Hi Lando,
>>
>> I never worked with HiddenMessages so far and can´t find the class in
>> the Objectbrowser. Is it the Messages class, too?
>>
>> If so, not objMessage, but objMessages has the Add method, and you´d
>> need to re-design your code: You´d need to loop through the whole
>> collection for searching the specified type and add it only if there is
>> no match. Maybe the loop have not to be if you can use the Item method?
>>
>> BTW: If this is the complete code why do you check the objFolder.ID in
>> each objMessage loop?
>>
>> --
>> Viele Grüße
>> Michael Bauer

>



  Reply With Quote
Old 28-02-2005, 09:23 PM   #5
Lando
Guest
 
Posts: n/a
Default Re: Setting Folder Aging Properties Prob

Whooohoo! Sorry about that but I finally got it to work. Now I've got 2 more
things to overcome with this. The first is how do I recursively go through
every folder in a mailbox and apply these settings? I'm sure someone has
some excellent efficient code to do this. Thanks in advance.....

The next may be a problem. We are using Outlook 2003 in cached mode. We use
cached mode because the Junk-Email filter requires it be turned on to
function. I can set the autoarchive settings and when cached mode is OFF the
settings are correct. However if I turn cached mode ON the settings are
incorrect. Is there some way to refresh this information in the cached
profile via VBA or some other way?

Thanks ahead of time for everyones help. You guys are the just awesome!

Thanks,
Lando

"Ken Slovak - [MVP - Outlook]" <kenslovak@mvps.org> wrote in message
news:ee1IBYaHFHA.400@TK2MSFTNGP14.phx.gbl...
> HiddenMessages is a collection in CDO 1.21 of the Folder object, it's
> what's shown in OutlookSpy as Associated Messages and contains all the
> hidden items in the folder.
>
> As Michael said, the error is coming from Message.Add, which doesn't
> exist. Once you get your Messages collection from HiddenMessages you would
> use Messages.Add.
>
> There's some information about the properties for archiving at
> www.cdolive.com/cdo10.htm. Also, take a look at
> http://www.cdolive.com/archiveviewer.htm, which uses those properties to
> view autoarchive settings. It does a lot of what you want to do.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
> Reminder Manager, Extended Reminders, Attachment Options
> http://www.slovaktech.com/products.htm
>
>
> "Michael Bauer" <mib00@t-online.de> wrote in message
> news:%23KlJCf9GFHA.2428@TK2MSFTNGP10.phx.gbl...
>> Hi Lando,
>>
>> I never worked with HiddenMessages so far and can´t find the class in
>> the Objectbrowser. Is it the Messages class, too?
>>
>> If so, not objMessage, but objMessages has the Add method, and you´d
>> need to re-design your code: You´d need to loop through the whole
>> collection for searching the specified type and add it only if there is
>> no match. Maybe the loop have not to be if you can use the Item method?
>>
>> BTW: If this is the complete code why do you check the objFolder.ID in
>> each objMessage loop?
>>
>> --
>> Viele Grüße
>> Michael Bauer

>



  Reply With Quote
Old 28-02-2005, 09:47 PM   #6
Michael Bauer
Guest
 
Posts: n/a
Default Re: Setting Folder Aging Properties Prob

Hi Lando,

for the first you can easily adapt this template:

' <Sample: Loop through the Outlook folders hierarchy for handling _
each folder item>
Public Sub HandleAllItems(oRoot As Outlook.NameSpace)
LoopFolders oRoot.Folders, True
End Sub

Private Sub LoopFolders(oFolders As Outlook.Folders, _
ByVal bRecursive As Boolean _
)
Dim oFld As Outlook.MAPIFolder

' Loop through all folders.
For Each oFld In oFolders
' Loop through folder items
LoopItems oFld.Items

If bRecursive Then
' Call this function again for going _
deeper into the object hierarchy.
LoopFolders oFld.Folders, bRecursive
End If
Next
End Sub

Private Sub LoopItems(oItems As Outlook.Items)
Dim obj As Object

For Each obj In oItems
Select Case True
Case TypeOf obj Is Outlook.MailItem
HandleMailItem obj
Case TypeOf obj Is Outlook.ContactItem
' Another method for handling ContactItems
' etc.
End Select
Next
End Sub

Private Sub HandleMailItem(oItem As Outlook.MailItem)
' Do s.th. with the object.
End Sub
' </Sample>

For the second please wait for Ken :-)


--
Viele Grüße
Michael Bauer


"Lando" <lando@noemails.com> wrote in message
news:#dorGvdHFHA.2860@TK2MSFTNGP12.phx.gbl...
> Whooohoo! Sorry about that but I finally got it to work. Now I've got

2 more
> things to overcome with this. The first is how do I recursively go

through
> every folder in a mailbox and apply these settings? I'm sure someone

has
> some excellent efficient code to do this. Thanks in advance.....
>
> The next may be a problem. We are using Outlook 2003 in cached mode.

We use
> cached mode because the Junk-Email filter requires it be turned on to
> function. I can set the autoarchive settings and when cached mode is

OFF the
> settings are correct. However if I turn cached mode ON the settings

are
> incorrect. Is there some way to refresh this information in the cached
> profile via VBA or some other way?
>
> Thanks ahead of time for everyones help. You guys are the just

awesome!
>
> Thanks,
> Lando
>


  Reply With Quote
Old 01-03-2005, 02:39 PM   #7
Ken Slovak - [MVP - Outlook]
Guest
 
Posts: n/a
Default Re: Setting Folder Aging Properties Prob

Gee, thanks, Michael

One thing to note with Michael's example is that it is using the Outlook
object model and not CDO 1.21 code to iterate the folders. Similar code
could be written using CDO code using the Folders collection of each loaded
InfoStore in the Session.InfoStores collection and iterating each Folder
object.

And conversion from CDO to Outlook or vice versa is by getting the folder
EntryID (ID in CDO) along with StoreID and then using
NameSpace.GetFolderFromID or Session.GetFolder.

If the specific InfoStore is a default Exchange mailbox the synching of the
offline store (OST) and the mailbox on the server would take place at
scheduled intervals. To synch at different intervals you could find the
CommandBarButton that corresponds to Send/Receive All and use that button's
Execute method. That should synch. For public folders you need to set the
store to download public folders, set the email account to synch the folders
of interest and to add the public folders to the public folder favorites
folder.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Michael Bauer" <mib00@t-online.de> wrote in message
news:ehQQO5dHFHA.1392@TK2MSFTNGP10.phx.gbl...
> Hi Lando,
>
> for the first you can easily adapt this template:
>
> ' <Sample: Loop through the Outlook folders hierarchy for handling _
> each folder item>
> Public Sub HandleAllItems(oRoot As Outlook.NameSpace)
> LoopFolders oRoot.Folders, True
> End Sub
>
> Private Sub LoopFolders(oFolders As Outlook.Folders, _
> ByVal bRecursive As Boolean _
> )
> Dim oFld As Outlook.MAPIFolder
>
> ' Loop through all folders.
> For Each oFld In oFolders
> ' Loop through folder items
> LoopItems oFld.Items
>
> If bRecursive Then
> ' Call this function again for going _
> deeper into the object hierarchy.
> LoopFolders oFld.Folders, bRecursive
> End If
> Next
> End Sub
>
> Private Sub LoopItems(oItems As Outlook.Items)
> Dim obj As Object
>
> For Each obj In oItems
> Select Case True
> Case TypeOf obj Is Outlook.MailItem
> HandleMailItem obj
> Case TypeOf obj Is Outlook.ContactItem
> ' Another method for handling ContactItems
> ' etc.
> End Select
> Next
> End Sub
>
> Private Sub HandleMailItem(oItem As Outlook.MailItem)
> ' Do s.th. with the object.
> End Sub
> ' </Sample>
>
> For the second please wait for Ken :-)
>
>
> --
> Viele Grüße
> Michael Bauer


  Reply With Quote
Old 01-03-2005, 03:31 PM   #8
Lando
Guest
 
Posts: n/a
Default Re: Setting Folder Aging Properties Prob


"Ken Slovak - [MVP - Outlook]" <kenslovak@mvps.org> wrote in message
news:OT55PymHFHA.2852@TK2MSFTNGP12.phx.gbl...
> Gee, thanks, Michael
>
> One thing to note with Michael's example is that it is using the Outlook
> object model and not CDO 1.21 code to iterate the folders. Similar code
> could be written using CDO code using the Folders collection of each
> loaded InfoStore in the Session.InfoStores collection and iterating each
> Folder object.
>
> And conversion from CDO to Outlook or vice versa is by getting the folder
> EntryID (ID in CDO) along with StoreID and then using
> NameSpace.GetFolderFromID or Session.GetFolder.
>
> If the specific InfoStore is a default Exchange mailbox the synching of
> the offline store (OST) and the mailbox on the server would take place at
> scheduled intervals. To synch at different intervals you could find the
> CommandBarButton that corresponds to Send/Receive All and use that
> button's Execute method. That should synch. For public folders you need to
> set the store to download public folders, set the email account to synch
> the folders of interest and to add the public folders to the public folder
> favorites folder.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
> Reminder Manager, Extended Reminders, Attachment Options
> http://www.slovaktech.com/products.htm
>
>
> "Michael Bauer" <mib00@t-online.de> wrote in message
> news:ehQQO5dHFHA.1392@TK2MSFTNGP10.phx.gbl...
>> Hi Lando,
>>
>> for the first you can easily adapt this template:
>>
>> ' <Sample: Loop through the Outlook folders hierarchy for handling _
>> each folder item>
>> Public Sub HandleAllItems(oRoot As Outlook.NameSpace)
>> LoopFolders oRoot.Folders, True
>> End Sub
>>
>> Private Sub LoopFolders(oFolders As Outlook.Folders, _
>> ByVal bRecursive As Boolean _
>> )
>> Dim oFld As Outlook.MAPIFolder
>>
>> ' Loop through all folders.
>> For Each oFld In oFolders
>> ' Loop through folder items
>> LoopItems oFld.Items
>>
>> If bRecursive Then
>> ' Call this function again for going _
>> deeper into the object hierarchy.
>> LoopFolders oFld.Folders, bRecursive
>> End If
>> Next
>> End Sub
>>
>> Private Sub LoopItems(oItems As Outlook.Items)
>> Dim obj As Object
>>
>> For Each obj In oItems
>> Select Case True
>> Case TypeOf obj Is Outlook.MailItem
>> HandleMailItem obj
>> Case TypeOf obj Is Outlook.ContactItem
>> ' Another method for handling ContactItems
>> ' etc.
>> End Select
>> Next
>> End Sub
>>
>> Private Sub HandleMailItem(oItem As Outlook.MailItem)
>> ' Do s.th. with the object.
>> End Sub
>> ' </Sample>
>>
>> For the second please wait for Ken :-)
>>
>>
>> --
>> Viele Grüße
>> Michael Bauer

>



  Reply With Quote
Old 01-03-2005, 03:31 PM   #9
Michael Bauer
Guest
 
Posts: n/a
Default Re: Setting Folder Aging Properties Prob

Hi Ken,

> Gee, thanks, Michael


please, what is the meaning of "Gee"?

--
Viele Grüße
Michael Bauer

  Reply With Quote
Old 01-03-2005, 04:21 PM   #10
Lando
Guest
 
Posts: n/a
Default Re: Setting Folder Aging Properties Prob

Thank Ken,
Would you be able to show me some sample CDO code using the folders
collection method? I prefer using this method if possible. Also, the
send/receive does not update the archive settings set on the server. The
cached mode profile still retains the old settings. Do you know where these
are stored locally and if so is there a way to syncronize them?

Thanks,
Lando


"Ken Slovak - [MVP - Outlook]" <kenslovak@mvps.org> wrote in message
news:OT55PymHFHA.2852@TK2MSFTNGP12.phx.gbl...
> Gee, thanks, Michael
>
> One thing to note with Michael's example is that it is using the Outlook
> object model and not CDO 1.21 code to iterate the folders. Similar code
> could be written using CDO code using the Folders collection of each
> loaded InfoStore in the Session.InfoStores collection and iterating each
> Folder object.
>
> And conversion from CDO to Outlook or vice versa is by getting the folder
> EntryID (ID in CDO) along with StoreID and then using
> NameSpace.GetFolderFromID or Session.GetFolder.
>
> If the specific InfoStore is a default Exchange mailbox the synching of
> the offline store (OST) and the mailbox on the server would take place at
> scheduled intervals. To synch at different intervals you could find the
> CommandBarButton that corresponds to Send/Receive All and use that
> button's Execute method. That should synch. For public folders you need to
> set the store to download public folders, set the email account to synch
> the folders of interest and to add the public folders to the public folder
> favorites folder.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
> Reminder Manager, Extended Reminders, Attachment Options
> http://www.slovaktech.com/products.htm
>
>
> "Michael Bauer" <mib00@t-online.de> wrote in message
> news:ehQQO5dHFHA.1392@TK2MSFTNGP10.phx.gbl...
>> Hi Lando,
>>
>> for the first you can easily adapt this template:
>>
>> ' <Sample: Loop through the Outlook folders hierarchy for handling _
>> each folder item>
>> Public Sub HandleAllItems(oRoot As Outlook.NameSpace)
>> LoopFolders oRoot.Folders, True
>> End Sub
>>
>> Private Sub LoopFolders(oFolders As Outlook.Folders, _
>> ByVal bRecursive As Boolean _
>> )
>> Dim oFld As Outlook.MAPIFolder
>>
>> ' Loop through all folders.
>> For Each oFld In oFolders
>> ' Loop through folder items
>> LoopItems oFld.Items
>>
>> If bRecursive Then
>> ' Call this function again for going _
>> deeper into the object hierarchy.
>> LoopFolders oFld.Folders, bRecursive
>> End If
>> Next
>> End Sub
>>
>> Private Sub LoopItems(oItems As Outlook.Items)
>> Dim obj As Object
>>
>> For Each obj In oItems
>> Select Case True
>> Case TypeOf obj Is Outlook.MailItem
>> HandleMailItem obj
>> Case TypeOf obj Is Outlook.ContactItem
>> ' Another method for handling ContactItems
>> ' etc.
>> End Select
>> Next
>> End Sub
>>
>> Private Sub HandleMailItem(oItem As Outlook.MailItem)
>> ' Do s.th. with the object.
>> End Sub
>> ' </Sample>
>>
>> For the second please wait for Ken :-)
>>
>>
>> --
>> Viele Grüße
>> Michael Bauer

>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off