/// <summary> /// Parse the credential and add it to the credential manager /// </summary> /// <param name="credentialManager"></param> /// <param name="credentialNode"></param> private static void helper_parseCredentialNode(CredentialManager credentialManager, XmlNode credentialNode) { var contentType = XmlHelper.ReadTextAttribute(credentialNode, "contentType", ""); var contentProjectName = XmlHelper.ReadTextAttribute(credentialNode, "contentProjectName"); var contentName = XmlHelper.ReadTextAttribute(credentialNode, "contentName"); var dbUserName = XmlHelper.ReadTextAttribute(credentialNode, "dbUser"); var dbPassword = XmlHelper.ReadTextAttribute(credentialNode, "dbPassword"); var isEmbedded = XmlHelper.ReadBooleanAttribute(credentialNode, "credentialIsEmbedded", false); //Sanity checking if (string.IsNullOrWhiteSpace(contentName)) { throw new Exception("Credential is missing content name"); } if (contentType == "workbook") { credentialManager.AddWorkbookCredential(contentName, contentProjectName, dbUserName, dbPassword, isEmbedded); } else if (contentType == "datasource") { credentialManager.AddDatasourceCredential(contentName, contentProjectName, dbUserName, dbPassword, isEmbedded); } else { throw new Exception("Unknown credential content type: " + contentType); } }
/// <summary> /// Parse the credential and add it to the credential manager /// </summary> /// <param name="credentialManager"></param> /// <param name="credentialNode"></param> private static void helper_parseCredentialNode(CredentialManager credentialManager, XmlNode credentialNode) { var contentType = XmlHelper.ReadTextAttribute(credentialNode, "contentType", ""); var contentProjectName = XmlHelper.ReadTextAttribute(credentialNode, "contentProjectName"); var contentName = XmlHelper.ReadTextAttribute(credentialNode, "contentName"); var dbUserName = XmlHelper.ReadTextAttribute(credentialNode, "dbUser"); var dbPassword = XmlHelper.ReadTextAttribute(credentialNode, "dbPassword"); var isEmbedded = XmlHelper.ReadBooleanAttribute(credentialNode, "credentialIsEmbedded", false); //Sanity checking if(string.IsNullOrWhiteSpace(contentName)) { throw new Exception("Credential is missing content name"); } if(contentType == "workbook") { credentialManager.AddWorkbookCredential(contentName, contentProjectName, dbUserName, dbPassword, isEmbedded); } else if(contentType == "datasource") { credentialManager.AddDatasourceCredential(contentName, contentProjectName, dbUserName, dbPassword, isEmbedded); } else { throw new Exception("Unknown credential content type: " + contentType); } }
protected void UploadWorkbooks(string projectName, string datasourceUsername, string datasourcePassword, bool isEmbedded, string path) { var credentialManager = new CredentialManager(); foreach (var thisFilePath in Directory.GetFiles(path)) { credentialManager.AddWorkbookCredential(Path.GetFileName(thisFilePath), projectName, datasourceUsername, datasourcePassword, isEmbedded); } var uploadWorkbooksRequest = new UploadWorkbooks(Urls, Login, credentialManager, path, HttpClientFactory); uploadWorkbooksRequest.ExecuteRequest(); }