Исключение из HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)C#

Место общения программистов C#
Ответить
Гость
 Исключение из HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)

Сообщение Гость »


У меня есть компьютер с установленным MS Office 2010, а MS Outlook установлен из Office 2007.
На этом компьютере приведен ниже код:

Код: Выделить всё

Microsoft.Office.Interop.Outlook.Application myOutlook = new Microsoft.Office.Interop.Outlook.Application();
string theName = myOutlook.Name;
results into the below exception:


Unable to cast COM object of type
'Microsoft.Office.Interop.Outlook.ApplicationClass' to interface type
'Microsoft.Office.Interop.Outlook._Application'. This operation failed
because the QueryInterface call on the COM component for the interface
with IID '{00063001-0000-0000-C000-000000000046}' failed due to the
following error: Library not registered. (Exception from HRESULT:
0x8002801D (TYPE_E_LIBNOTREGISTERED)).


I have deleted the below registry entry and the above code was working normally. As soon as the Windows Updates run, the below entry is inserted again and the above code raises the exception again.
HKEY_CLASSES_ROOT\TypeLib{00062FFF-0000-0000-C000-000000000046}\9.4

1) The registry entry cannot be deleted from the application due to permissions

2) The two office versions are needed

3) The line "string theName = myOutlook.Name;" can be replaced by any line referencing the variable myOutlook with exactly the same result

4) The same code works perfectly on PCs with MS Office 2007 installed, including MS Outlook.

Any suggestion will be much appreciated.


Источник: https://stackoverflow.com/questions/282 ... registered
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C#»