Skip to content

AddBase64

Adds a new file to the repository with Base64 encoded content and returns the created FileInfo.

1
myDocumentFiles.AddBase64(content: string, name: string, mimeType: string):FileInfo

Parameters

string content
    The Base64 encoded file content.

string name
    The name of the file.

string mimeType
    The MIME type of the file.

Returns

The created FileInfo.

Examples

Store a file downloaded from a service

1
2
3
4
5
6
7
8
var content = $Rest.Create('https://api.example.com/')
    .Request('invoices/{id}/pdf')
    .AddUrlParameter('id', $Xml.Evaluate('InvoiceId'))
    .Get()
    .ToBase64();

var file = $Files.AddBase64(content, 'Invoice.pdf', 'application/pdf');
$Xml.SetValue('InvoiceFile', file.Id);

See Also