send mail from task pane word

Add-in Express™ Support Service
That's what is more important than anything else

send mail from task pane word
 
zipi sompo




Posts: 125
Joined: 2013-09-03
Hi,
I have a custom task pane in word.
I want to click on button and open the outlook for sending mail with the document attached.
I try:

Document doc = AddinModule.CurrentInstance.WordApp.ActiveDocument;
doc.Activate();
doc.SendMail();

its ok, open outlook with these word attached.
but I want to set the address mail and subject mail before - via the code.
Is it possible?
Thanks in advance!
Posted 18 Mar, 2015 07:26:03 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Zipi,

Please have a look at the Document.SendForReview method, see https://msdn.microsoft.com/en-us/library/office/ff193054.aspx.


Andrei Smolin
Add-in Express Team Leader
Posted 18 Mar, 2015 08:21:33 Top
zipi sompo




Posts: 125
Joined: 2013-09-03
I use AddinModule.CurrentInstance.WordApp.ActiveDocument and it return object of Word.Document interface
does you mean that I convert it to Microsoft.Office.Interop.Word.Document?
like:

 Document doc = AddinModule.CurrentInstance.WordApp.ActiveDocument;
 Microsoft.Office.Interop.Word.Document do2c = (Microsoft.Office.Interop.Word.Document)doc;
 do2c.SendForReview(oMissing1, "zipi", true, true);


Another thing,
can I attach to the mail these doc as Pdf?

Thanks a lot!!
Posted 19 Mar, 2015 01:46:04 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Zipi,

Word lets you create a PDF file using Document.ExportAsFixedformat (https://msdn.microsoft.com/en-us/library/office/ff840962%28v=office.15%29.aspx). You can try using Document.MailEnvelop (https://msdn.microsoft.com/en-us/library/office/ff840465%28v=office.15%29.aspx). This property returns an Office.MsoEnvelop which lets you deal with the Outlook item, see example at https://msdn.microsoft.com/en-us/library/office/ff862112%28v=office.15%29.aspx.


Andrei Smolin
Add-in Express Team Leader
Posted 19 Mar, 2015 06:26:01 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Sorry, I've missed this question:

zipi sompo writes:
I use AddinModule.CurrentInstance.WordApp.ActiveDocument and it return object of Word.Document interface does you mean that I convert it to Microsoft.Office.Interop.Word.Document?


Unless you use interops for different Word versions, Word.Document should be Microsoft.Office.Interop.Word.Document; check if there's using Word = Microsoft.Office.Interop.Word in this file. If this isn't the case, you can cast Word.Document to Microsoft.Office.Interop.Word.Document.


Andrei Smolin
Add-in Express Team Leader
Posted 19 Mar, 2015 06:53:29 Top