.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Retrieve Microsoft.Office.Interop.Outlook.View messages with C# and VSNET 2005

Posted By:      Posted Date: September 30, 2010    Points: 0   Category :.NET Framework

Hi all!!!

I've defined in my Outlook 2003 inbox a view with a specific dasl query to filter email messages. And now i want to retrieve those email messages with c#, but i am not able to find a solution. 

This is the code i am trying:

Microsoft.Office.Interop.Outlook.MAPIFolder inbox = outlookNS.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox);


Microsoft.Office.Interop.Outlook.Views InboxViews = inbox.Views;

foreach(Microsoft.Office.Interop.Outlook.View CurrentView in InboxViews)


So at this point how to get the messages that contains the view?                    


View Complete Post

More Related Resource Links

About Microsoft.Office.Interop.Outlook ?

My Winforms application need to send email using Outlook Express, since not all client has Ms. Off. Outlook. I only can launch Outlook using System.Diagnostics.Process, which the problem is I can't write HTML message. My question is Microsoft.Office.Interop.Outlook used to handle Ms. Office Outlook only or also can be used to handle Outlook Express ? Is there any API to handle Outlook Express directly ?It's hard to be advanced programmer

About Microsoft.Office.Interop.Outlook ?

My Winforms application need to send email using Outlook Express, since not all client has Ms. Off. Outlook. I only can launch Outlook using System.Diagnostics.Process, which the problem is I can't write HTML message. My question is Microsoft.Office.Interop.Outlook used to handle Ms. Office Outlook only or also can be used to handle Outlook Express ? Is there any API to handle Outlook Express directly ?It's hard to be advanced programmer

Exception with Microsoft.Office.Interop.Outlook method Members.Add



I am using Visual Studio 2.0 and Microsoft Outlook 11.0 Object Library in a windows application.

I am trying to create a distribution list of contacts in outlook and add members to it. Creating a contact or a distribution list works fine, but when I try to user Members.Add method I get the following exception: "An attempt was made to open an unsupported property."

I am using this post as example code :http://support.microsoft.com/kb/178787

This is the detailed exception:

System.Runtime.InteropServices.COMException was unhandled
  Message="An attempt was made to open an unsupported property."
  Source="Microsoft Office Outlook"
       at Microsoft.Office.Interop.Outlook.AddressEntries.Add(String Type, Object Name, Object Address)


I couldn't find any info about this on the web, I would be happy to get some support.



How to use Microsoft.office interop.word in website

Hi, I have a page which creates a word doc from templet string location = Server.MapPath("~/temp/" + filename); Application app = new Application(); Document doc = app.Documents.Add(location); if(doc != null) { //Some code here } it works fine when i run from visual studio, but when i deploy it as a website in local IIS, its not working.I gave the permissions needed to access the folders in the website. What should i do to make it work. Thanks

saving docx as pdf with Microsoft.Office.Interop.Word in sharepoint

Hi!Im trying to export my docx file to PDF with Microsoft.Office.Interop.Word but im stuck. Anyone with some great ideas that could save my day.The code that im running is working fine localy but i can´t get it to work in sharepoint.The most commin exception is file not found (the same path is working fine localy)...Pls give me a hint!

Using Microsoft.Office.Interop.PowerPoint

Hi, Im writing a web application  that uses Microsoft.Office.Interop.PowerPoint. When I execute the application from VS 2008 it works fine. I have a .pptx template, I create an instance of PowerPoint, then I open the Presentation, add a Slide and finally I add an excel file as an OLE Object. The code that I'am using is something like this:Imports Microsoft.Office.Interop.PowerPoint Imports PowerPoint = Microsoft.Office.Interop.PowerPoint Dim objPowerPoint As PowerPoint.Application Dim objPresentacion As PowerPoint.Presentation Dim objDiapositiva As PowerPoint.Slide objPowerPoint = New PowerPoint.Application objPowerPoint.Visible = Microsoft.Office.Core.MsoTriState.msoCTrue objPresentacion = objPowerPoint.Presentations.Open("File.pptx") objDiapositiva = objPresentacion.Slides.Add(1, PowerPoint.PpSlideLayout.ppLayoutBlank) objDiapositiva.Shapes.AddOLEObject(10, 10, , , , "ExcelFile.xlsx") objDiapositiva = Nothing But when I want to execute the application from my localhost I get an error in the AddOLEObject method, the error is something like: HRESULT E_FAIL of a COM component call I don't know what is the problem because from VS 2008 it works fine but from localhost it does not work, all in the same computer. Can anyone help me? Thanks!    

** Microsoft.Office.Interop.Excel.dll - Do I need Excel installed?? **

Hi,I have a VB.Net app which creates an Excel report.  This is all working fine on my development boxwhich turns out to have MS Office 2003 installed.  The app works fine.  I added a reference toMicrosoft Excel 11.0 Object Library under the COM tab when I did the "Add Reference".  I also copiedthe Interop.Excel.dll to my BIN folder.The server that I need to deploy my app to does not have MS Office or Excel installed.  I ran the appanyway just to see if it would worked.  Of course, it failed with this error:Retrieving the COM class factory for component with CLSID {00020820-0000-0000-C000-000000000046} failed due to the following error: 80040154.Do I need to have Excel installed on the target machine?  I took a copy of "Microsoft.Office.Interop.Excel.dll"from the GAC on the DEV box and installed on the GAC on the target machine.  Tried the app again and stillfailed with the same error.  I really don't want to install Excel if I don't have to.  Can someone please providesome help on this?Thank you in advance!

Extract Word document & Convert those extracted pages to images using Microsoft.Office.Interop.Word

You cannot vote on your own post 
Hi Everyone.

I need to extract word document into number of pages and convert those pages into images by using Microsoft.Office.Interop.Word, can anybody tell me how i can do this?

Can't find Microsoft.Office.Interop.Excel.dll



I am trying to use this namespace and downloaded the O2003pia.exe from http://support.microsoft.com/kb/897646.


I ran the msi and see the Interop files in the GAC but when I try to 'Add a Reference' in VS2005, I do not see any of the Interop namespaces.


I already had Office 2003 installed before I ran the above msi.


What else am I doing wrong. Why aren't these included with VS2005 in the first place..............


Please help,



ASP.NET Excel Microsoft.Office.Interop.Excel.ApplicationClass



My server is windows 2008 R2. Everything is running well except the following.

Whenever I tried to export to excel using:

Microsoft.Office.Interop.Excel.ApplicationClass app = new Microsoft.Office.Interop.Excel.ApplicationClass();

It shows exception:

Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005

I searched on google, almost every suggestion told me to find Microsoft Excel Application in DomConfig. But I found no Microsoft Excel in DomConfig. Please note, I have Excel 2003 & 2007 on that server.

Please help me, its really urgent.

Microsoft.Office.Interop.Excel NumberFormmatting Help


Hi Everyone. I wasn't sure which forum to put this under, so please move if necessary.


I have an app that exports a data table to excel. This works, however, i have a column with currency that i can't get formatted properly.


IE: Right now it prints 24450.00 or 24000 if a whole number with no decimal places.


I have tried a lot of things, but this is what i have right now for my range and formatting. Below is a copy of the method. Please let me know where i am going wrong, because with this range and formatting, SOME of the numbers are showing up #######.


Below is my formatting code. What am i missing? It seems like it formats some based on the "$#,##0.00", but it doesn't work for them all.

How do i set everything to "Currency" like in the excel options? I have tried range.NumberFormat = "Currency" but that is invalid. Any help is appreciated.

 Microsoft.Office.Interop.Excel._Application excel = new Microsoft.Office.Interop.Excel.ApplicationClass();
      Microsoft.Office.Interop.Excel.Workbook wb = (Microsoft.Office.Interop.Excel.Workbook)excel.Workbooks.Add(System.Reflection.Missing.Value);
      Microsoft.Office.Interop.Excel.Worksheet ws = (Microsoft.Office.In

Does Microsoft.Office.Interop.Word Requires MS OFFICE Installation???


Hi Team,

I'm developing an application in WPF which generates a WINWORD for that I'm Using

Microsoft.Office.Interop.Word dll but is it Manditory to have MS OFFICE installed to work dll ???

Please, Answer my query

Thanks in Advance

Microsoft.Office.Interop.Excel on Server


Good day,

I got the srcipt working on my Local PC.
But when importing on to server, i get the error.

"Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=10.0.4504.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified."

I copied the files & registered to all locations i have on my local PC.

But the the server does not have the  Visual Studio .NET Command Prompt - not sure if it is needed as I use the register.bat


Microsoft.Office.Interop.Excel, Version= issue


Hello Friends,

I just got a new computer. Running VS2008 professional with MS Office 2010 on a Win 7 64-bit machine... 

I am using the Excel in my Web Site (NOTE: It is not a Web App so I do not have a csproj file in there) 

I am getting this error on my Windows 2003 Web servers (I have 2 of them): 

Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I am assuming this has something to do with MS Office 2010 (office 2003 is installed on the servers) 

Microsoft.Office.Interop.Excel dll files from my directory and picked the version 11. This error message still comes up. 

Please HELP!!!! Thanks

Edit in Microsoft Office Outlook link


I have been asked to add a link to the menu drop down for .msg files in document libraries.

In this picture there is the link "Edit in Microsoft Office Word",  I need to have it show this option for .msg files except for outlook like "Edit in Microsoft Office Outlook".

Is it possible to add a link for .msg files to open in outlook?  Im assuming its probably just some xml file I need to update.  I know clicking on the document opens it in outlook, but they want it to also be on the menu.

menu image

issues with Microsoft.Office.Interop.Excel in asp.net throwing Exception from HRESULT: 0x800A03EC


i m using Microsoft.Office.Interop.Excel in asp.net for Excel file as anEmail attachment .

i get the data and write to Excel but when i try to save like:

oWB.SaveAs(strCurrentDir +strFile, Microsoft.Office.Interop.Excel.


XlFileFormat.xlWorkbookNormal, null,

could not load file or assembly'Microsoft.office.interop.excel


could not load file or assembly'Microsoft.office.interop.excel, version=  , culture=neutral, public keytoken=71e9bce111e9429c' or one of its dependencies

i am getting this error when i am installing setup of my project in other machine.


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend