Posts 1 - 10 of 14
First | Prev. | 1 2 | Next | Last
|
|
Omkar Deshpande
Guest
|
Hi Andrei,
We have requirement for which I have added a new button "Send custom". This button is visible on top of the compose window of inlineresponse opening in reading pane.
On this button click event, I want to add few MAPI properties to the mail and want to call Send method on this mail item.
I tried using "ActiveInlineResponse" to get the mailitem but using this mailitem I can not call "Send" method(As per MSDN). Is there any other way to to get mail item on which I can add MAPI properties and also call send method.
Thanks,
Omkar |
|
Posted 08 Apr, 2020 06:04:32
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18794
Joined: 2006-05-11
|
Hello Omkar,
Omkar Deshpande writes:
On this button click event,
In the Click event of that button, call ADXAddinModule.SendMessage() passing it a unique message; message being an integer >1024. This is all with that event handler. Now you handle the add-in module's OnSendMessage event: filter out your message. When the message is received, you get Explorer.ActiveInlineResponse - this returns an Outlook.MailItem which cannot be sent. You save that mailitem, retrieve its MailItem.EntryId, and close the inline response by calling Explorer.ClearSelection(). Then you use the EntryId previously stored to get the mail item anew: call Namespace.GetItemFromId(). This returns a Mailitem which can be sent: modify it as required and send.
Andrei Smolin
Add-in Express Team Leader |
|
Posted 08 Apr, 2020 07:53:52
|
|
Top
|
|
Omkar Deshpande
Guest
|
Hi Andrei,
Thanks for the reply. I tried the way you have mentioned in your reply but I am still getting exception for Send call as this method is not allowed for inlinereply. Please see my code snippet below and let me know if anything is wrong:
private void AddinModule_OnSendMessage(object sender, ADXSendMessageEventArgs e)
{
if (e.Message == 1760)
{
var explorer = TooltipTiker.AddinModule.CurrentInstance.OutlookApp.ActiveExplorer();
var inlineRes = explorer.GetType()
.InvokeMember("ActiveInlineResponse"
, System.Reflection.BindingFlags.GetProperty
| System.Reflection.BindingFlags.Instance
| System.Reflection.BindingFlags.Public
, null
, explorer
, null) as Outlook._MailItem;
if (inlineRes != null)
{
inlineRes.Save();
string entryid = inlineRes.EntryID;
explorer.GetType()
.InvokeMember("ClearSelection"
, System.Reflection.BindingFlags.InvokeMethod
| System.Reflection.BindingFlags.Public
, null
, explorer
, null);
Marshal.ReleaseComObject(inlineRes);
//If I use below 2 commented lines then too I get same exception
// Outlook.NameSpace myNM = TooltipTiker.AddinModule.CurrentInstance.OutlookApp.GetNamespace("MAPI");
// var myMail = myNM.GetItemFromID(entryid) as Outlook._MailItem;
var myMail = TooltipTiker.AddinModule.CurrentInstance.OutlookApp.ActiveExplorer().Session.GetItemFromID(entryid) as Outlook._MailItem;
myMail.Subject = "[Custom]: "+myMail.Subject;
myMail.Send();
}
}
} |
|
Posted 09 Apr, 2020 04:23:45
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18794
Joined: 2006-05-11
|
Hello Omkar,
I don't see a way to send that mail item. I've tried sending another message once the email is saved and the entryId is obtained. Also, I've tried calling MailItem.Display and call MailItem.Send once the inspector window activates. In all cases, I get the same error message.
I suggest that the user sends the email and your add-in modifies the email in the ItemSend event.
Andrei Smolin
Add-in Express Team Leader |
|
Posted 09 Apr, 2020 06:36:04
|
|
Top
|
|
Omkar Deshpande
Guest
|
Hi Andrei,
Thanks for trying out things for me. Actually it's our requirement to have custom send button. When user clicks on our button, only in that case mail will be modified and then Send method will be called(similar functionality is present in our another COM based add-in where button added in ribbon but it works only for Inspector window). In normal Send button click, we wont be doing anything with the mail.
I will keep searching for the solution. If you get any other idea please let me know.
Thanks,
Omkar |
|
Posted 10 Apr, 2020 05:00:43
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18794
Joined: 2006-05-11
|
Hello Omkar,
Yes, will let you know if I have an idea.
Andrei Smolin
Add-in Express Team Leader |
|
Posted 13 Apr, 2020 01:33:52
|
|
Top
|
|
Omkar Deshpande
Guest
|
|
Posted 16 Apr, 2020 00:24:48
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18794
Joined: 2006-05-11
|
Wow! Just great!
On the other hand, this is sad: Outlook (and Office) programming is a collection of special cases, workarounds and hacks.
Andrei Smolin
Add-in Express Team Leader |
|
Posted 16 Apr, 2020 02:08:57
|
|
Top
|
|
Omkar Deshpande
Guest
|
Hi Andrei,
I have one more question related to look and feel of my new button. I want this button to have look and feel/theme(and similar UI effects of hover over, click etc.) of the Send and other buttons of ActiveInlineResponse window. Is there any way to achieve that.
Also I want to use icon used for Send button on my new new button, so I used one of your post https://www.add-in-express.com/forum/read.php?FID=5&TID=14403 but what I observed is the images created using this solution looks toned downed and also black color becomes grey etc. Is it expected with this code? Is there any better way to do it?
Thanks,
Omkar |
|
Posted 17 Apr, 2020 04:34:35
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18794
Joined: 2006-05-11
|
|
Posted 20 Apr, 2020 05:08:11
|
|
Top
|
|
Posts 1 - 10 of 14
First | Prev. | 1 2 | Next | Last
|