[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

VS2008 VSTO Outlook 2007 working with a in progress composed message body

Posted on 2009-05-08
2
Medium Priority
?
743 Views
Last Modified: 2013-11-10
I working on a Addin project in C#, where I've created a ribbon type Microsoft.Outlook.Mail.Compose.

The ribbon item has a dropdown that is populated from a database of surveys that are associated with a URL (stored in the dropdown item TAG property). I want to insert into the message they are composing if they click the insert button.

I can't seem to find how to do this in C# to drop the URL of the selected dropdown item TAG property contents into the message body and hopfully where the cursor is currently located (if that is possible).

The ribbon appears OK at this point and the dropdown is populated OK, now I just need to get the dropdown item TAG property value into the message body.

How do I do this?



0
Comment
Question by:WebGeeksUnlimited
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 1

Author Comment

by:WebGeeksUnlimited
ID: 24349937
After some trial and error, I figure out something that works. I also found that you can't insert where the current cursor is located unfortunately.
Referencing the ActiveInspector().CurrentItem will give you access to the open window, i my case the compose window.
 
 

                // Get a reference to the current object opened
                Microsoft.Office.Interop.Outlook.MailItem mail = (Microsoft.Office.Interop.Outlook.MailItem)new Microsoft.Office.Interop.Outlook.ApplicationClass().ActiveInspector().CurrentItem as Microsoft.Office.Interop.Outlook.MailItem;
                if (!(mail == null))
                {
                    // Insert at the begining of the message
                    mail.Body = (surveyURI.ToString() + ("\r\n" + mail.Body));
                }

Open in new window

0
 
LVL 1

Accepted Solution

by:
WebGeeksUnlimited earned 0 total points
ID: 24349961
I should mention, that surveyURI is set by the ribbondropdown selection change event elsewhere, but grabs the Tag property value.
 

private void dpnSurveys_SelectionChanged(object sender, RibbonControlEventArgs e)
        {
            selectedItemURL = dpnSurveys.SelectedItem.Tag.ToString();
        }

Open in new window

0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question