Qlikview folder list using QMS api -
i able list of qlikview files using following code qms api.
string key = client.gettimelimitedservicekey(); servicekeyclientmessageinspector.servicekey = key; serviceinfo[] qvservice = client.getservices(servicetypes.qlikviewserver); documentnode[] alldocs = client.getuserdocuments(qvservice[0].id);
but lists qlikview files. folders? can kindly suggest me code folders well?
there sample in qms api documentation under getsourcedocumentfolders
method. example writes name of documents , folders console using recursion navigate through sub folders.
this not need, can adapt store these in array, etc. have attempted change variable names match code supplied:
list<documentfolder> sourcedocumentsfolders = client.getsourcedocumentfolders(qvservice[0].id, documentfolderscope.general | documentfolderscope.services); foreach (documentfolder sourcedocumentfolder in sourcedocumentsfolders.orderby(x => x.general.path)) { // print names of source document folders, prefix [r] root folders console.writeline("[r] " + sourcedocumentfolder.general.path); // print sub nodes of current source document folder printsourcedocumentnodes(client, sourcedocumentfolder, string.empty, 1); } static void printsourcedocumentnodes(iqms apiclient, documentfolder sourcedocumentfolder, string relativepath, int indentationdepth) { // retrieve source document nodes of given folder , under specified relative path list<documentnode> sourcedocumentnodes = apiclient.getsourcedocumentnodes(sourcedocumentfolder.services.qdsid, sourcedocumentfolder.id, relativepath); foreach (documentnode sourcedocumentnode in sourcedocumentnodes.orderbydescending(x => x.issubfolder).thenby(x => x.name)) { // print names of source document nodes, indent , prefix [f] folders , [d] documents string indentation = new string(' ', indentationdepth * 3); string nodeprefix = (sourcedocumentnode.issubfolder ? "[f]" : "[d]"); console.writeline(indentation + nodeprefix + " " + sourcedocumentnode.name); // print sub nodes of current source document node if represents folder if (sourcedocumentnode.issubfolder) { printsourcedocumentnodes(apiclient, sourcedocumentfolder, relativepath + "\\" + sourcedocumentnode.name, indentationdepth + 1); } } }
Comments
Post a Comment