SOLVED

SOLVED - Disable Junk Folder

%3CLINGO-SUB%20id%3D%22lingo-sub-3281531%22%20slang%3D%22en-US%22%3ESOLVED%20-%20Disable%20Junk%20Folder%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3281531%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BI%20had%20a%20persisting%20issue%20of%20important%20E-mails%20going%20into%20my%20junk%20folder%2C%20under%20my%20nose%2C%20causing%20a%20couple%20instances%20of%20trouble%20at%20my%20job.%20I%20turned%20off%20automatic%20filtering%20but%20it%20made%20absolutely%20no%20difference.%20The%20lowest%20level%20of%20auto%20filtering%20stated%20it%20would%20still%20send%20blocked%20senders%20to%20my%20junk%20folder%20but%20I%20have%20very%20few%20senders%20that%20are%20blocked%20and%20the%20E-mails%20that%20Outlook%20would%20send%20to%20junk%20were%20from%20people%20at%20work%20who%20had%20never%20E-mailed%20me%20before.%3C%2FP%3E%3CP%3E%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ProofOfDisabled.JPG%22%20style%3D%22width%3A%20497px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F362863iFFF108622378BE7E%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22ProofOfDisabled.JPG%22%20alt%3D%22ProofOfDisabled.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EOf%20course%2C%20there%20is%20always%20a%20need%20for%20junk%20folders.%20We%20all%20know%20those%20pesky%20insurance%20companies%20that%20you%20got%20a%20quote%20from%20once%20then%20using%20their%20unsubscribe%20is%20seemingly%20vain.%20My%20spam%20folder%20has%20and%20is%20always%20just%20the%20domains%20I%20listed%20to%20go%20to%20it%2C%20and%20nothing%20else%20-%20has%20never%20given%20me%20issues%2C%20unlike%20junk.%20So%2C%20I%20researched%20a%20fix%20to%20this%20issue%20to%20no%20avail.%20I%20then%20tried%20to%20delete%20or%20disable%20the%20junk%20folder%20but%20it%20is%20a%20default%20folder%20of%20Outlook%2C%20so%20not%20possible.%20So%2C%20I%20looked%20into%20VBA%20and%20came%20up%20with%20code%20from%20researching%20varying%20sources.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20what%20I%20came%20up%20with%2C%20posted%20for%20anyone%20else%20that%20may%20have%20this%20issue.%20If%20there%20is%20an%20easier%20way%20and%2For%20suggestions%20to%20improve%20the%20code%20further%2C%20please%20let%20me%20know.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-visual-basic%22%3E%3CCODE%3EPrivate%20Sub%20Application_ItemLoad(ByVal%20Item%20As%20Object)%0ACall%20Disable_JunkFolder%0A'Note%3A%20This%20sub%20will%20run%20on%20application%20startup.%0AEnd%20Sub%0ASub%20Disable_JunkFolder()%0A%0A'''ENABLE%20THIS%20CODE%3A%0A'Click%20the%20File%20tab%20%26gt%3B%20Options%20%26gt%3B%20Trust%20Center%20%26gt%3B%20Trust%20Center%20Settings%20%26gt%3B%20Macro%20Settings%20%26gt%3B%20select%20_%0A%22Enable%20all%20macros%22%20%26gt%3B%20OK%20%26gt%3B%20OK%0A%0A'''APPLY%20THIS%20CODE%3A%0A'Click%20the%20File%20tab%20%26gt%3B%20Options%20%26gt%3B%20Customize%20Ribbon%20%26gt%3B%20Under%20%22Customize%20the%20Classic%20Ribbon%22%20and%20under%20%22Main%20Tabs%22%2C%20_%0Aselect%20the%20%22Developer%22%20check%20box%20%26gt%3B%20OK%20%26gt%3B%20click%20the%20Developer%20tab%20%26gt%3B%20Visual%20Basic%20%26gt%3B%20select%20%22ThisOutlookSession%22%20%26gt%3B%20_%0Apaste%20all%20this%20code%20%26gt%3B%20at%20the%20top%20left%20of%20the%20code%20window%2C%20click%20the%20%22Save%20VbaProject.OTM%22%20button%20(Ctrl%2BS)%0A%0A'''DISABLE%20THIS%20CODE%3A%0A'Remove%20single%20quotation%20mark%20in%20front%20of%20%22Exit%20Sub%22%20(add%20symbol%20back%20to%20re-enable)%20or%20permanently%20delete%20all%20_%0Athis%20code%20then%20save.%0A%0A'Exit%20Sub%0ADim%20Folder_Inbox%20As%20Outlook.Folder%0ADim%20Folder_Junk%20As%20Outlook.Folder%0ADim%20Outlook_EmailAccount%20As%20Outlook.Store%0ADim%20Notification_Item_All%20As%20String%2C%20Notification_Acc%20As%20String%2C%20Noted_Acc_Count%20As%20Integer%0ANotification_Item_All%20%3D%20%22Recovered%20the%20E-mail(s)%3A%20%22%22%22%0ANoted_Acc_Count%20%3D%200%0AOn%20Error%20Resume%20Next%0A%20%20%20%20For%20Each%20Outlook_EmailAccount%20In%20Application.Session.Stores%0A%20%20%20%20Set%20Folder_Inbox%20%3D%20Outlook_EmailAccount.GetDefaultFolder(olFolderInbox)%0A%20%20%20%20Set%20Folder_Junk%20%3D%20Outlook_EmailAccount.GetDefaultFolder(olFolderJunk)%0A%20%20%20%20%20%20%20%20While%20InStr(Folder_Junk%2C%20%22Spam%22)%20%3D%20False%20And%20Folder_Junk.Items.Count%20%26lt%3B%26gt%3B%200%0A%20%20%20%20%20%20%20%20'While%20InStr(Folder_Junk%2C%20%22Junk%22)%20And%20Folder_Junk.Items.Count%20%26lt%3B%26gt%3B%200%20'(Can%20be%20used%20instead)%0A%20%20%20%20%20%20%20%20%20%20%20%20For%20Each%20Item%20In%20Folder_Junk.Items%0A%20%20%20%20%20%20%20%20%20%20%20%20If%20Notification_Item_All%20%3D%20%22Recovered%20the%20E-mail(s)%3A%20%22%22%22%20Then%0A%20%20%20%20%20%20%20%20%20%20%20%20Notification_Item_All%20%3D%20Notification_Item_All%20%26amp%3B%20Item.Subject%20%26amp%3B%20%22%22%22%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Else%3A%20Notification_Item_All%20%3D%20Notification_Item_All%20%26amp%3B%20%22%2C%20%22%22%22%20%26amp%3B%20Item.Subject%20%26amp%3B%20%22%22%22%22%0A%20%20%20%20%20%20%20%20%20%20%20%20End%20If%0A%20%20%20%20%20%20%20%20%20%20%20%20If%20InStr(Notification_Acc%2C%20Outlook_EmailAccount)%20%3D%20False%20Then%0A%20%20%20%20%20%20%20%20%20%20%20%20If%20Noted_Acc_Count%20%3D%200%20Then%0A%20%20%20%20%20%20%20%20%20%20%20%20Noted_Acc_Count%20%3D%20Noted_Acc_Count%20%2B%201%3A%20Notification_Acc%20%3D%20Outlook_EmailAccount%0A%20%20%20%20%20%20%20%20%20%20%20%20Else%3A%20Notification_Acc%20%3D%20Notification_Acc%20%26amp%3B%20%22%2C%20%22%20%26amp%3B%20Outlook_EmailAccount%0A%20%20%20%20%20%20%20%20%20%20%20%20End%20If%3A%20End%20If%0A%20%20%20%20%20%20%20%20%20%20%20%20Item.Move%20Folder_Inbox%0A%20%20%20%20%20%20%20%20%20%20%20%20Next%0A%20%20%20%20%20%20%20%20Wend%0A%20%20%20%20Next%0AIf%20Notification_Item_All%20%26lt%3B%26gt%3B%20%22Recovered%20the%20E-mail(s)%3A%20%22%22%22%20Then%0ANotification_Item_All%20%3D%20Notification_Item_All%20%26amp%3B%20%22%20from%20the%20junk%20folder%20in%3A%20%22%20%26amp%3B%20Notification_Acc%0AMsgBox%20Notification_Item_All%2C%20vbInformation%2C%20%22Microsoft%20Outlook%20-%20E-mail%20Recovery%22%3A%20End%20If%20'(Can%20disable%20this%20MsgBox%20with%20single%20quotation%20mark)%0A%0A'Note%3A%20This%20code%20does%20not%20include%20any%20spam%20folder.%0A'Note%3A%20This%20code%20applies%20to%20all%20associated%20accounts%20saved%20within%20the%20Outlook%20Application.%0A%0A'''Code%20credit%3A%0A'Kenneth%20Nelson%0A'https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Foutlook%2Fsolved-disable-junk-folder%2Fm-p%2F3281531%0A%0A'''Original%20code%20credits%3A%0A'https%3A%2F%2Fstackoverflow.com%2Fquestions%2F47992801%2Fvba-move-mail-from-junk-to-inbox%0A'https%3A%2F%2Fstackoverflow.com%2Fquestions%2F38191434%2Fswitching-between-accounts-then-looping-through-email%0A'https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Foffice%2Fvba%2Fapi%2Foutlook.oldefaultfolders%0A'https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Foffice%2Fvba%2Fapi%2Foutlook.mailitem.subject%0A%0AEnd%20Sub%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3281531%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOutlook%20for%20Windows%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3286480%22%20slang%3D%22en-US%22%3ERe%3A%20SOLVED%20-%20Disable%20Junk%20Folder%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3286480%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F100937%22%20target%3D%22_blank%22%3E%40Victor%20Ivanidze%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20post.%20I%20investigated%20and%20attempted%20your%20reply.%20I%20did%20have%20an%20issue.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22PowerAutomate_Issue.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F364431i4FC0471AF98926DD%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22PowerAutomate_Issue.png%22%20alt%3D%22PowerAutomate_Issue.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EThis%20is%20because%20Power%20Automate%20is%20not%20included%20in%20my%20main%20Office%20365%20account.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EPlease%20read%3A%3C%2FSTRONG%3E%20But%2C%20I%20tested%20it%20with%20my%20licensed%20college%20outlook%20account%2C%20and%20I%20did%20not%20experience%20this%20issue.%20Furthermore%2C%20while%20signed%20into%20my%20college%20account%2C%26nbsp%3Boddly%20I%20was%20able%20to%20connect%20my%20college%20account%20to%20the%20Office%20365%20Connector%20and%20my%20main%20account%20to%20the%20Outlook.com%20Connector%2C%20with%20no%20other%20way%20to%20configure%20each%20account%2Fconnector.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%2C%20the%20%22When%20a%20new%20email%20arrives%20(V3)%22%20action%20only%20worked%20with%20my%20college%20account%20and%20the%20%22...%20(V2)%22%20action's%20only%20option%20was%20my%20main%20account.%20Was%20really%20strange.%20%3CU%3EIt%20seems%20that%20Power%20Automate%20only%20works%20with%20the%20account%20signed%20into%20it%2C%20or%20is%20otherwise%20ambiguous.%3C%2FU%3E%26nbsp%3BRegardless%2C%20out%20of%20principle%20to%20whomever%20is%20reading%20this%20seeking%20a%20solution%20to%20their%20problem%2C%20please%20consider%20this%20simple%20list%20of%20pros%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3EMy%20code's%20pros%3A%26nbsp%3B%3C%2FEM%3E%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%3CEM%3EPower%20Automate's%20pros%3A%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CEM%3E-%20Message%20with%20details%2C%20if%20desired%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B-%20User-friendly%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CEM%3E-%20Applies%20to%20all%20the%20App's%20associated%20accounts%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B-%20Simple%20to%20use%20and%20understand%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CEM%3E-%20More%20customizable%20to%20the%20user's%20specific%20needs%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20-%20Applies%20to%20all%20the%20user's%20associated%20devices%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EConcluding%20this%20attempt%2C%20unfortunately%2C%20%3CU%3Ethis%20method%20did%20not%20help%20me.%20However%3C%2FU%3E%2C%20this%20is%20a%20FAR%20better%20solution%20than%20my%20code%20for%20the%20average%20Office%20tools%20user%2C%20being%20that%20Power%20Automate%20can%20manage%20at%20the%20server%20level%20(cloud%20flow)%2C%20which%20will%20apply%20the%20junk%20folder%20action%20to%20all%20devices!%20Thank%20you!%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3285512%22%20slang%3D%22en-US%22%3ERe%3A%20SOLVED%20-%20Disable%20Junk%20Folder%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3285512%22%20slang%3D%22en-US%22%3E%3CP%3EJust%20change%20the%20trigger%20and%20the%20action%20to%20the%20same%20ones%20from%20the%20%22Office%20365%20Outlook%22%20connector.%3CBR%20%2F%3E%3CSTRIKE%3EI'll%20publish%20the%20version%20of%20%22FromJunkToInbox%22%20for%20Outlook%20365%20next%20week.%3C%2FSTRIKE%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3ESee%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fwww.ivasoft.com%2Ffromjunktoinboxflow365.shtml%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.ivasoft.com%2Ffromjunktoinboxflow365.shtml%3C%2FA%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3284944%22%20slang%3D%22en-US%22%3ERe%3A%20SOLVED%20-%20Disable%20Junk%20Folder%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3284944%22%20slang%3D%22en-US%22%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F39903%22%20target%3D%22_blank%22%3E%40Victor%20Ivanidze%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EHow%20would%20I%20apply%20this%20flow%20to%20Outlook%20365%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3284202%22%20slang%3D%22en-US%22%3ERe%3A%20SOLVED%20-%20Disable%20Junk%20Folder%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3284202%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1140325%22%20target%3D%22_blank%22%3E%40Kendethar%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eyou%20can%20easily%20adopt%20this%20flow%20for%20Outlook%20365.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3283568%22%20slang%3D%22en-US%22%3ERe%3A%20SOLVED%20-%20Disable%20Junk%20Folder%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3283568%22%20slang%3D%22en-US%22%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F39903%22%20target%3D%22_blank%22%3E%40Victor%20Ivanidze%3C%2FA%3E%3CBR%20%2F%3EI%20do%20not%20believe%20this%20will%20apply%20to%20any%20associated%20Outlook%20accounts%20other%20than%20Outlook.com.%20And%2C%20I%20use%20Outlook%20365.%20But%2C%20a%20great%20solution%20for%20Outlook.com%20users!%20Thanks.%20%3A)%3C%2Fimg%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3283023%22%20slang%3D%22en-US%22%3ERe%3A%20SOLVED%20-%20Disable%20Junk%20Folder%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3283023%22%20slang%3D%22en-US%22%3EHave%20a%20look%20at%20this%3A%20%3CA%20href%3D%22https%3A%2F%2Fwww.ivasoft.com%2Ffromjunktoinboxflow.shtml%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.ivasoft.com%2Ffromjunktoinboxflow.shtml%3C%2FA%3E%3C%2FLINGO-BODY%3E
Contributor

Hello,

 

     I had a persisting issue of important E-mails going into my junk folder, under my nose, causing a couple instances of trouble at my job. I turned off automatic filtering but it made absolutely no difference. The lowest level of auto filtering stated it would still send blocked senders to my junk folder but I have very few senders that are blocked and the E-mails that Outlook would send to junk were from people at work who had never E-mailed me before.

 ProofOfDisabled.JPG

Of course, there is always a need for junk folders. We all know those pesky insurance companies that you got a quote from once then using their unsubscribe is seemingly vain. My spam folder has and is always just the domains I listed to go to it, and nothing else - has never given me issues, unlike junk. So, I researched a fix to this issue to no avail. I then tried to delete or disable the junk folder but it is a default folder of Outlook, so not possible. So, I looked into VBA and came up with code from researching varying sources.

 

This is what I came up with, posted for anyone else that may have this issue. If there is an easier way and/or suggestions to improve the code further, please let me know.  

Private Sub Application_ItemLoad(ByVal Item As Object)
Call Disable_JunkFolder
'Note: This sub will run on application startup.
End Sub
Sub Disable_JunkFolder()

'''ENABLE THIS CODE:
'Click the File tab > Options > Trust Center > Trust Center Settings > Macro Settings > select _
"Enable all macros" > OK > OK

'''APPLY THIS CODE:
'Click the File tab > Options > Customize Ribbon > Under "Customize the Classic Ribbon" and under "Main Tabs", _
select the "Developer" check box > OK > click the Developer tab > Visual Basic > select "ThisOutlookSession" > _
paste all this code > at the top left of the code window, click the "Save VbaProject.OTM" button (Ctrl+S)

'''DISABLE THIS CODE:
'Remove single quotation mark in front of "Exit Sub" (add symbol back to re-enable) or permanently delete all _
this code then save.

'Exit Sub
Dim Folder_Inbox As Outlook.Folder
Dim Folder_Junk As Outlook.Folder
Dim Outlook_EmailAccount As Outlook.Store
Dim Notification_Item_All As String, Notification_Acc As String, Noted_Acc_Count As Integer
Notification_Item_All = "Recovered the E-mail(s): """
Noted_Acc_Count = 0
On Error Resume Next
    For Each Outlook_EmailAccount In Application.Session.Stores
    Set Folder_Inbox = Outlook_EmailAccount.GetDefaultFolder(olFolderInbox)
    Set Folder_Junk = Outlook_EmailAccount.GetDefaultFolder(olFolderJunk)
        While InStr(Folder_Junk, "Spam") = False And Folder_Junk.Items.Count <> 0
        'While InStr(Folder_Junk, "Junk") And Folder_Junk.Items.Count <> 0 '(Can be used instead)
            For Each Item In Folder_Junk.Items
            If Notification_Item_All = "Recovered the E-mail(s): """ Then
            Notification_Item_All = Notification_Item_All & Item.Subject & """"
            Else: Notification_Item_All = Notification_Item_All & ", """ & Item.Subject & """"
            End If
            If InStr(Notification_Acc, Outlook_EmailAccount) = False Then
            If Noted_Acc_Count = 0 Then
            Noted_Acc_Count = Noted_Acc_Count + 1: Notification_Acc = Outlook_EmailAccount
            Else: Notification_Acc = Notification_Acc & ", " & Outlook_EmailAccount
            End If: End If
            Item.Move Folder_Inbox
            Next
        Wend
    Next
If Notification_Item_All <> "Recovered the E-mail(s): """ Then
Notification_Item_All = Notification_Item_All & " from the junk folder in: " & Notification_Acc
MsgBox Notification_Item_All, vbInformation, "Microsoft Outlook - E-mail Recovery": End If '(Can disable this MsgBox with single quotation mark)

'Note: This code does not include any spam folder.
'Note: This code applies to all associated accounts saved within the Outlook Application.

'''Code credit:
'Kenneth Nelson
'https://techcommunity.microsoft.com/t5/outlook/solved-disable-junk-folder/m-p/3281531

'''Original code credits:
'https://stackoverflow.com/questions/47992801/vba-move-mail-from-junk-to-inbox
'https://stackoverflow.com/questions/38191434/switching-between-accounts-then-looping-through-email
'https://docs.microsoft.com/en-us/office/vba/api/outlook.oldefaultfolders
'https://docs.microsoft.com/en-us/office/vba/api/outlook.mailitem.subject

End Sub

 

 

6 Replies
@Victor Ivanidze
I do not believe this will apply to any associated Outlook accounts other than Outlook.com. And, I use Outlook 365. But, a great solution for Outlook.com users! Thanks. :)

Hi @Kendethar,

 

you can easily adopt this flow for Outlook 365. 

@Victor Ivanidze

How would I apply this flow to Outlook 365?
best response confirmed by Kendethar (Contributor)
Solution

Just change the trigger and the action to the same ones from the "Office 365 Outlook" connector.
I'll publish the version of "FromJunkToInbox" for Outlook 365 next week.

See https://www.ivasoft.com/fromjunktoinboxflow365.shtml

 

@Victor Ivanidze 

 

Thank you for your post. I investigated and attempted your reply. I did have an issue.

PowerAutomate_Issue.png

This is because Power Automate is not included in my main Office 365 account.

 

Please read: But, I tested it with my licensed college outlook account, and I did not experience this issue. Furthermore, while signed into my college account, oddly I was able to connect my college account to the Office 365 Connector and my main account to the Outlook.com Connector, with no other way to configure each account/connector.

 

So, the "When a new email arrives (V3)" action only worked with my college account and the "... (V2)" action's only option was my main account. Was really strange. It seems that Power Automate only works with the account signed into it, or is otherwise ambiguous. Regardless, out of principle to whomever is reading this seeking a solution to their problem, please consider this simple list of pros:

 

 

 

My code's pros:                                                          Power Automate's pros:

- Message with details, if desired                               - User-friendly

- Applies to all the App's associated accounts           - Simple to use and understand

- More customizable to the user's specific needs      - Applies to all the user's associated devices

 

 

 

Concluding this attempt, unfortunately, this method did not help me. However, this is a FAR better solution than my code for the average Office tools user, being that Power Automate can manage at the server level (cloud flow), which will apply the junk folder action to all devices! Thank you!