void AddField(string name, AlteryxRecordInfoNet.FieldType type, int size, int scale) { Fields.Add(new XmlInputField() { Name = name, FieldType = type, Size = size, Scale = scale }); }
// Creates a new instance of the XmlInputConfiguration class based on the information // in the eConfig xml element. This is the eConfig that Alteryx provides in the // IPluginConfiguration.GetConfigurationControl() method. public static XmlInputConfiguration LoadFromConfiguration(XmlElement eConfig) { // Get the configuration values from the XML config elements to be place in their corresponding fields in the UI. XmlElement userName = eConfig.SelectSingleNode("UserName") as XmlElement; XmlElement password = eConfig.SelectSingleNode("Password") as XmlElement; XmlElement folder = eConfig.SelectSingleNode("Folder") as XmlElement; XmlElement attachmentPath = eConfig.SelectSingleNode("AttachmentPath") as XmlElement; XmlElement queryString = eConfig.SelectSingleNode("QueryString") as XmlElement; if (userName != null && password != null) { // Create the new XmlInputConfiguration object. XmlInputConfiguration xmlConfig = new XmlInputConfiguration(userName.InnerText, password.InnerText, Convert.ToInt16(folder.InnerText), attachmentPath.InnerText, queryString.InnerText); // Find all of the Field elements in the configuration. XmlNodeList fields = eConfig.SelectNodes("Fields/Field"); foreach (XmlElement fieldElement in fields) { // For each field element, add a new field to the object with the name, type, size and scale info. string name = fieldElement.GetAttribute("Name"); AlteryxRecordInfoNet.FieldType type = AlteryxRecordInfoNet.FieldType.E_FT_String; Enum.TryParse <AlteryxRecordInfoNet.FieldType>(fieldElement.GetAttribute("Type"), out type); int size = 0; int.TryParse(fieldElement.GetAttribute("Size"), out size); int scale = 0; int.TryParse(fieldElement.GetAttribute("Scale"), out scale); xmlConfig.AddField(name, type, size, scale); } return(xmlConfig); } return(null); }
// Creates a new instance of the XmlInputConfiguration class based on the information // in the eConfig xml element. This is the eConfig that Alteryx provides in the // IPluginConfiguration.GetConfigurationControl() method. public static XmlInputConfiguration LoadFromConfiguration(XmlElement eConfig) { // Get the configuration values from the XML config elements to be place in their corresponding fields in the UI. XmlElement userName = (XmlElement)eConfig.SelectSingleNode("UserName"); XmlElement password = (XmlElement)eConfig.SelectSingleNode("Password"); XmlElement exchangeVersion = (XmlElement)eConfig.SelectSingleNode("ExchangeVersion"); XmlElement useManualServiceURL = (XmlElement)eConfig.SelectSingleNode("UseManualServiceURL"); XmlElement serviceURL = (XmlElement)eConfig.SelectSingleNode("ServiceURL"); XmlElement useDifferentMailbox = (XmlElement)eConfig.SelectSingleNode("UseDifferentMailbox"); XmlElement mailbox = (XmlElement)eConfig.SelectSingleNode("Mailbox"); XmlElement folder = (XmlElement)eConfig.SelectSingleNode("Folder"); XmlElement includeRecurringEvents = (XmlElement)eConfig.SelectSingleNode("IncludeRecurringEvents"); XmlElement startDate = (XmlElement)eConfig.SelectSingleNode("StartDate"); XmlElement endDate = (XmlElement)eConfig.SelectSingleNode("EndDate"); XmlElement attachmentPath = (XmlElement)eConfig.SelectSingleNode("AttachmentPath"); XmlElement queryString = (XmlElement)eConfig.SelectSingleNode("QueryString"); XmlElement includeSubFolders = (XmlElement)eConfig.SelectSingleNode("IncludeSubFolders"); XmlElement subFolderName = (XmlElement)eConfig.SelectSingleNode("SubFolderName"); XmlElement skipRootFolder = (XmlElement)eConfig.SelectSingleNode("SkipRootFolder"); XmlElement useUniqueFileName = (XmlElement)eConfig.SelectSingleNode("UseUniqueFileName"); XmlElement attachmentFilter = (XmlElement)eConfig.SelectSingleNode("AttachmentFilter"); if (userName != null && password != null) { // Create the new XmlInputConfiguration object. XmlInputConfiguration xmlConfig = new XmlInputConfiguration(userName.InnerString(), password.InnerString(), exchangeVersion.InnerInt <ExchangeVersion>(), useManualServiceURL.InnerBoolean(), serviceURL.InnerString(), useDifferentMailbox.InnerBoolean(), mailbox.InnerString(), folder.InnerInt <WellKnownFolderName>(), includeRecurringEvents.InnerBoolean(), startDate.InnerDateTime(), endDate.InnerDateTime(), attachmentPath.InnerString(), queryString.InnerString(), includeSubFolders.InnerBoolean(), subFolderName.InnerString(), skipRootFolder.InnerBoolean(), useUniqueFileName.InnerBoolean(), attachmentFilter.InnerString()); // Find all of the Field elements in the configuration. XmlNodeList fields = eConfig.SelectNodes("Fields/Field"); foreach (XmlElement fieldElement in fields) { // For each field element, add a new field to the object with the name, type, size and scale info. string name = fieldElement.GetAttribute("Name"); AlteryxRecordInfoNet.FieldType type = AlteryxRecordInfoNet.FieldType.E_FT_String; Enum.TryParse <AlteryxRecordInfoNet.FieldType>(fieldElement.GetAttribute("Type"), out type); int size = 0; int.TryParse(fieldElement.GetAttribute("Size"), out size); int scale = 0; int.TryParse(fieldElement.GetAttribute("Scale"), out scale); xmlConfig.AddField(name, type, size, scale); } return(xmlConfig); } return(null); }
/// <summary> /// Initializes a new instance of the <see cref="FieldDescription"/> class. /// </summary> /// <param name="name">The name.</param> /// <param name="fieldType">Type of the field.</param> public FieldDescription(string name, AlteryxRecordInfoNet.FieldType fieldType) { this.Name = name; this.FieldType = fieldType; }