PC Review


Reply
Thread Tools Rate Thread

AutoArchive using VBA CDO CdoPR_AGING_PATH

 
 
xx
Guest
Posts: n/a
 
      5th Aug 2006
I am trying to programatically change the path to the archive file. My pst
has may folders and I dont want to change the path on each one by hand.

Using the code I can change the GRANULARITY and the PERIOD but the path wont
change. ( I am verifying the settings by right clicking the folder and
selecting AutoArchive).

I have tested in both Outlook 2002 and 2003. On 2003 I was able to change
the path when I ran the code the first time but subsequent attempt failed to
change the path.

Strangely when I view the path
(objMessage.Fields.Item(CdoPR_AGING_PATH).Value) via code after I change it,
it show the changed path but the AutoArchive tab show the old path.

Any suggestions?

Thanks in Advance

Below is some code I'm using...

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




 
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
AutoArchive using VBA CDO CdoPR_AGING_PATH xx Microsoft Outlook VBA Programming 1 8th Jun 2010 09:40 PM
AutoArchive Farhad Microsoft Outlook Discussion 3 7th Mar 2008 02:54 PM
Autoarchive =?Utf-8?B?WmVrYW1hYm95?= Microsoft Outlook Discussion 0 3rd Oct 2006 05:46 AM
AutoArchive Frances Microsoft Outlook 1 23rd Jun 2004 12:48 PM
Re: Autoarchive Charles Beauregard [MSFT] Microsoft Outlook Discussion 1 24th Oct 2003 04:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:38 AM.