[SOLVED] Exporting a user's data

Interested in talking about Mash-up's? This is the place.
brick__
Posts: 11
Joined: Tue May 17, 2016 3:28 pm

[SOLVED] Exporting a user's data

Postby brick__ » Mon Sep 26, 2016 3:43 pm

Hello everyone,

Once again I am seeking for help on these forums, but this time it's more about a specific function than a zimlet altogether.

I want to export a user's data from the console, and, as each and every time I am looking for how stuff is working, I do a little search in the javascript API, take a look at the doc online, and go through the existing zimlets on github. But once again, I couldn't find any clues anywhere.

Reading the API on the ZmImportExportController, I quickly found the method I was looking for: exportData(params). I am now facing the following, pretty straight-forward, 2 lines of code:

Code: Select all

var params = {type: ZmImportExportController.TYPE_CSV, filename: "export.csv"};
appCtxt.getImportExportController().exportData(params);

It feels right if it wasn't for the following error I am getting from the UI:
You need to specify an export folder.


After going through all the documentation again (including source code) and even making some arguments for params up, I couldn't find a single argument that could specify the destination/export folder.

Do you guys have any idea of what I am missing here?
Last edited by brick__ on Thu Oct 06, 2016 9:14 am, edited 1 time in total.


brick__
Posts: 11
Joined: Tue May 17, 2016 3:28 pm

Re: Exporting a user's data

Postby brick__ » Thu Oct 06, 2016 9:14 am

All right, I figured it out, and it's really my bad. The error message actually misled me, making me think that the argument it was waiting for was a destination folder. Actually, it doesn't, what he needs is the folderId argument which is clearly referenced in the JSAPI...

So the final snippet looks like this:

Code: Select all

appCtxt.getImportExportController().exportData({
   type: ZmImportExportController.TYPE_DEFAULT,
   subType; ZmImportExportController.TYPE_CSV,
   filename: "export",
   folderId: "All"
});

The mistake I also made in my original post was considering ZmImportExportController.TYPE_CSV as a type instead of a subtype.

Hope it helps someone, but I guess I was pretty much the only one not having figured this out :oops:

Return to “Zimlets”

Who is online

Users browsing this forum: No registered users and 1 guest