Dynamo 3.0 - Can't find Microsoft.Office.Interop.Outlook

Anyone know how I go about fixing this issue in Revit 25?

This might help with some of the understanding of the issue:

As @c.poupin pointed out, interop exists, but as Net Core doesn’t allow access to the GAC you can’t go about it as you did before. Exactly how to do that without access to the GAC isn’t clear, and as a rule I try not to mess with outlook on the company machine as I don’t want to accidentally email all 10923718726392183e^1021 contacts in the company directory so I won’t be of much further help.

4 Likes

I’ve been reading/ trying to fix all morning… But everything I’ve tried doesn’t work. :frowning:

I’ve tried various fixes including:

from System.Diagnostics import Process

and

webbrowser.open(mailto_link)

But keep getting >> System.Reflection.Emit << error.

ChatGPT was no help…

I have no idea how to install tkinter… and it needs to be a solution that’ll work on everyone’s pc without special installs as it’s for pop-ups across my company - currently they contain a nice little link so an outlook e-mail pops up if they want to send a message.

I could remove the links… but I’d rather not.

Why not just use a mailto link? Seems to me that using the Outlook Interop is like using a space shuttle to get to and from the corner store; sure you could, but it’d cost a lot more [time,effort,energy,brainpower] than you need to spend.

Something like this:

toEmail = "StringOfEmails,separatedByCommas"
ccEmail ="StringOfEmails,separatedByCommas"
bccEmail = "StringOfEmails,separatedByCommas"
subject = "EmailSubjectAsString"
body = "EmailBodyAsString" 
link = "mailto:{0}?cc={1}&bcc={2}&subject={3}&body={4}".format(toEmail,ccEmail,bccEmail,subject,body)`

The resulting web link should automatically open the end user’s default email application if memory serves.

1 Like

I tried some variations to no avail… but… drum roll

I’ve just got this to work (first time you get a pop up asking what you want to use and you can click on Outlook)

import webbrowser

recipient = "person@place.com"
subject = "Feedback / Suggestions"
body = "Please enter your feedback here..."
mailto_link = f"mailto:{recipient}?subject={subject}&body={body}"
webbrowser.open(mailto_link)

Just ran into a more painful issue with the pop-ups tho…
I feel a new thread coming… :melting_face:

Hmmm, just realised this is pretty useless… It’s the triggering of the event that’s the important thing.

I want to ‘click’ and then for it to run. Not automatic run!

Arrrgh!

Hi, you can use System.Activator.CreateInstance to create a new instance of the Outlook application.

Then you’ll have to deal with COM objects with PythonNet2

here’s a good example with Reflection (in C#)

another solution is to use System.Net.Mail

2 Likes

It’s not creating the instance that’s an issue now (the code above does it)… it’s the trigger event.

I want to click on a text link on a winform to trigger the event.
I don’t want outlook to just open if I run the Dynamo script.