Works individually with MFCMAPI but not bulk with VBA script...

Silversonic

New Member
OS Version(s)
  1. Windows
Outlook version
Outlook 365 32 bit
Operating system::    Win 11
Outlook version:     OUtlook 365 Classic
Email type or host:    Exchange

System is Win 11, Outlook 365 32 bit classic, Exchange server. During some recent Outlook housekeeping when I was trying to change to a custom form for contacts, about 400 emails somehow managed to get their message class changed from the standard IPM.note as well and converted to contacts. I'd like to retrieve these emails for archive purposes. Have moved all affected into a single subfolder, and have discovered that if I use MFCMAPI on that folder, I can convert each item individually from the erroneous 'IPM.Contact.TN Contacts 20250531' back to 'IPM.Note' and see the email again in its original form. Clearly can't make bulk changes with MFCMAPI so thought I'd try a VBA macro on only the subfolder that contains the affected items and loaded an amended version of one that I found on Slipstick, but can't get it to run (macros & VBA enabled and can see VBA menus etc). But it doesn't run/doesn't work, and can't see what the issue is given that message class change individually with MFCMAPI works. Is it a syntax error or something else- help gratefully received and still regretting the demise of MessageClassModifier that worked to well up to Outlook 2007:

Sub ChangeMessageClass()
Set olNS = Application.GetNamespace("MAPI")
Set ContactsFolder = Application.ActiveExplorer.CurrentFolder
Set ContactItems = ContactsFolder.Items
For Each Itm In ContactItems
If Itm.MessageClass <> "IPM.Contact.TN Contacts 20250531" Then
Itm.MessageClass = "IPM.Note"
Itm.Save
End If
Next
End Sub

Many thanks in advance!
 
System is Win 11, Outlook 365 32 bit classic, Exchange server. During some recent Outlook housekeeping when I was trying to change to a custom form for contacts, about 400 emails somehow managed to get their message class changed from the standard IPM.note as well and converted to contacts. I'd like to retrieve these emails for archive purposes. Have moved all affected into a single subfolder, and have discovered that if I use MFCMAPI on that folder, I can convert each item individually from the erroneous 'IPM.Contact.TN Contacts 20250531' back to 'IPM.Note' and see the email again in its original form. Clearly can't make bulk changes with MFCMAPI so thought I'd try a VBA macro on only the subfolder that contains the affected items and loaded an amended version of one that I found on Slipstick, but can't get it to run (macros & VBA enabled and can see VBA menus etc). But it doesn't run/doesn't work, and can't see what the issue is given that message class change individually with MFCMAPI works. Is it a syntax error or something else- help gratefully received and still regretting the demise of MessageClassModifier that worked to well up to Outlook 2007:

Sub ChangeMessageClass()
Set olNS = Application.GetNamespace("MAPI")
Set ContactsFolder = Application.ActiveExplorer.CurrentFolder
Set ContactItems = ContactsFolder.Items
For Each Itm In ContactItems
If Itm.MessageClass <> "IPM.Contact.TN Contacts 20250531" Then
Itm.MessageClass = "IPM.Note"
Itm.Save
End If
Next
End Sub

Many thanks in advance!
System is Win 11, Outlook 365 32 bit classic, Exchange server. During some recent Outlook housekeeping when I was trying to change to a custom form for contacts, about 400 emails somehow managed to get their message class changed from the standard IPM.note as well and converted to contacts. I'd like to retrieve these emails for archive purposes. Have moved all affected into a single subfolder, and have discovered that if I use MFCMAPI on that folder, I can convert each item individually from the erroneous 'IPM.Contact.TN Contacts 20250531' back to 'IPM.Note' and see the email again in its original form. Clearly can't make bulk changes with MFCMAPI so thought I'd try a VBA macro on only the subfolder that contains the affected items and loaded an amended version of one that I found on Slipstick, but can't get it to run (macros & VBA enabled and can see VBA menus etc). But it doesn't run/doesn't work, and can't see what the issue is given that message class change individually with MFCMAPI works. Is it a syntax error or something else- help gratefully received and still regretting the demise of MessageClassModifier that worked to well up to Outlook 2007:

Sub ChangeMessageClass()
Set olNS = Application.GetNamespace("MAPI")
Set ContactsFolder = Application.ActiveExplorer.CurrentFolder
Set ContactItems = ContactsFolder.Items
For Each Itm In ContactItems
If Itm.MessageClass <> "IPM.Contact.TN Contacts 20250531" Then
Itm.MessageClass = "IPM.Note"
Itm.Save
End If
Next
End Sub

Many thanks in advance!
Sorry quick update- that should of course read IPM.POST, not NOTE!! Syntax correct in VBA script...
 
Similar threads
Thread starter Title Forum Replies Date
O VBA Only works once then doesn't work Outlook VBA and Custom Forms 2
E Save Selected Email Message as .msg File - digitally sign email doesn't works Outlook VBA and Custom Forms 1
P Outlook 2013 search no longer works Using Outlook 2
KeithJB iCloud calendar sync only works one way! Using Outlook 3
V Outlook 2021 Outlook-2021 (64-bit) and iCloud-for-Windows v13.0 - It Works Good. Using Outlook 12
B Outlook 2016 Unable to view images or logos on the outlook 2016 emails the same html code works well when i use outlook 2010 Using Outlook 0
A Manually Building DisplayName <emailaddr> No Longer Works Using Outlook 0
N .StartDate & .EndDate Only Works Sometimes Outlook VBA and Custom Forms 1
U Keyboard Remapper no longer works in Outlook Using Outlook 1
S Macro using .SendUsingAccount only works the first time, after starting Outlook Outlook VBA and Custom Forms 4
R Email account works on thunderbird not Outlook Using Outlook 6
T 2 mostly identical scripts, only one works Using Outlook 16
David Michaels VB coding works in OL 2010, but not in OL 2013 Outlook VBA and Custom Forms 4
D Default Send Account that Works? Using Outlook 0
J Cached mode no longer works with NTLM authentication Exchange Server Administration 0
S my vbscript button1_click code works on appointment created but not on opening an existing apntmn Outlook VBA and Custom Forms 16
R SEARCH PEOPLE - would like one that really works Using Outlook 1
B Display of Sending Account in Outlook 2007 no longer works Using Outlook 2
S Outlook no longer works with Yahoo Mail Using Outlook 9
E Need a bit of education on how Outlook works please Using Outlook 3
P Outlook works, but freezes when trying to use calender v2007 (vista prof) Using Outlook 1
B Outlook connector only works when set to default Using Outlook.com accounts in Outlook 5
H Two accounts, Junk email filter only works on one account, office 2010, pop3 Using Outlook 5
D VBA Macro Works in 2007 but errors in 2010 Using Outlook 2
X Outlook 2010 - search works on one system but not other - identical configurat Using Outlook 2
N Filter end date works differently in OL'07/OL'10 vs OL'03? Hello?! Using Outlook 12
J Outlook Connector only works for a day?! Using Outlook.com accounts in Outlook 3
R Password not accepted but works when saved. Using Outlook 3
T Unable to edit Distribution Group membership via Outlook (works via ECP). Exchange Server Administration 7
J Unable to access public folders in Outlook 2007 on Exchange 2010. OWA PF works fine Using Outlook 7
R BCM works, but everything else stopped working BCM (Business Contact Manager) 1
D Using VBA to send Word document as body of message works in 2007, but not in 2003 Outlook VBA and Custom Forms 9
T Works in Word but not Outlook. Plz Help! Outlook VBA and Custom Forms 1
C Copy email to different folder, works in 2003 but not 2007 Outlook VBA and Custom Forms 3
B Email Autolink Works Sporadically BCM (Business Contact Manager) 2
C New version of MFCMAPI program Using Outlook 0

Similar threads

Back
Top