By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,589 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,589 IT Pros & Developers. It's quick & easy.

Could not load file or assembly 'Microsoft.Office.Interop.Outlook, Version=12.0.0.0,

OuTCasT
100+
P: 374
Hi

I have created an asp.net project that exports items from datagridview to and outlook calendar
This is the code that i have used..

Expand|Select|Wrap|Line Numbers
  1. Dim body As String
  2.         Dim ends As String
  3.         Dim location As String
  4.         Dim start As String
  5.         Dim subject As String
  6.  
  7.         'Create an outlook application
  8.         Dim oApp As Microsoft.Office.Interop.Outlook.Application
  9.         oApp = New Microsoft.Office.Interop.Outlook.Application()
  10.  
  11.         'Get Namespace and Logon
  12.         Dim oNS As Microsoft.Office.Interop.Outlook.NameSpace = oApp.GetNamespace("mapi")
  13.  
  14.  
  15.         'Create a new appointment
  16.  
  17.         Dim oAppt As Microsoft.Office.Interop.Outlook.AppointmentItem
  18.  
  19.  
  20.  
  21.         For Each row As GridViewRow In GridView3.Rows
  22.             oNS.Logon("YourValidProfile", Missing.Value, False, True) 'todo:
  23.             oAppt = oApp.CreateItem(OlItemType.olAppointmentItem)
  24.             body = row.Cells(0).Text
  25.             ends = row.Cells(1).Text
  26.             location = row.Cells(2).Text
  27.             start = row.Cells(3).Text
  28.             subject = row.Cells(4).Text
  29.  
  30.             oAppt.Subject = subject
  31.             oAppt.Body = body
  32.             oAppt.Location = location
  33.  
  34.             oAppt.Start = start
  35.             oAppt.End = ends
  36.  
  37.             oAppt.Save()
  38.  
  39.  
  40.             oNS.Logoff()
  41.         Next
It works locally on my machine but once i have uploaded the files to the server on which the application is running then i get the following error.

Could not load file or assembly 'Microsoft.Office.Interop.Outlook, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.

I have loaded the PIA's on the server itself and have checked the C:\Windows\Assembly folder and the Microsoft.Office.Interop.Outlook assembly is within that folder and the version is 12.0.0.0

Can anyone direct to a solution if possible please.
Sep 14 '09 #1
Share this Question
Share on Google+
3 Replies


Frinavale
Expert Mod 5K+
P: 9,731
You need to install Outlook on the server... the Interop class (in your project) is just a wrapper class that allows .NET to access the COM objects in the Outlook assembly. If this assembly (Outlook) is not installed on the server then this will not work.
Sep 14 '09 #2

OuTCasT
100+
P: 374
I have installed Outlook on the server. Now i get this response

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

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access
Sep 15 '09 #3

Frinavale
Expert Mod 5K+
P: 9,731
Have you tried to do what the error message is suggesting that you try to do?
Sep 15 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.