Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #16  
Old 03-03-2005, 02:12 PM
Ken Slovak - [MVP - Outlo
Guest
 
Posts: n/a
Default Re: Setting Folder Aging Properties Prob

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
Reply With Quote
  #17  
Old 03-03-2005, 06:38 PM
Lando
Guest
 
Posts: n/a
Default Re: Setting Folder Aging Properties Prob

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?
Reply With Quote
  #18  
Old 03-04-2005, 01:29 PM
Ken Slovak - [MVP - Outlo
Guest
 
Posts: n/a
Default Re: Setting Folder Aging Properties Prob

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
Reply With Quote
  #19  
Old 07-11-2005, 03:48 PM
rbuckley
Guest
 
Posts: n/a
Default Re: Setting Folder Aging Properties Prob

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, th
paths of the archive.pst never get changed.

Thanks,

Ric
Reply With Quote
  #20  
Old 07-11-2005, 04:46 PM
rbuckley
Guest
 
Posts: n/a
Default Re: Setting Folder Aging Properties Prob

I am testing on Outlook2000 bt
Reply With Quote
  #21  
Old 07-12-2005, 04:49 PM
Eric Legault [MVP - Outlo
Guest
 
Posts: n/a
Default Re: Setting Folder Aging Properties Prob

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.Cu rrentFolder.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).Val ue = 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).Va lue = 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).Val ue = 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/
Reply With Quote
  #22  
Old 07-12-2005, 05:55 PM
rbuckley
Guest
 
Posts: n/a
Default Re: Setting Folder Aging Properties Prob

I saved this as a .vbs and ran it. My infostore is item(2) because fo
some reason the Archive.pst listed first in my Outlook profile.
successfully run down the folders and hit on the hidden collections
but the location doesn't change. I have tried locations that ar
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(CdoDefaultFolderCalend ar)
Set objFolContacts
objSession.GetDefaultFolder(CdoDefaultFolderContac ts)
Set objFolDelete
=objSession.GetDefaultFolder(CdoDefaultFolderDelet edItems)
Set objFolJournal
objSession.GetDefaultFolder(CdoDefaultFolderJourna l)
Set objFolNotes = objSession.GetDefaultFolder(CdoDefaultFolderNotes)
Set objFolSent
objSession.GetDefaultFolder(CdoDefaultFolderSentIt ems)
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).Va lue = 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
Nex
Reply With Quote
  #23  
Old 07-15-2005, 04:41 PM
Eric Legault [MVP - Outlo
Guest
 
Posts: n/a
Default Re: Setting Folder Aging Properties Prob

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:



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/
Reply With Quote
  #24  
Old 09-18-2005, 05:53 PM
Goku316
Guest
 
Posts: n/a
Default Re: Setting Folder Aging Properties Prob

Please Everyone I have been watching your post all this wekend and I a
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 archivin
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 ca
some one explain to me how can i use this to do the same for m
company....

all help is welcomed...

Tony...

aramsajan@gmail.co
Reply With Quote
  #25  
Old 06-07-2006, 02:14 AM
Goppi Goppi is offline
Novice
 
Join Date: Jun 2006
Posts: 1
Goppi
Default Default Auto Archive

Hi everybody,

I was looking into this topic and found the posts quite interesting, however there is one question that I can't figure out: Rather than setting all archive parameters for a folder (f.i. Aging Period, Granularity, etc) I want to set folders to use the defaults. I'm not sure if the item that represents the value is the AUTOARCHIVE_TYPE (&H685E0003). If that's the item than what are the values?

cheers,
Goppi
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
setting up a program to run from your calendar mattz76 Outlook 0 08-22-2007 09:13 PM
Can I get some help setting this up please? Moiraes Fate Office 0 05-18-2007 12:22 PM
Looping though Custom Properties in VBA suekay Misc 0 05-19-2006 06:10 AM
Visio - Custom Properties Timeout? googull Visio 0 05-17-2006 07:37 AM
setting rules isapaine Misc 0 01-11-2006 07:51 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:20 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft