Failing to create an email with outlook interop when outlook has been opened by another user account

Hello
I have an addin that customizes the excel ribbon. I added a button so that when the user clicks it, a new outlook message windows pops up with some default information on the email body, CCs, etc.
The problem is that if outlook is already running and it's running under another user account different from the one that was used to open excel (e.g. after opening excel i open outlook with shift + right click and then "Run As..."); i get an exception upon
instantiating the outlook interop object:
Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application();
The exception message reads:
Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).
What can i do to prevent this issue from happening?
Thanks

In that situation I would test first for an existing Outlook process running and hook into it if it is running. If it's not running then I'd use new to create an Outlook session. There can only be one Outlook session running
at a time.
This sort of code will do the trick for you I think:
System.Diagnostics.Process[] processes = System.Diagnostics.Process.GetProcessesByName("OUTLOOK");
int collCount = processes.Length;
if (collCount != 0)
// Outlook already running, hook into the Outlook instance
outlookApp = Marshal.GetActiveObject("Outlook.Application")
as Outlook.Application;
An else there would create a new Outlook.Application object.
Ken Slovak
MVP - Outlook
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
"wildarmss" <=?utf-8?B?d2lsZGFybXNz?=> wrote in message
news:870d6093-a7fb-4431-a38f-1896ce4cf963...
Hello
I have an addin that customizes the excel ribbon. I added a button so that when the user clicks it, a new outlook message windows pops up with some default information on the email body, CCs, etc.
The problem is that if outlook is already running and it's running under another user account different from the one that was used to open excel (e.g. after opening excel i open outlook with shift + right click and then "Run As..."); i get an exception upon
instantiating the outlook interop object:
Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application();
The exception message reads:
Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).
What can i do to prevent this issue from happening?
Thanks
Ken Slovak MVP - Outlook

Similar Messages

  • I have Words with Friends app on iphone and game on computer.  When I try to play with Facebook friends message says" Account Already Connected.  This Facebook account has been connected to another user."  How can I play game on iphone or my pc?

    I have Words with Friends app on my iphone4S and the same game on computer.  When I try to play Words with Friends with Facebook on the iphone the  message says" Account Already Connected.  This Facebook account has been connected to another user."  It is connected to my computer. How can I play game on iphone?

    Hi Grandmaz5,
    If you are having issues connecting to Facebook on your iPad, and you have already troubleshot the Facebook app itself, you may want to check the built-in iOS settings for Facebook; you may find the following article helpful:
    iOS: Using Facebook, Twitter, and other social network accounts
    http://support.apple.com/kb/HT5500
    Regards,
    - Brenden

  • I faile to create outbound delivery with reference to scheduling agreement by using BAPI_OUTB_DELIVERY_CREATE_SLS.

    Dear Team,
    Can you please help me by providing the BAPI name for creating the outbound delivery for Scheduling Agreement in SAP SD .
    I faile to create outbound delivery with reference to scheduling agreement by using BAPI_OUTB_DELIVERY_CREATE_SLS.
    The system says "missing data in the BAPI interface: VBAK VBTYP E". It seems another FM should be used for scheduling agreement only.
    Thank you for your help in this regard .

    Hi Raghu.
    As much as I don't want to do this but just to resolve this error I created an enhancement implementation in include LV50R_CREACSV form routine dcs_check_so_vs_interface and modified VBTYP to blank to avoid that error message.
    Got the tip from this thread http://scn.sap.com/thread/1972059
    Unless... anybody has a brighter idea (without modifying the standards)?

  • Failed to create recognisable class with token

    anyone know what this error message means?
    "Failed to create recognisable class with token <num>"
    I'm running a JNI app.

    Probably something that comes from the code of the application itself.

  • Can i use a 2nd iphone if i install itunes on another user account.when i tried to create a second library i messed up both phones, the second one now has all my contacts and when it sends txts it either says its my other phone or email address

    can i use a 2nd iphone if i install itunes on another user account.when i tried to create a second library i messed up both phones, the second one now has all my contacts and when it sends txts it either says its my other phone or email address. i can cope with the first phone and getting it back on itunes but dont want to syn the 2nd phone until i know it is independant of the other one. Does it matter that both phones use the same itunes store account?

    Deleting the account on your phone only removes if from your phone.  The account and it's data remain intact and doing so will not effect your daughter's phone.
    To do this, first go to Settings>iCloud on your phone and turn any synced data (contacts, calendars, etc.) to Off, and when prompted, choose to keep the data on the phone.  When finished, scroll to the bottom and tap Delete Account.  Then set up a new iCloud account with a different Apple ID and turn any data you want to sync with iCloud (contact, calendars, etc.) back to On.  This will upload your data to your new iCloud account.

  • Automatic email with logon details when user creation

    Hi,
    Does any one can through some light on sending automatic emails with logon details when the users created with SU01? I know we have lot of tools like GRC, Approva we can do but I would like to know any thing within SAP not with any external tools.
    Thanks,
    Venkat

    Quick and easy way without any development:
    a)  Create a variant for report RSUSR100N to search for created user IDs where the creator was not equal to the expected "false positive" ones.
    b) Save a dynamic date and time calculation for the variant.
    c) Define a mail distribution list for the spool request if there is one ...
    d) Schedule the variant periodically as per the dynamic date and time period.
    e) Check that SCOT is configured to send the mail or SMS.
    f) Wait for the mail to be sent (this step might take some time...)
    Cheers,
    Julius

  • PDF is changing all my pdf documents into a word document - My boss sent me a pdf email through outlook and when I try to open it changes to a word document

    PDF is changing all my pdf documents into a word document - My boss sent me a pdf email through outlook and when I try to open it changes to a word document Help this is so frustrating

    Hi tinam74565130,
    That does sound frustrating! It sounds as though the filename associations have become confused on your computer. You should be able to reset that easily. Here are some instructions:
    Change which programs Windows uses by default - Windows Help
    How to change the default application for a file type | Macworld
    Please let us know how it goes.
    Best,
    Sara

  • HT1146 microsoft Outlook for MAC, how can I set "receive notification email sent has been opened and read" in Outlook?  Thanks

    Microsoft Office for MAC, how does the sender select a notification that an email has been opened and read in Outlook?  Thanks

    Since this question is about a Microsoft product, you might have more luck getting suggestions if you ask in Microsoft's own forums.
    Regards.

  • I'VE CREATED A FORM WITH IMAGES. WHEN I OPEN THE FILE IN ACROBAT READER, THE IMAGES ARE BALCK BOXES!

    I'VE CREATED A FORM WITH IMAGES. WHEN I OPEN THE FILE IN ACROBAT READER THE IMAGES ARE BLACK BOXES.
    THE FORM HAs (extend features to acrobat reader). THE FORM WAS DISTRIBUTED.
    NON OF MY EMPOYEES CAN SEE THE IMAGES. WHAT'S WRONG? CAN YOU HELP?

    However, the view large images is an issue for a form that is being distributed. Either a note needs to be added to the PDF to tell how to enable the view or the images need to be changed so that the enabling is not needed.

  • Imctrying to activate my ipad. it wants me to sign in with the original apple id used to set it up. i do not know the password to the apple id and also the email used to set it up has been deactivated. can anyone help???

    I'm trying to activate my 2nd generation apple iPad. It wants me to sign in with the original apple id used to set it up. I no longer use it and don't know the password to the apple id. Also, the email used to set it up has been deactivated. Can anyone help???

    If you are trying to activate an iPad or iPhone and it is asking for a previous owners Apple ID and password, you have encountered the Activation Lock. This is a security feature that prevents thieves from setting up and using a stolen or lost iPad or iPhone. You have no alternative. You must contact the previous owner to get permission to use the device. If you cannot contact the previous owner return the device to where you bought it and get a refund. You will never be able to activate the device and no one can help you do it.
    If the Apple ID that was used on the iPad was yours originally you should be able to recover your password here:
    https://iforgot.apple.com/password/verify/appleid

  • When sending email message appears "sending the message failed because you exceeded your sending limit. A copy has been placed in you outbox"

    When sending email message appears "sending the message failed because you exceeded your sending limit.  A copy has been placed in your outbox"

    Who's the provider? Do they have a limit?
    https://discussions.apple.com/message/22929931#22929931

  • Hi, what do i do if I receive an email with link but when I click the link my mail stop moving...

    hi what can i do if i receive an email with link but when I click the link my mail wont move anymore?

    Close the Mail app in the Task Bar and re-launch.
    Double-click the Home button to reveal Task Bar. Hold Mail app down for a second or two; tap the minus sign to close app.
    If it still doesn't work, try a reset.
    Hold the Sleep and Home button down until you see the Apple logo.

  • ITunes settings reset with every new version, and I get: "...the information on the iphone is synced with another user account"

    Windows 7 64-bit with MS Outlook 2010. I've seen this now probably 10 times. When I first installed iTunes, I selected:
    Preferences -> Devices -> "Prevent iPhonse, iPhones and iPads from syncing automatically".
    and on my iPhone, I selected:
    Info -> Sync Contacts with: Outlook.
    Info -> Sync Calendars with: Outlook
    Info -> Other -> Sync notes with: Outlook
    This works great, and the settings stick.  As soon as apple releases any new version (even minor) of iTunes and I install, I immediately receive: "...the information on the iphone is synced with another user account", and have to merge my calendar and contacts, but then once I get into iTunes, I find that ALL of the above settings (prevent syncing, sync calendar, contacts, notes) get reset and are turned off! I am running as a user account with Admin privaleges, but I don't right-click -> "Run as administrator" when I perform the iTunes update.
    To reiterate, once I change the settings back, things work normally until the next iTunes update at which it gives me that sync error, and resets my sync options.
    Any idea? Thanks!
    -Brian

    Is someone else using the PC and iTunes?
    Create another user for the PC with your name, and try syncing that way.
    This way it wont conflic with the other user.

  • Always used 1 main account.  Started using individual user accounts. So how do I use software or applications with a lot of data like Quicken under my own user account?

    I recently upgraded our family's mac to OS X.  I thought this was the perfect time to create and use "user accounts".  We had always used 1 main account.  So how do I use software or applications with a lot of data like Quicken under my own user account?  I wanted to be able to manage my own itunes library, iphone apps, messages.  But I still really need to use the Stuff I have in Quicken essentials.  I don't want to have to restart all my work done in Quicken already.

    I haven't used Quicken in a while, but most applications store your files in your Documents folder. Is that where your Quicken data file is? What you do next depends on how many family members need to get at that data.
    If multiple family members need to use the Quicken data file, try moving it to the Documents folder in the Shared account. That is an account that all accounts can see. It's at the same level as the other accounts. In other words, Shared is one level up from your Home account, or Hard Drive/Users/Shared.
    If you're the only one allowed to see that Quicken data, move the Quicken data file from the old main account to your account, and don't leave a copy behind. You can use the Shared folder as a way station for the transfer since you won't be able to see both accounts' Documents folders at the same time (because you're not allowed to peek into other people's accounts). Or you can use another disk or server for the transfer, as long as you can get to it when logged into either account.

  • Can I share apps with another user account on our mac even though its a different apple ID?

    Husband and I have just bought a new Mac to share, but we've both got iphones and itunes of our own.  I thought the best way to deal with this would be to have a user account each on the new Mac with our own iTunes, but this obviously means that each user account has a different apple ID associated with it.  I've just bought Pages, Numbers and Keynote on my user account, is it going to be possible to share these apps with my husbands user account.
    I've got a harrible feeling that I should have created a joint user account and apple ID, and I've just wasted the best part of £40...please tell me theres a way to fix this!!
    Thanks

    Welcome to the Apple Support Communities
    You can, but you will have to update the applications from the user account with the Apple ID you used to purchase those apps. There isn't any other problem, but it may be illegal (but I think it's legal if you run them on the same Mac)

Maybe you are looking for

  • Problem with Require Client Certificate on on IPlanet 6.0 server

    I installed client certificate. When I connect to the server using browser, I get following error........ You are not authorized to view this page You might not have permission to view this directory or page using the credentials you supplied. How ca

  • What is the best way to put links in an image?

    I have created an image with multiple layers and many of the layers are the text I would like to use as links. When I sliced up the image using layer based slices, the end result was a degraded image. The page I am working on with the slice marks aff

  • GME PLLs, forms and java class files???

    Hi, if we generate forms of GME from adadmin PLLs will also get generated but how to compile java class files of a product GME ? simply we need to create jar files? Regards

  • Metadata and elements 7

    I have elements 7. Is there a way from keeping my metadata from uploading onto my photoshop website?  I copy my elements jpeg into a windows file, then upload to the website. Is there a way to take off the metadata once it has been uploaded to the we

  • How to repeat rows based on column value

    Hi all, I have a query that gives me a result with a column value for example 4. I now want to repeat this row 4 times with a new column that calculated from 1 - 4. Or when column value is 3 I want to repeat row 3 times with new column name 1-3 Can a