Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Setting Folder Aging Properties Prob

110 views
Skip to first unread message

Lando

unread,
Feb 25, 2005, 3:04:05 PM2/25/05
to
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


Michael Bauer

unread,
Feb 26, 2005, 2:55:04 AM2/26/05
to
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" <la...@noemails.com> wrote in message
news:#DOErU3G...@tk2msftngp13.phx.gbl...

Ken Slovak - [MVP - Outlook]

unread,
Feb 28, 2005, 9:47:20 AM2/28/05
to
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" <mi...@t-online.de> wrote in message
news:%23KlJCf9...@TK2MSFTNGP10.phx.gbl...

Lando

unread,
Feb 28, 2005, 12:20:14 PM2/28/05
to
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]" <kens...@mvps.org> wrote in message
news:ee1IBYa...@TK2MSFTNGP14.phx.gbl...

Lando

unread,
Feb 28, 2005, 4:23:37 PM2/28/05
to
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]" <kens...@mvps.org> wrote in message
news:ee1IBYa...@TK2MSFTNGP14.phx.gbl...

Michael Bauer

unread,
Feb 28, 2005, 4:47:05 PM2/28/05
to
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" <la...@noemails.com> wrote in message

news:#dorGvdH...@TK2MSFTNGP12.phx.gbl...

Ken Slovak - [MVP - Outlook]

unread,
Mar 1, 2005, 9:39:14 AM3/1/05
to
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" <mi...@t-online.de> wrote in message

news:ehQQO5dH...@TK2MSFTNGP10.phx.gbl...

Lando

unread,
Mar 1, 2005, 10:31:34 AM3/1/05
to

"Ken Slovak - [MVP - Outlook]" <kens...@mvps.org> wrote in message
news:OT55PymH...@TK2MSFTNGP12.phx.gbl...

Michael Bauer

unread,
Mar 1, 2005, 10:31:54 AM3/1/05
to
Hi Ken,

> Gee, thanks, Michael :)

please, what is the meaning of "Gee"?

Lando

unread,
Mar 1, 2005, 11:21:51 AM3/1/05
to
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]" <kens...@mvps.org> wrote in message

news:OT55PymH...@TK2MSFTNGP12.phx.gbl...

anon...@discussions.microsoft.com

unread,
Mar 1, 2005, 11:37:38 PM3/1/05
to
I AINT WORRYING ABOUT YOUR REPEAT CODE, BUT AS FOR THE
OBJECT ADD THIS, AND CHANGE TO READ


>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

>' CDO session logon
>'Dim colFolders As MAPI.Folders
>Set objInboxFolder = Nothing


>Set objSession = New MAPI.Session

|||DIM objMessage
|||SET objMessage
|||SET objMessageHidden as objMessage

>-----Original Message-----
>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
>------------------------------------------------
>>
>

>.
>

Ken Slovak - [MVP - Outlook]

unread,
Mar 2, 2005, 9:18:50 AM3/2/05
to
There are all sorts of samples of CDO 1.21 code at www.cdolive.com/cdo5.htm.
I also had mentioned a sample for folder aging properties also located at
CDOLive.

Each folder's aging properties are stored in a hidden item in the folder (in
the HiddenMessages collection of that folder). When you are accessing the
store using cached mode you have access to the OST file and not directly to
the Exchange mailbox. The OST should synch to the mailbox at scheduled
intervals and a send/receive all usually does that synch.

--
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

"Lando" <la...@noemails.com> wrote in message

news:umO1Irn...@TK2MSFTNGP15.phx.gbl...

Ken Slovak - [MVP - Outlook]

unread,
Mar 2, 2005, 9:21:41 AM3/2/05
to
Gee is an expression meaning something like golly, an expression used to
express mild surprise or wonder politely.

--
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" <mi...@t-online.de> wrote in message

news:%23TyX4Wn...@TK2MSFTNGP10.phx.gbl...

Michael Bauer

unread,
Mar 2, 2005, 10:55:00 AM3/2/05
to
Thanks for the translation. Unfortunately the important expressions are
not explained in my dictionary...

--
Viele Grüße
Michael Bauer

"Ken Slovak - [MVP - Outlook]" <kens...@mvps.org> wrote in message

news:uUeWfNzH...@TK2MSFTNGP09.phx.gbl...

Lando

unread,
Mar 2, 2005, 11:29:51 AM3/2/05
to
Thanks for the links Ken,
Unfortunately I can't get it to work. I keep getting different messages.
Could someone list some sample CDO code that would get a list of all folders
in a user's mailbox? This would greatly help me and I could modify the code
from there.

Also, when accessing the OST file while in cached mode the archive settings
are NOT correct. If I take the user out of cached mode the archive settings
are displayed correctly. The send/receive all does NOT sync the archive
settings. The server settings differ from the local OST file settings. Is
there a way to syncronize these?

Another way to do this may be to apply archive settings using Outlook's
built-in archive properties rather than using CDO to access the mail store
information. For example, I right-click on a folder and set the autoarchive
properties and click ok. Is there a way to do this via VB rather than using
the folders autoarchive property menus?

Thanks in advance for the help!
Lando


"Ken Slovak - [MVP - Outlook]" <kens...@mvps.org> wrote in message

news:O%237MfNzH...@TK2MSFTNGP09.phx.gbl...

Michael Bauer

unread,
Mar 3, 2005, 2:34:25 AM3/3/05
to
Hi Lando,

1) As I said you can easily adapt my sample. Just change the object
types from Outlook types into Mapi types. For Mapi the hierarchy is
Session/InfoStores/InfoStore/Folders/Folder/Messages.

If you have done that and still get errors then it would be helpful for
us if you say what type of errors you get.

2) Ken thinks: gee, but I still don´t know the answer :-)

3) No way via the OOM. There would be a way with a lot of Win32 APIs and
a separate (EXE) thread. My strongly recommendation: Forget it :-)


--
Viele Grüße
Michael Bauer

"Lando" <la...@noemails.com> wrote in message

news:#bvluU0H...@TK2MSFTNGP14.phx.gbl...

Ken Slovak - [MVP - Outlook]

unread,
Mar 3, 2005, 10:12:54 AM3/3/05
to
Outlook's archive settings aren't exposed at all. You'd have to use some
other API or object model to get at them. The folder settings are accessible
using CDO or Redemption or Extended MAPI, the global settings are in the
registry.

I don't know of any ways to get around your cached problem if a synch isn't
matching the server side and local OST settings. The only thing I see in
your code that could be a problem is the assumption that the archive
properties you are accessing always will exist in the folders. In many cases
the properties won't exist until they are created. So you might want to try
getting a property or setting it and if you get an error then using the Add
method to add those properties to the folder.

For a CDO sample to iterate folders just use Michael's Outlook example and
change the types to CDO types. Otherwise the principles are identical.

--
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

"Lando" <la...@noemails.com> wrote in message

news:%23bvluU0...@TK2MSFTNGP14.phx.gbl...

Lando

unread,
Mar 3, 2005, 2:38:12 PM3/3/05
to
One more tidbit of information on this. The CDO code to change the archive
properties does not work when in cached mode. You must be out of cached mode
for the settings to change. At least that appears to be what is happening
from what I can tell. Any suggestions?

"Ken Slovak - [MVP - Outlook]" <kens...@mvps.org> wrote in message

news:Ozo2$NAIFH...@TK2MSFTNGP10.phx.gbl...

Ken Slovak - [MVP - Outlook]

unread,
Mar 4, 2005, 9:29:47 AM3/4/05
to
About the only thing I can think of other than using Extended MAPI is that
the latest version of Redemption seems to have a new
MAPIUtils.GetItemFromIDEx method that can read directly from the mailbox and
bypass the cache. That might work.

--
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


"Lando" <la...@noemails.com> wrote in message

news:uLEDKiCI...@TK2MSFTNGP09.phx.gbl...

rbuckley

unread,
Jul 11, 2005, 1:48:27 PM7/11/05
to

Did anyone ever get this working. I have tried scripting this as well.
The script runs, and processes all the folders in the mailbox. But, the
paths of the archive.pst never get changed.

Thanks,

Rich


--
rbuckleyPosted from http://www.pcreview.co.uk/ newsgroup access

rbuckley

unread,
Jul 11, 2005, 2:46:23 PM7/11/05
to

I am testing on Outlook2000 btw

Eric Legault [MVP - Outlook]

unread,
Jul 12, 2005, 2:49:06 PM7/12/05
to
Can you post a sample of your code?

This is some code I have for changing the auto-archive settings:

Sub ReadFolderAgingProperties()
Dim objFolder As MAPI.Folder
Dim objMessage As MAPI.Message
Dim objSession As MAPI.Session
Dim objField As MAPI.Field


Set objSession = New MAPI.Session

objSession.Logon , , , False

Set objFolder =
objSession.GetFolder(Application.ActiveExplorer.CurrentFolder.EntryID)
For Each objMessage In objFolder.HiddenMessages


If objMessage.Type = "IPC.MS.Outlook.AgingProperties" Then

' 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

Next

Set objFolder = Nothing
Set objMessage = Nothing
objSession.Logoff
Set objSession = Nothing
End Sub

--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
Try Picture Attachments Wizard for Outlook! http://tinyurl.com/ckytm
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault/

rbuckley

unread,
Jul 12, 2005, 4:07:00 PM7/12/05
to

I saved this as a .vbs and ran it. My infostore is item(2) because for
some reason the Archive.pst listed first in my Outlook profile. I
successfully run down the folders and hit on the hidden collections,
but the location doesn't change. I have tried locations that are
network shares and locations that are local.

' MAPI property tags for aging properties

Public Const CdoPR_AGING_PERIOD = &H36EC0003
Public Const CdoPR_AGING_GRANULARITY = &H36EE0003
Public Const CdoPR_AGING_PATH = &H6856001E
Public Const CdoPR_AGING_ENABLED = &H6857000B

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

Set objSession = CreateObject("MAPI.Session")
objSession.Logon "", "", True ,False

Set objInfoStore = objSession.InfoStores.Item(2)


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
'msgbox "here"


' Get hidden message collection
Set objHiddenMessages = objFolder.HiddenMessages

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

'msgbox "here2"

' Check if the message class points to an aging message


If objMessage.Type = "IPC.MS.Outlook.AgingProperties" Then

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

' Change aging granularity to days

objMessage.Fields.Item(CdoPR_AGING_GRANULARITY).Value = AG_DAYS

' Change the path to the archive file

objMessage.Fields.Item(CdoPR_AGING_PATH).Value = "c:\archive.pst"

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

' Update hidden message


objMessage.Update True, True
End If
Next

Next

Eric Legault [MVP - Outlook]

unread,
Jul 15, 2005, 2:41:06 PM7/15/05
to
Okay, I see the problem now too. Indeed, even changes to the path in the UI
are not read by the code, even after a reboot. Same goes with changing the
path with the code - it is never reflected in the UI after a reboot. Indeed,
days have gone by and the path I've set in the code is never shown in the UI,
but the code STILL shows the value I've set in the code.

I thought this might be an issue with Cached mode, but this is really
irrelevant with .pst files, and it occurs with this off or on.

I'm stumped. I was! After I wrote that, I dug around some more. This same
issues was discussed in April:

http://groups-beta.google.com/group/microsoft.public.outlook/browse_thread/thread/7e29d150398f3302/a07894c1baf4f9f0?q=%220x6859%22+aging&rnum=1&hl=en#a07894c1baf4f9f0

Basically, Outlook 2003 stores this setting in a new MAPI property. Set a
MAPI.Field object reference using this constant:

Const CdoPR_AGING_PATH_V2 = &H6859001E '0x6859001E

Now you should be able to read and write it properly. Note the changes to
the other properties as per that thread.

--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
Try Picture Attachments Wizard for Outlook! http://tinyurl.com/ckytm
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault/

Goku316

unread,
Sep 18, 2005, 5:01:36 PM9/18/05
to

Please Everyone I have been watching your post all this wekend and I am
not a programmer just a simple sys admin...

I need your help on the topic at hand....

our company is short on $$$ but we too need to impliment auto archiving
and your CDO Code seems to be a way to help our company....


I see the posted codes you all have submitted but if it is working can
some one explain to me how can i use this to do the same for my
company....

all help is welcomed...

Tony...

aram...@gmail.com


--
Goku316Posted via http://www.officehelp.in - &lt;a href=&quot;http://www.officehelp.in&quot;&gt;Microsoft Office Software&lt;/a&gt;

Merlin

unread,
Jun 22, 2006, 6:24:50 AM6/22/06
to
Hello,

I know this thread has stopped for a while but I had been working for
this for a while, dropped and is working on it again out of interest.

Would appreciate it if anyone can input on this.

Does anybody know how to distinguish, in Outlook 2003, the difference in
settings between a folder with specific AutoArchive settings and 1 that
is using the "Archive items...using the default settings." option?

BTW, anybody knows of a source with more complete information on this
subject?

Thanks.

*** Sent via Developersdex http://www.developersdex.com ***

0 new messages