Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

On this page:

Table of Contents
maxLevel12

How do I login/logout to/from a Form server?

...

Code Block
IDictionary<string,string> customParams = new Dictionary<string, string>(); 
       customParams.Add("autoLogin", "true");
//customParams.Add("autoLoginupdateNonDesigners", "true");  //if user is not a frevvo.Designer, this must be set for user to be officially 'created' otherwise user is truly virtual/temporary
 
string[] roles = { "frevvo.Designer" };   

FormsService service = new FormsService("http://localhost:8082", "yourappname");      
          service.LoginAs( 
              "newUserName",
              "tenantAdminUserName@myTenantName",
              "tenantAdminPassword",
               true,
              roles,  //optional param – may be null. Specified roles will be created if necessary.  When null, a non-designer user (able to participate in flows but not create flows/forms) will be created if necessary.  
              "newUserFirstName",  //optional param – may be null 
              "newUserLastName",  //optional param – may be null
              "newUserEmailName@EmailServer.com",  //optional param – may be null
               customParams);

UserEntry user = service.GetUser("newUserName"); 
   
// interact with frevvo                
         
service.Logout();

...

Code Block
    FormsService service = ...;
    FormTypeQuery query = service.CreateFormTypeQuery(null);
    FormTypeFeed themesformTypes = service.Query(query);
    foreach (ThemeEntryFormTypeEntry formType in formTypes.Entries)
    {
            Console.WriteLine("Form Type: " + formType.Title.Text);
    }

 

How do I get the list of all forms for a given application?

...

Code Block
string fileName = ....;
bool isForm = ....;
ApplicationEntry appEntry = ....; 

// If an entry with the same id already exists, it will be replaced.
// Otherwise, the archive will be uploaded with the same id.
FormTypeEntry entry = appEntry. FormTypeFeed.UploadAndInsertFormType(filename, isForm); 

// If an entry with the same id already exists, a copy will be made.
// Otherwise, the archive will be uploaded with the same id.
FormTypeEntry entry = appEntry.FormTypeFeed.UploadAndCopyFormType(filename, isForm); 

// If an entry with the same id already exists, it will be replaced.
// Otherwise, the archive will be uploaded with the same id.
FormTypeEntry entry = appEntry.FormTypeFeed.UploadAndReplaceFormType(filename, isForm); 
 
Stream appStream = ....;
bool isForm  

How do I receive the Submission Document Set from a form submission?

When the _formActionDocs parameter is set, the SubmitInstance call will return a list of MultiPartContentElement objects that contain the submission documents. 

Code Block
FormTypeEntry formTypeEntry = ....; 
ApplicationEntry
appEntry// = ....;
 
// If an entry with the same id already exists, it will be replaced.
// Otherwise, the archive will be uploaded with the same id. 
FormTypeEntry entry = appEntry. FormTypeFeed.UploadAndInsertFormType(appStream,isForm);

// If an entry with the same id already exists, a copy will be made. 
// Otherwise, the archive will be uploaded with the same id. 
FormTypeEntry entry = appEntry.FormTypeFeed.UploadAndCopyFormType(appStream, isForm);


// If an entry with the same id already exists, it will be replaced. 
// Otherwise, the archive will be uploaded with the same id. 
FormTypeEntry entry = appEntry.FormTypeFeed.UploadAndReplaceFormType(appStream, isForm);  

How do I receive the Submission Document Set from a form submission?

When the _formActionDocs parameter is set, the SubmitInstance call will return a list of MultiPartContentElement objects that contain the submission documents. 

Code Block
FormTypeEntry formTypeEntryrequest all data come back as part of the submit response
NameValueCollection linkParams = new NameValueCollection();
linkParams.Add("_formActionDocs", "true"); 

FormEntry formEntry = formTypeEntry.CreateFormEntry(linkParams); 

IList<MultipartContentElement> responseData = formEntry.SubmitInstance(); 

foreach (MultipartContentElement part in responseData)
{
       string dispositionType = part.ContentDispositionType;
       string name = part.Name;
       string contentType = part.ContentType;
       string contentTransferEncoding = part.ContentTransferEncoding;
       string data = part.DataPayload;
} 

 

Functions only available in the .net api for  v5.3 or later:

Note

The updates listed here are only available in .net client API version 5.3 or later.

 Note the Themes api was removed and replaced by the Styles api in frevvo 5.3.  All references to Themes have been removed in frevvo 5.3.

How do I Upload a custom script?

Code Block
string scriptFileName = ....;  
//ApplicationEntry requestappEntry all data come back as part of the submit response
NameValueCollection linkParams = new NameValueCollection();
linkParams.Add("_formActionDocs", "true"); 

FormEntry formEntry = formTypeEntry.CreateFormEntry(linkParams); 

IList<MultipartContentElement> responseData = formEntry.SubmitInstance(); 

foreach (MultipartContentElement part in responseData)
{
       string dispositionType = part.ContentDispositionType;
       string name = part.Name;
       string contentType = part.ContentType;
       string contentTransferEncoding = part.ContentTransferEncoding;
       string data = part.DataPayload;
} 

 

Functions only available in the .net api for  v5.3 or later:

Note

The updates listed here are only available in .net client API version 5.3 or later.

 Note the Themes api was removed and replaced by the Styles api in frevvo 5.3.  All references to Themes have been removed in frevvo 5.3.

How do I Upload a custom script?

Code Block
string scriptFileName= ....;
 
appEntry.SetScript(scriptFileName);

How do I Delete a custom script?

Code Block
ApplicationEntry appEntry = ....; 
appEntry.DeleteScript();

How do I Download a custom script?

Code Block
ApplicationEntry appEntry = ....; 

Stream scriptStream = appEntry.GetScript();
string contentString = new StreamReader(scriptStream).ReadToEnd();

How do I Upload a Style?

Code Block
string styleFileName = ....; 
bool doReplace = ....;

StyleFeed feed = TestUser.StyleFeed;


StyleEntry entry =
feed.UploadStyle(styleFileName, doReplace);

How do I Delete a Style?

Code Block
string styleId = ....;
FormsService service = ....;

StyleEntry entry = service.GetStyle(styleId);
entry.Delete();

How do I get the list of Styles for the current user?

There are two ways to get the list of Styles for a current user.  You can use the UserEntry.StyleFeed:

Code Block
UserEntry testUser = ....;
StyleFeed ApplicationEntryuserStyleFeed appEntry = testUser....StyleFeed;
 
appEntry.SetScript(scriptFileName);

How do I Delete a custom script?

Code Block
ApplicationEntry appEntry = ....; 
appEntry.DeleteScript();

How do I Download a custom script?

Code Block
ApplicationEntry appEntryforeach (StyleEntry entry in userStyleFeed.Entries) 
{
Console.WriteLine("Style: " + style.Title.Text);
}

Or you can Query via the FormsService class:

Code Block
FormsService service = ....;
StyleQuery 
Stream scriptStreamquery = appEntryservice.GetScriptCreateStyleQuery();
stringStyleFeed contentStringstyles = new StreamReader(scriptStream).ReadToEnd();

How do I Upload a Style?

Code Block
string styleFileName = ....; 
bool doReplace = ....;

StyleFeed feed = TestUser.StyleFeed;


StyleEntry entry =
feed.UploadStyle(styleFileName, doReplace);

How do I Delete a Style?

Code Block
string styleIdservice.Query(query) as StyleFeed;
foreach (StyleEntry style in styles.Entries)
{
Console.WriteLine("Style: " + style.Title.Text);
}

How do I set the Style property for a Form or Flow?

Code Block
FormTypeEntry formTypeEntry = ....; FormsService
serviceformTypeEntry.Style = ...."blue";

StyleEntry entry = service.GetStyle(styleIdformTypeEntry.Update();  entry.Delete();

How do I

...

upload a form/flow?

There are two ways to get the list of Styles for a current user.  You can use the UserEntry.StyleFeed:

...

three options when uploading a Flow or Form: Insert, Copy or Replace. You can use a Stream or a file path location when uploading.

Code Block
string fileName = ....;
StyleFeedbool userStyleFeedisForm = testUser....StyleFeed;
foreachApplicationEntry (StyleEntryappEntry entry in userStyleFeed.Entries)= ....; 
{
Console.WriteLine("Style: " + style.Title.Text);
}

Or you can Query via the FormsService class:

Code Block
FormsService service = ....;
StyleQuery query = service.CreateStyleQuery();
StyleFeed styles = service.Query(query) as StyleFeed;
foreach (StyleEntry style in styles.Entries)
{
Console.WriteLine("Style: " + style.Title.Text);
}

How do I set the Style property for a Form or Flow?

Code Block
FormTypeEntry formTypeEntry = ....; 
formTypeEntry.Style = "blue";

formTypeEntry.Update();  

...

Code Block
string signaturePictFile = ....;
string signatureXmlFile
// If an entry with the same id already exists, it will be replaced.
// Otherwise, the archive will be uploaded with the same id.
FormTypeEntry entry = appEntry. FormTypeFeed.UploadAndInsertFormType(filename, isForm); 

// If an entry with the same id already exists, a copy will be made.
// Otherwise, the archive will be uploaded with the same id.
FormTypeEntry entry = appEntry.FormTypeFeed.UploadAndCopyFormType(filename, isForm); 

// If an entry with the same id already exists, it will be replaced.
// Otherwise, the archive will be uploaded with the same id.
FormTypeEntry entry = appEntry.FormTypeFeed.UploadAndReplaceFormType(filename, isForm); 
 
Stream appStream = ....;
bool isForm = ....;
ApplicationEntry appEntry = ....;
 
// If an entry with the same id already exists, it will be replaced.
// Otherwise, the archive will be uploaded with the same id. 
FormTypeEntry entry = appEntry. FormTypeFeed.UploadAndInsertFormType(appStream,isForm);

// If an entry with the same id already exists, a copy will be made. 
// Otherwise, the archive will be uploaded with the same id. 
FormTypeEntry entry = appEntry.FormTypeFeed.UploadAndCopyFormType(appStream, isForm);


// If an entry with the same id already exists, it will be replaced. 
// Otherwise, the archive will be uploaded with the same id. 
FormTypeEntry entry = appEntry.FormTypeFeed.UploadAndReplaceFormType(appStream, isForm);  

How do I use FormEntryBuilder convenience class to reinstantiate forms with signatures for submission?

Code Block
string signaturePictFile = ....;
string signatureXmlFile = ....; 
string sectionFormXmlFile = ....;
string sectionFormXmlFile = ....;
string miscFile = ....;
FormTypeEntry formTypeEntry = ....;   // existing form type from feed 
Stream wetSig = File.OpenRead(scriptStream);
Stream sigXml = File.OpenRead(signatureXmlFile);
Stream formXml = File.OpenRead(sectionFormXmlFile);
Stream miscFile = File.OpenRead(miscFile);

FormEntryBuilder fbe = new FormEntryBuilder(formTypeEntry);

fbe.Document("form", formXml);
fbe.WetSignature("controlTypeId", wetSig); 
fbe.DigitalSignature(sigXml); 
fbe.Attachment("controlTypeId", miscFile); 
fbe.Data("Name", "some name");  // builds up _data 
fbe.Parameter("_formTz", "America/New_York");  // adds URL param 
fbe.FormActionDocs(true);  // set _formActionDocs param to return Submission Doc Set

FormEntry formEntry = fbe.CreateFormEntry();

IList<MultipartContentElement> responseData = formEntry.SubmitInstance();

foreach (MultipartContentElement part in responseData)
{
       string dispositionType = part.ContentDispositionType; 
       string name = part.Name;
       string contentType = part.ContentType;
       string contentTransferEncoding = part.ContentTransferEncoding; 
       string data = part.DataPayload;
} miscFile = ....;
FormTypeEntry formTypeEntry = ....;   // existing form type from feed 
Stream wetSig = File.OpenRead(scriptStream);
Stream sigXml = File.OpenRead(signatureXmlFile);
Stream formXml = File.OpenRead(sectionFormXmlFile);
Stream miscFile = File.OpenRead(miscFile);

FormEntryBuilder fbe = new FormEntryBuilder(formTypeEntry);

fbe.Document("form", formXml);
fbe.WetSignature("controlTypeId", wetSig); 
fbe.DigitalSignature(sigXml); 
fbe.Attachment("controlTypeId", miscFile); 
fbe.Data("Name", "some name");  // builds up _data 
fbe.Parameter("_formTz", "America/New_York");  // adds URL param 
fbe.FormActionDocs(true);  // set _formActionDocs param to return Submission Doc Set

FormEntry formEntry = fbe.CreateFormEntry();

IList<MultipartContentElement> responseData = formEntry.SubmitInstance();

foreach (MultipartContentElement part in responseData)
{
       string dispositionType = part.ContentDispositionType; 
       string name = part.Name;
       string contentType = part.ContentType;
       string contentTransferEncoding = part.ContentTransferEncoding; 
       string data = part.DataPayload;
}

Functions only available in the .net api for  v6.1.2 or later:

Note

The updates listed here are only available in .net client API version 6.1.2 or later.

Ability to create a new form instance using an alternate service/user:

Code Block
languagenone
FormsService myFormsService = ....;
FormTypeEntry publicFormType = ....;     //may be created by any user as long as 
                                        //visibility is Visibility.PublicTenant

FormEntryBuilder fbe = new FormEntryBuilder(publicFormType);
fbe.Document("form","form.xml");fbe.WetSignature(sigControlId, "signature.png");
fbe.DigitalSignature("DigitalSignatures.xml");
fbe.Data("Name","Dudley");
fbe.Data("Description","DooWright");

FormEntry formEntry = fbe.CreateFormEntry(test2UserService);

 

Addition of required fileName parameter to stream-based FormEntryBuilder methods:

The filename attribute for stream-based methods for digital/wet signatures and documents is required. Methods without the filename parameter are deprecated.

Add a Document to the builder from a given stream

Section
Column
width50%
Code Block
/// Add a Document to this builder from a given stream

public FormEntryBuilder Document(string partName, Stream inputStream, string
contentType, string fileName)
 
Column
width50%
Note

This method deprecates the previous method:

public FormEntryBuilder Document(string partName, Stream inputStream, string contentType)

Add a wet signature image to this builder from a given stream

Section
Column
width50%
Code Block
/// Add a wet signature image to this builder from a given stream

public FormEntryBuilder WetSignature(string id, Stream inputStream, string contentType, 
string fileName)
Column
width50%
Note

This method deprecates the previous method:

public FormEntryBuilder WetSignature(string id, Stream inputStream, string contentType)

Add a Digital signature to this builder from a given stream

Section
Column
width50%
Code Block
/// Add an xml signature to this builder from a given stream

public FormEntryBuilder DigitalSignature(Stream inputStream, string contentType, string
fileName) 
Column
width50%
Note

This method deprecates the previous method:

public FormEntryBuilder DigitalSignature(Stream inputStream, string contentType)

Get the Raw Link to the form/flow from the FormTypeEntry:

Code Block
FormTypeEntry fte = ….; 

//Get Raw Link 
AtomLink rawLink = fte.GetFormTypeLink(null);

Add convenience method to upload schema file(s) in zip form:

Code Block
ApplicationEntry testApplication = ....; 
SchemaEntry testSchema = ....;
string zipFileName = "\path\to\myschema.zip";

testSchema =
testApplication.SetupSchemaZip(zipFileName, "rootXSDFileName.xsd",
"schemaName-optional ");

Added convenience method to upload Schema file(s) in .xsd file form:

Code Block
ApplicationEntry testApplication = ....;
SchemaEntry testSchema = ....;
string xsdFileName = "\path\to\myschema.xsd";

testSchema =
testApplication.SetupSchema(xsdFileName, "schemaName-optional"); 

Added convenience method to upload Schema file(s) in MediaSource form:

Code Block
ApplicationEntry testApplication = ....;
SchemaEntry testSchema = ....;
string fileName = "\path\to\myschema.xsd";

MediaFileSource source = new MediaFileSource(fileName, SchemaFeed.MEDIA_SOURCE_TYPE);

testSchema = testApplication.SetupSchema(source, "schemaName-required"); 

Functions only available in the .net api for  v6.1.5 or later:

Note

The updates listed here are only available in .net client API version 6.1.5 or later.

How do I batch upload users from the api?

Note

The format of the users csv file is the same as that used through the UI users load feature.

Users csv upload is through HTTP.  

The users csv upload is available directly through HTTP. One way to do this is using cURL, but other ways are possible. Here are the steps:

  1. Log in:

Code Block
curl http://host:port/frevvo/web/login -d username=admin@tenant -d password=admin_password -d lAction=Login  -X POST  -c cookies -H Content-Type:application/x-www-form-urlencoded  

      2. Replace host, port, username and password above as correct for your implementation. For Live forms online, host=app.frevvo.com and the port is optional. Change http to https.

      3. Upload the users csv file:

Code Block
curl http://host:port/frevvo/web/tn/tenant.id/allUsers  -F notificationEmailAddress=some_email_address -F usersFile=@users_file.csv  -X POST  -b cookies -H Content-Type:multipart/form-data

      4. Replace host, port, tenant.id, some_email_address and users_file.csv above as correct for your implementation. If users_file.csv is not in the current directory, adjust the path accordingly. For Live forms online, host=app.frevvo.com and port is optional. Change http to https.

      5. Check the some_email_address for incoming email with the results of the load.

      6. (Optional) Get the user csv back from frevvo. It will have all users, including all that were loaded:

Code Block
curl http://host:port/frevvo/web/tn/tenant.id/allUsers  -X GET  -b cookies

      7. The response will be the users csv data.

Users csv upload through the .net client api 

The users csv upload is available through the .net client api in Live Forms v6.1.5. Here is the code snippet:

Code Block
Stream userCsvData = // Obtain a stream to your user csv file – ex: FileStream. 
    
       FormsService service = // Obtain form service logged in as tenant admin user     
       UserQuery userFeedQuery = service.CreateUserQuery(null);
       UserFeed userFeed = service.Query(userFeedQuery);

       stringnotificationEmailAddress = // some email address        
       userFeed.UploadUsersCsv(userCsvData, notificationEmailAddress);

                //now check for the email with results

 

To get the users csv data from frevvo:

Code Block
Stream is = userFeed.GetUsersCsv();

 You can specify who receives an email reporting the upload status when it is done through the API. The email is sent to the "notificationEmailAddress" that is passed in the API. The email may say something like this if there are errors during the upload:

Code Block
Validation occurred with errors. Users data NOT loaded. Refer to attached CSV data file for validation and/or loading result details.

The attached file, results.csv, will contain the details.