private static DocumentNode FindDoc(Guid qvsId, string doc) { List <DocumentNode> docs = apiClient.GetUserDocuments(qvsId); DocumentNode docNode = docs.Find(dn => dn.Name == doc); return(docNode); }
public void ExportLinks(string space, string protocol, string qvsCluster, string qvwsMachine, string category, string csvFileName) { protocol = string.IsNullOrEmpty(protocol) ? "http" : protocol; links = new List <string>(); try { if (client != null) { ServiceInfo qvs = FindService(client, ServiceTypes.QlikViewServer, qvsCluster.Trim()); if (qvs == null) { commSupport.PrintMessage("Could not find QlikView Server", true); } ServiceInfo qvwsService = FindService(client, ServiceTypes.QlikViewWebServer, qvwsMachine.Trim()); if (qvwsService == null) { commSupport.PrintMessage("Could not find Qvws", true); } string qvwsUrl = qvwsService.Address.Scheme + "://" + qvwsService.Address.Host; links.Add("Name" + delimiter + "URL" + delimiter + "Description" + delimiter + "Space" + delimiter + "Type" + delimiter + "DateCreated"); client.ClearQVSCache(QVSCacheObjects.UserDocumentList); List <DocumentNode> userDocs = client.GetUserDocuments(qvs.ID); List <DocumentFolder> userDocFolders = client.GetUserDocumentFolders(qvs.ID, DocumentFolderScope.All); bool filterForCategories = !string.IsNullOrEmpty(category); foreach (DocumentNode userDoc in userDocs) { DocumentFolder docFolder = userDocFolders.FirstOrDefault(x => x.ID.Equals(userDoc.FolderID)); string mountName = string.Empty; if (docFolder != null) { mountName = docFolder.General.Path.ToLower(); } if (filterForCategories) { DocumentMetaData dmd = client.GetDocumentMetaData(userDoc, DocumentMetaDataScope.All); if (dmd.DocumentInfo.Category.ToLower().Equals(category.ToLower())) { ComposeDocumentLinkUrl(mountName, userDoc.RelativePath, qvwsUrl, userDoc.Name, qvsCluster, space, ""); } } else { ComposeDocumentLinkUrl(mountName, userDoc.RelativePath, qvwsUrl, userDoc.Name, qvsCluster, space, ""); } } WriteToCSVFile(csvFileName); } else { commSupport.PrintMessage("Could not create connection to QMS", true); } } catch (Exception e) { commSupport.PrintMessage("Exception when exporting links, run help command for information about usage: Exeception:" + e.Message, true); } }
private static List <DocumentNode> GetUserDocuments() { List <DocumentNode> userDocuments = client.GetUserDocuments(qvsId);//Need to fetch all for full recursive look up if (string.IsNullOrEmpty(mountOrRootFolder)) { return(userDocuments); } else { Guid folderId = FindFolderId(); List <DocumentNode> retValue = new List <DocumentNode>(); foreach (DocumentNode node in userDocuments) { if (node.FolderID == folderId) { retValue.Add(node); } } return(retValue); } }