0

Trying to export student exam results from excel to Student OneNote pages.

importing the excel data using QAxObject dynamic calls works flawlessly however a similar setup with OneNote yeilds unkown

getHieracrchy Documentation below is the output of dumpdoc.exe :

void GetHierarchy (QString bstrStartNodeID, HierarchyScope hsScope, QString& pbstrHierarchyXmlOut, XMLSchema xsSchema)


QVariantList params = ...
onenote_object->dynamicCall("GetHierarchy(QString, HierarchyScope, QString&, XMLSchema)", params);

Implementation :

QAxObject* onenote = new QAxObject("OneNote.Application"); 
QString doc = onenote->generateDocumentation();
qDebug() << onenote->control(); // {dc67e480-c3cb-49f8-8232-60b0c2056c8e}

QVariantList params;
QString xml_out;
params << "" << 4 << xml_out << 0;
onenote->dynamicCall("GetHierarchy(QString, HierarchyScope, QString&, XMLSchema)", params);

Error

QAxBase: Error calling IDispatch member GetHierarchy: Unknown error

I have tried running dumpcpp against the CLSID of the OneNote.Application and the registry entry for the typelib thinking it might be a type error for a none builtin Qt->COM type, but no output is produced.

dumpcpp -nometaobject -getfile {0EA692EE-BB50-4E3C-AEF0-356D91732725} -o onenote 

I can manipulate the pages via powershell and see the typelib reference in visual basic but want to access OneNote from C++.

ArchNemSyS
  • 367
  • 2
  • 4
  • 17
  • Not sure, but the OneNote dispatch/automation/dynamic interface seems not to work properly. You should use the IAutomation instead, something like this in C++: https://stackoverflow.com/questions/16913579/microsoft-office-onenote-c-apis – Simon Mourier Mar 18 '21 at 07:33
  • Sorry, I meant IApplication... – Simon Mourier Mar 18 '21 at 08:22

0 Answers0