Set all subfolders to not autoarchive

Victor_50

New Member
Outlook version
Outlook 2013 32 bit
Email Account
POP3
#1
Hi, I have been trying to get some (found) code working to copy the autoarchive setting "do not autoarchive" to all subfolders of a specific folder. There are two issues:

It seems that setting "do not autoarchive" is not included in the code, it looks at all aspects of archiving save "do not archive".

The second problem is that the line [Set oStorage = oFolder.GetStorage("IPC.MS.Outlook.AgingProperties", olIdentifyByMessageClass)] gives no result, though it doesn't error. Probably because this doesn't work in OL 2013.
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
#2
Without knowing the code you´re referring to we can only guess what´s going on. If it contains an On Error Resume Next you don´t get an error message even if one occurs. If the hidden message GetStorage is looking for doesn´t exist I´say there´s no auto archive setting for that folder.
 

Victor_50

New Member
Outlook version
Outlook 2013 32 bit
Email Account
POP3
#3
After some thought I guess maybe "Do not archive" is not seen as an archive setting so, although it is part of the archive settings options it cannot be set this way. For reference, the code is here. More specific the function

Function GetAgingProperties(oFolder As Outlook.Folder, AgeFolder As Boolean, DeleteItems As Boolean, FileName As String, Granularity As Integer, Period As Integer, Default As Integer) As Boolean
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
#4
"No setting" is a valid setting, it just doesn´t need to be stored. So, no stored value means "no setting". In other words, if you want to turn off the auto archive function, delete the hidden message that stores any other archive settings.
 

Victor_50

New Member
Outlook version
Outlook 2013 32 bit
Email Account
POP3
#5
Ah, I would like to try this but I am not that good in coding to see how this could be achieved in the function "SetAgingProperties"
 

Victor_50

New Member
Outlook version
Outlook 2013 32 bit
Email Account
POP3
#7
Unfortunately it doesn't for the same reason as "SetAgingProperties". Tried to look at it by
Set tTable = oFolder.GetTable("", olHiddenItems) Then it lists "IPC.MS.Outlook.AgingProperties" thats how far I got...
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
#8
I´m sorry, I cannot figure out which part you don´t understand.
You mentioned this line returning no result
Code:
Set oStorage = oFolder.GetStorage("IPC.MS.Outlook.AgingProperties", olIdentifyByMessageClass)]
Which should mean that the folder doen´t have archive settings stored. That´s what you want, don´t you? Else, if it returns an object, it´s the one you want to delete, so you´d call oStorage.Delete.
 

Victor_50

New Member
Outlook version
Outlook 2013 32 bit
Email Account
POP3
#9
Ah, it should mean that, but it doesn't. I tested this with a folder with autoarchive settings and it returns nothing, so there is no object that can be deleted. In the meantime I tried this:

Dim oFolder As Outlook.Folder
Dim tTable As Outlook.Table
Dim rRow As Outlook.Row

Set oFolder = Application.ActiveExplorer.CurrentFolder
Set tTable = oFolder.GetTable("", olHiddenItems)

Do Until (tTable.EndOfTable)
Set rRow = tTable.GetNextRow()
Debug.Print (rRow("Subject"))
Debug.Print (rRow("LastModificationTime"))
Debug.Print (rRow("MessageClass"))
Loop

Which resulted in:

18-10-28 15:52:22
IPC.MS.Outlook.AgingProperties
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
#10
So the message does exist. Back to my first reply: Delete the On Error Resume Next in order to see if an error occurs.
 

Victor_50

New Member
Outlook version
Outlook 2013 32 bit
Email Account
POP3
#11
Finally found the error. The instructions told me to put the procedures in a seperate module, but I don't like that so pasted it in an existing one. The declaration of the constants should have been moved to the declarations section of the module. So (1) bad error message in VBA (not: variable unknown or preferably variable xxxx not declared) and (2) bad documentation/commenting, also because PR_AGING_DEFAULT set to 0 means "No archiving". Found code elswhere that worked and didn't use constants. Also doesn't help "GetStorage" produces an empty string that apparantly means it is an object.
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
#12
Also doesn't help "GetStorage" produces an empty string that apparantly means it is an object.
No, it does return either on object or nothing. If you see a string, it´s the object´s default property and means actually your method of testing is wrong; but it also means the object cannot be nothing.
 

Similar threads

Top