Upvise Client Library: File Class (.NET)

Properties string id string name string owner DateTime creationdate long size string linkedtable string linkedid Parsing & Serialization static File fromJson(JSONObject obj) JSONObject toJson()

Overview

The File class of the Upvise Client Library represent a record in the System.files Upvise table.

Usage

Select & download all files linked to a given record C#
    using UpviseClient;
    ....
    string recordId = "aRecordId"; // obtain actual value from a previous database call
    
    Query fileQuery = new Query(token);
    JSONOject where = new JSONObject();
    File[] list = query.selectFiles(null, "aRecordId");
    foreach(FileInfo info in list) {
        byte[] content = query.downloadFile(info.id);
        System.IO.File.writeAllBytes(@"c:\\temp\\" + info.name, content);
    }
Upload a new File linked to an existing Database record C#
    using UpviseClient;
    ....
    string jobid = "aRecordId"; // obtain actual value from a previous database call
    
    Query query = new Query(token);
    File file = new File();
    file.id= "TESTFILE1";
    file.name = "testFile.pdf";
    file.mime = "application/pdf";
    file.linkedid = jobid;
    file.linkedtable = "jobs.jobs";

    byte[] content = System.IO.File.ReadAllBytes(@"c:\\temp\testFile.pdf");
 
    query.uploadFile(fileInfo, content);