NetOfficeFw / NetOffice

🌌 Create add-ins and automation code for Microsoft Office applications.
MIT License
697 stars 143 forks source link

How to change visibility of Outlook MailItem? #251

Open DanielKarr87 opened 5 years ago

DanielKarr87 commented 5 years ago

tl;dr-Version:

Long Message: Hello, I recently had the problem, that my Outlook Mailitem hasn't got the formatting and Signature which an Mailitem has when directly opened by Outlook itself.

After getting rid of this annoyance by using objMailItem.Display(false); the formatting was applied and the Signature was also inside the mail as requested. However, after executing this line of code, the Mailitem pops up and every Interaction, done programmatically is shown to the user which should be able to "hide" somehow. I don't find any "hide"-Function for making the Mailitem-Window invisible to the user.

For example, when sending Mails in bulk (100+ Mails to customers), feeding the program from an external application would cause 100+ popups and closes which look annoying.

Without using the objMailItem.Display(false);-Line NetOffice-OutlookAPI sends the Mail without any Window to pop up, but with no Formatting or Signature applied.

I'm searching for a Solution, which let me add Formatting from my Default Outlook Mailitem, Adding the Signature but doesn't interact with the user - it should be done silent in background.

Maybe i'm blind or doesn't know the exact term how its called what i used, hoping for someone who could help me with this problem. Or maybe i'm using it "wrong". All i need is an olMailItem with my Message but formatted in the Standard Font definition the user has applied for any other Mail and with his Signature after the Message.

Thanks in Advance, I am looking forward to a quick help and been grateful for your answers.

jozefizso commented 4 years ago

As NetOffice wraps the MS Office automation API, any calls you do are reflected in the user interface. In many cases, this behavior cannot be changed as you are effectively automating stuff which could be otherwise clicked by on the UI.