Quantcast
Channel: NetOffice - MS Office in .NET
Viewing all articles
Browse latest Browse all 1741

Commented Unassigned: Class not exists: NetOffice.OfficeApi.Document [22155]

$
0
0
We are currently using NetOffice for our Microsoft Outlook AddIn.
application.ActiveInspector().WordEditor currently returns null value for Outlook 2010 and throws next exception for Outlook 2013:
Class not exists: NetOffice.OfficeApi.Document at NetOffice.Factory.CreateObjectFromComProxy(COMObject caller, Object comProxy) at NetOffice.OutlookApi._Inspector.get_WordEditor()

According to Microsoft [documentation](https://msdn.microsoft.com/en-us/library/office/ff868196.aspx) WordEditor should return Microsoft Word Document Object Model of the message being displayed.
Seams that NetOffice.Factory.CreateObjectFromComProxy method is trying to create object with wrong class name. It should create NetOffice.WordApi.Document instead of NetOffice.OfficeApi.Document.
Comments: ** Comment from web user: werder13 **

Hi,

I've solved the issue. Used reflection for it. Please take a look on code snippet below:

```
Word.Document document = null;
object[] args = null;
object comProxy = null;
Outlook._Inspector inspector = application.ActiveInspector();

// _Inspector class property WordEditor throws "Class not exists: NetOffice.OfficeApi.Document" exception
comProxy = NetOffice.Invoker.PropertyGet((NetOffice.COMObject)inspector, "WordEditor", args);
if (comProxy != null)
{
args = new object[] { inspector, comProxy, comProxy.GetType() };
document = Activator.CreateInstance(typeof(Word.Document), args) as Word.Document;
}
```


Viewing all articles
Browse latest Browse all 1741

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>