exchange 2016, outlook 2016. i have a mailbox, in this mailbox is a message with an attachment called "originalmessage.txt." if i open the mailbox in outlook, and right-click this attachment, and save it, i'm given the option to save it as msg or "all files". if i save it as msg OR as txt in c:\test\, both of the files are 1,762 KB, and both following powershell cmdlets work.
(New-Object -ComObject outlook.application).createItemFromTemplate("c:\test\originalmessage.txt")
(New-Object -ComObject outlook.application).createItemFromTemplate("c:\test\originalmessage.txt.msg")
i also have a non-microsoft pop3 client. if this client downloads the same originalmessage.txt file from the same mailbox, and saves it to c:\test, the file is only 1,684 KB. and if i make a copy of the file in c:\test and rename the copy with .msg on the end, both of the powershell cmdlets above fail with the following error:
Exception calling "CreateItemFromTemplate" with "1" argument(s): "We can't open 'C:\test\OriginalMessage.txt'. It's possible the file is already open, or you don't
have permission to open it.
i get a similar error when i rename the 1,684 KB version to originalmessage.txt.msg and double-click it. but i can double-click the 1,762 KB version of the ".msg" file, and it opens in outlook immediately.
so is it expected that the manual, human act of touching the attachment with outlook would make it 78 KB larger and make outlook powershell work? is there a way to get this to work outside of outlook? i have file transfer automation based on the non-Microsoft pop3 client, and the broken powershell is a real nuisance.