GetFile

Filter inputs

Name
Type
Description
MandatoryAvailable from version
FileInfoGetFileInfoGeneralThe information needed to identify the file to be retrevied.

Response of type GetFileResponse 

Name
Type
Description
Available from version
FileBytesbyte[]The data of the file as byte array
FileNamestringThe name of the file
FileContentTypestringThe content type of the file, as it was saved in BFS
CustomFieldsCustomFields[]CustomFields is an array of CustomField objects. Each CustomField consists of two strings, FieldName and Value. There are no datatypes associated with these properties, they are just a way for api-users to add customized data to the object.2.28

Code examples

C# - Example of fetching a file from BFS
//example of how to fetch a file from an instance of BFS
var client = new BFSServiceReference.bfsapiSoapClient();
 
var credentials = new BFSServiceReference.Credentials()
{
    UserName = bfsusername, //Username of administrative user in your instance of BFS
    Password = bfspassword, //Password of the administrative user in your instance of BFS
};
GetFileResponse oResp = client.GetFile(new BFSServiceReference.GeFileRequest()
{
    Credentials = credentials,
    identify = bfsidentifier, //Identifier is a unique token for your instance of BFS
    FileInfoGet = new FileInfoGeneral
            {
                BrickId = new Guid("3ac97391-451d-4e2f-843b-75124d2e09f2") //an example Guid
            },
});
if (oResp.Message == "OK")
            {
                byte[] oFileByteDL = oResp.FileBytes;
                System.IO.FileStream oFileStreamDL = null;
                oFileStreamDL = new FileStream(@"c:\temp\download\" + oResp.FileName, FileMode.Create); //an example of how to save the data being fetched from BFS
                oFileStreamDL.Write(oFileByteDL, 0, oFileByteDL.Length);
                oFileStreamDL.Close();
                oFileStreamDL = null;
            }