AutoDetectFormat
Definition
public FileFormat AutoDetectFormat(string username, string password, int uploadId, string zipPassword, FileFormat hints)
Description
Attempts to automatically generate a file format definition based on the contents of an uploaded file.
Before calling this method, the data (or a sample of 100 or so records) must have been uploaded using the
Upload Manager web service.
The identifier returned from the StartUpload method must be supplied as the uploadId
parameter. If the data has been uploaded as a password protected zip file, the password must be supplied as the zipPassword parameter.
Otherwise, this parameter should be set to null.
By default, this method will attempt to automatically identify all aspects of the file format, including the underlying file type,
the category of data contained in the file and the type of information stored in each column. However, if some of this information is
already known to the calling application, this information can be supplied as the hints parameter. For example, if the caller knows that
the data is a CSV file, this can be specified in the hints parameter.
This method does not save the file format it generates. Once the calling application decides that the generated file format is correct,
or makes any necessary alterations, it must then give it a unique name and call the
UpdateFormat method to save it.
Code Sample
The following code illustrates generating an automatically detected file format definition after the data has already been uploaded.
The calling application in this case knows that the data is business data in CSV format.
private FileFormat DetectFileFormat(int uploadId)
{
FileFormat hints = new FileFormat();
hints.Type = FileFormatType.Csv;
hints.DataType = DataType.Business;
FileFormatStore proxy = new FileFormatStore();
return proxy.AutoDetectFormat(Username, Password, uploadId, null, hints);
}
File Format Store documentation