Set all subfolders to not autoarchive

Not open for further replies.


Outlook version
Outlook 2013 32 bit
Email Account
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.
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.
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
"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.
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"
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...
I´m sorry, I cannot figure out which part you don´t understand.
You mentioned this line returning no result
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.
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"))

Which resulted in:

18-10-28 15:52:22
So the message does exist. Back to my first reply: Delete the On Error Resume Next in order to see if an error occurs.
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.
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.
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
J Set calendar default to 'none' (policy) Exchange Server Administration 3
U When opening shared Calendar "The set of folders cannot be opened" Using Outlook 0
L Help: set flag for sent mail to check if received an answer Outlook VBA and Custom Forms 2
D VBA - unable to set rule condition 'on this computer only' Outlook VBA and Custom Forms 5
Witzker Set Cursor & Focus from any field to the body of a user Contact form in OL 2019 Outlook VBA and Custom Forms 1
justicefriends How to set a flag to follow up using VBA - for addressee in TO field Outlook VBA and Custom Forms 11
FryW Need help modifying a VBA script for in coming emails to auto set custom reminder time Outlook VBA and Custom Forms 0
O Cannot expand the folder. The set of folders cannot be opened. You do not have permission to log on. Using Outlook 1
e_a_g_l_e_p_i Outlook 2010 How to set default email address for website links Using Outlook 3
A Run-time error '430' on certain emails when trying to set "Outlook.mailitem" as "ActiveExplorer.Selection.Item" Outlook VBA and Custom Forms 2
e_a_g_l_e_p_i Is it possible it set the fonts used to read incoming mail Using Outlook 25
bmtjedi Set objApp = Application Not Working in O365-32bit Using Outlook 1
F how do i set a reminder in onenote 2010 Using Outlook 8
glnz How set up new IMAP on Outlook-Office 365 and merge in pst from Outlook 2003 for same two email accounts? Using Outlook 5
ChrisK2 Send email to fails: "The group advertising isn't set up to receive messages from..." Using Outlook 3
S How to set up button in ribbon for individual Quick Steps Using Outlook 1
J Set Timer/Countdown on Emails? Outlook VBA and Custom Forms 3
N How to set automatically the default or user defined Quickstyle Templates by Answer in Outlook Using Outlook 1
Z Script to set account? Using Outlook 0
4 Macro to set the category of Deleted Item? Outlook VBA and Custom Forms 2
J What is the best EntryID format to set on MS Access table Outlook VBA and Custom Forms 3
e_a_g_l_e_p_i Can you set reminder to specific times? Using Outlook 7
CWM030 I do not see a way to set the personal archive folder Exchange Server Administration 2
Witzker Macro to set contact reminder to next day 9:00 Outlook VBA and Custom Forms 45
O Set columns for all (sub)folders Using Outlook 8
S Appointment-Cannot set Categories because ConversationID is not set Outlook VBA and Custom Forms 1
Fozzie Bear Correct Method to set up accounts as Exchange Using accounts in Outlook 7
e_a_g_l_e_p_i How to set fonts for emails in all folders in Outlook Using Outlook 1
F Set (flagged) reminder for next business day Using Outlook 4
L how to set downloaded cached emails Using Outlook 5
J Object Variable or With Block Not Set Error in Outlook 2016 and not Outlook 2013 Outlook VBA and Custom Forms 3
S set a flag task date as the next weekday Outlook VBA and Custom Forms 4
C Set reminder / appointment by right clicking email Using Outlook 1
Diane Poremsky Set Another Data File as Default When Using an Exchange Account Using Outlook 0
R Macro to copy email to excel - Runtime Error 91 Object Variable Not Set Outlook VBA and Custom Forms 11
L set task reminder date to same as start date (without affecting due date) Using Outlook 0
S how to set user properties to a newly created appointment Outlook VBA and Custom Forms 12
C Outlook VBA to set current account Outlook VBA and Custom Forms 1
Diane Poremsky Add Attachments and Set Email Fields During a Mail Merge Using Outlook 0
O How to set subject line in replies using VBA Outlook VBA and Custom Forms 1
A Custom form not showing when recurrence is set for a meeting Using Outlook 0
M Exchange 2013 On premise set MessageRateLimit for User has no effect. Exchange Server Administration 0
A Block user to send emails to specific set of email ids Using Outlook 1
D Outlook 2007 e-mail header- How to set font & font size in received message headers ? Using Outlook 2
Diane Poremsky Exchange account set-up missing in Outlook 2016 Using Outlook 0
M To set the storage folder for an outgoing Outlook message Outlook VBA and Custom Forms 8
E Meeting reminders are set for the recipient Exchange Server Administration 9
M Help! Can't set up IMAP for gmail Using Outlook 2
P Last Change attribute set after viewing a public folder contact Exchange Server Administration 0
S Multiple Gmail account set up in Outlook 365 Using Outlook 1

Similar threads