cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to refresh detach (Word-)Documents from MEGA via JAVA Api

RalfMieke
Super Contributor

 

Hello,

We are trying to automatically update (reinitialize and rebuild) Word (.doc) Documents in MEGA using the JAVA Api and then detach them.
There are two problems:

 

  1. This code (doc being a MegaObject of type Word-Document) only initializes the document, but doesn’t repopulate it with data:

doc.invokeMethod(“InitializeDocument”); // Works as expected (Same as Right-Click -> Reinitialize)

doc.invokeMethod(“RefreshDocument”);    // Doesn’t do anything

  1. This code seems to work, but throws a MegaException “MEGA Error 1” every time

doc.invokeMethod(“DetachDocument”, path); // Detaches the document to “path” without refreshing

 

How is the correct usage of “RefreshDocument” and “DetachDocument”?

1 Reply

SVanSchoonlandt
Honored Contributor

I never used to java API but in vb I do the following for achieving the similar thing, maybe it gives some extra insight

 

Set oDocument = oObject.NewDocument("enter the template name")

Call oDocumnet.RefreshDocument

Call oDocument.DetachDocument("enter path to detach to")

Call oDocument.Delete("No") 'removes document again

 

regards

 

stijn