Getting/Creating an Outlook Application in Windows 7
It is true that if you are running a standalone application from Visual Studio or debugging from Visual Studio which use office products, you should be having same access level for both (Visual Studio and Office Products) and that is one of the reasons why this issue occurs but I am seeing online that so many people have this issue while initializing outlook object in a service. I hope what resolved the issue for me would help others too. Please follow along the steps.
Go to command prompt, type the following and press enter. This opens Component Services:
mmc comexp.msc /32
Expand the nodes Component Services -> MyComputer -> DCOM Config
Now find out your desired application (In this case, Outlook Message Attachment) and right click on the application (If you follow these steps, this issue related all office applications can be resolved) and select properties.
Go to Identity tab and select The interactive user and press OK. This should resolve your issue.
The interactive user is nothing but the logged on user. When you are trying to access office products through service, the access level has to be same and that is the reason you need to specify proper user. If you want to run the service on a server without logging onto it, you need to make sure that the server has a user account which will be used for running the service as well as running office products as specified in Properties as This user (Please look at the Properties dialog box). If you want to learn about the different types of user accounts mentioned in this dialog box, please refer to the following Microsoft link.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms692541%28v=vs.85%29.aspx
Apparently these errors were triggered because I was running Outlook and the application on different user permission levels (one of them as administrator and the other one as regular user).
It looks as if your Office installation has become corrupted.
Try to repair the installation by rerunning setup as Administrator.
- In start menu select Run
- Type dcomcnfg and click OK
- Component Services window is opened.
- Expand the nodes Component Services -> MyComputer -> DCOM Config .
- Right click on the application (Outlook Message Attachment) and select properties.
- Click on Identity tab whatever necessary.
- Click on “The interactive user" then OK