CreateFile

Creates a file in the BFS, based on the input in in the FileInfoUpload 

Filter inputs

Name

Type

Description

Mandatory

Available from version

Name

Type

Description

Mandatory

Available from version

FileInfoUpload

FileInfoUpload

An instance of the FileInfoUpload class







Response rows

Name

Type

Description

Available from version

Name

Type

Description

Available from version

Message

String

The outcome of the operation ("OK" if everything was correct)



FileId

Guid

Id of the file created, this id is used when getting file in GetFile()

2.24



Code examples

C# example
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 }; // Get information about the file to upload to BFS FileInfo fInfo = new FileInfo(@"c:\temp\test.txt"); // in real life make sure the length don't exceed the maximum setting (default is 4 MB limit) long numBytes = fInfo.Length; double dLen = Convert.ToDouble(fInfo.Length / 1000000); FileStream fStream = new FileStream(@"c:\temp\test_new.txt", FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fStream); // convert the file to a byte array byte[] data = br.ReadBytes((int)numBytes); br.Close(); CreateFileRequest oReq = new CreateFileRequest(); oReq.Credentials = credentials; oReq.identify = bfsidentifier; //Identifier is a unique token for your instance of BFS  oReq.FileInfoUpload = new FileInfoUpload { ContentType = "text", // choose appropiate content type based on your file fileBytes = data, FileName = "test_new.txt", // the name of file as you would like to name it in BFS Owner = new Guid("xxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx"), // The owner of the file,  see GetPersons for reference Permission = FilePermission.All // Type of permission that should apply to this file (AdminOnly/AdminPartner/All) }; CreateFileResponse Rep = client.CreateFile(oReq); if (oRep.Message == "OK") { Console.Writeline("Upload successful"); } else { Console.Writeline(string.format("Upload not successful: {0}", Rep.Message)); }
XML example
<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://tempuri.org/" xmlns:s1="http://microsoft.com/wsdl/types/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"> <soap:Body> <CreateFile xmlns="http://tempuri.org/"> <req> <Credentials> <UserName>{{username}}</UserName> <Password>{{password}}</Password> </Credentials> <identify>{{identifier}}</identify> <FileInfoUpload> <ContentType>[The content type for example application/pdf]</ContentType> <FileName>[Name-of-the-file.format]</FileName> <Owner>[LegalEntity Guid]</Owner> <Permission>[Permission scope All, AdminPartner or AdminOnly]</Permission> <fileBytes>[Your bytes]</fileBytes> </FileInfoUpload> </req> </CreateFile> </soap:Body> </soap:Envelope>




Terms of License
Change Policy
© 2009 - 2024 Huddlestock Technologies AB All rights reserved