Upvise Client Library: Form Class (.NET)
Overview
The Form class of the Upvise Client Library represent a Form record in the Forms.forms Upvise table.
Form Sample on Githubbyte[] downloadPdfArchive(Query query)
Download the PDF file content for this form. Works only for submitted forms.
- query is the query object used to connect to the target account
- returns a byte[] containing the Form PDF content or null if not available
WARNING : this method will return the PDF content only if:
- The Form status is not DRAFT.
- in Forms Web App, under Options, the setting : Keep a copy of the Archived Form PDF in Files app is CHECKED. Once applied, this settings is valid only for newly submitted forms not for alreayd submitted ones
using UpviseClient;
...
string token = Query.login("email", "password");
Query query = new Query(token);
Project project = new Project();
project.id = "ID1"; // some project ID
long lastSyncDate = 0; // instead of 0 used the last sync date return by server to be more efficient
Form[] forms = project.selectForms(query, lastSyncDate);
// Iterate through all forms, ignore DRAFT ones
foreach (Form form in forms) {
if (form.status != Form.DRAFT) {
byte[] pdfcontent = form.downloadPdfArchive(query);
if (pdfcontent != null) {
string filename = @"C:\temp\FORM " + form.templatename + " " + form.name + ".pdf";
System.IO.File.WriteAllBytes(filename, pdfcontent);\
}
}
}
static void archive(string id, Query query)
Archives one form and all its linked photos / files- id is the form id to be archived
- query is the query object used to connect to the target account