I'm using DSOFile
to write custom attributes to a file by using the following code:
DSOFile.OleDocumentProperties file = new DSOFile.OleDocumentProperties();
file.Open(@"C:\More_info.docx",false,DSOFile.dsoFileOpenOptions.dsoOptionDefault);
But it gives me the following error while running the code:
An unhandled exception of type 'System.InvalidCastException' occurred in batchFile.exe
Additional information: Unable to cast COM object of type 'DSOFile.OleDocumentPropertiesClass' to interface type 'DSOFile._OleDocumentProperties'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{58968145-CF01-4341-995F-2EE093F6ABA3}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
Then change the type of file
as dynamic
it executed the line but not able to add or view the properties associated with the file, all properties are showing The function evaluation requires all threads to run.
That is the code will look like this:
dynamic myFile = new DSOFile.OleDocumentProperties();
file.Open(@"C:\More_info.docx",false,DSOFile.dsoFileOpenOptions.dsoOptionDefault);
Here is the image what happens when i watch the variable while debugging:
What i'm doing wrong? any suggestions will be appreciated.