This documentation is for frevvo v10.1. Not for you? Earlier documentation is available too.

FAQ - .Net Client API

On this page:

In v9.1 and later frevvo's "Applications" are known as "Projects," and "Themes" are known as "Styles." The API objects and methods still use the words application, 'app', and theme.

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

The direct method for an existing user: See the C# code snipped below:

          FormsService service = new FormsService("http://localhost:8082", "yourappname");
          service.Login("myuser", "mypassword");
          UserEntry user = service.GetUser(“myuser”); 
                   
          // interact with frevvo
                   
          service.Logout();

Note that when you login, the .NET client API initializes a local security token based on your credentials.  It does not actually make a call however, until you make your first request.  At that time, the forms service will attempt to authorize you based on your token. In the above example, the first call is for the user entry.

The LoginAs method for an existing user:

This method allows you to login as any of the existing tenant users provided you can pass in the tenant's admin user and password. This is useful when you want to login using the same user that is logged into your project without having to know their password.

IDictionary<string, string> customParams = new Dictionary<string, string>();
       customParams.Add("autoLogin", "true");


FormsService service = new FormsService("http://localhost:8082", "yourappname"); 
          service.LoginAs( 
              "myuser", 
              "tenantAdminUserName@myTenantName", 
              "tenantAdminPassword",
              false,
              null, null, null, null,
              customParams);

UserEntry user = service.GetUser(“myuser”); 
     
          //   interact with frevvo   
  
service.Logout(); 

The LoginAs method for a new/undefined user:

When your tenant is configured with the Delegating Security Manager, you can use the loginAs() method to automatically create new/virtual users.

IDictionary<string,string> customParams = new Dictionary<string, string>(); 
customParams.Add("autoLogin", "true");
//customParams.Add("updateNonDesigners", "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 workflows but not create workflows/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();

When you login, the .NET client API initializes a local security token based on the supplied credentials.  It does not actually make a call however, until the first request is executed. At that time, the forms service will attempt to authorize the user based on the provided token. In the above examples, the first call is for the user entry.


How do I get the list of all projects for the current user?

    FormsService service = ...;
    ApplicationQuery query = service.CreateApplicationQuery(null);
    ApplicationFeed apps = service.Query(query);
    foreach (ApplicationEntry app in apps.Entries)
    {
            Console.WriteLine("App: " + app.Title.Text);
            // ...
    }

How do I get the list of all themes for the current user?

All references to Themes have been removed in version 5.3. This example does not pertain to frevvo 5.3 or later.

    FormsService service = ...;
    ThemeQuery query = service.CreateThemeQuery(null);
    ThemeFeed themes = service.Query(query);
    foreach (ThemeEntry theme in themes.Entries)
    {
            Console.WriteLine("Theme: " + theme.Title.Text);
    }

How do I get the list of all forms for the current user?

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

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

The code snippet below prints the name of all forms in the appEntry application:

    ApplicationEntry app = ...; // find the right application
    FormTypeFeed formTypes = app.FormTypeFeed;
    foreach(FormTypeEntry formType in formTypes.Entries)
    {
        Console.WriteLine("Form Type: " + formType.Title.Text);
    }

How do I get the list of all schemas for the current user?

    SchemaQuery query = service.CreateSchemaQuery(null);
    SchemaFeed schemas = service.Query(query);
    foreach (SchemaEntry schema in schemas.Entries)
    {
        Console.WriteLine("Schema: " + schema.Title.Text);
    }

How do I get the list of all schemas for a given project?

The code snippet below prints the name of all schemas in the appEntry application:

    ApplicationEntry app = ...; // find the right application
    SchemaFeed schemas = app.SchemaFeed;
    foreach (SchemaEntry schema in schemas.Entries)
    {
        Console.WriteLine("Schema: " + schema.Title.Text);
    }

How do I create a project?

    FormsService fs = ....;
    ApplicationQuery query = fs.CreateApplicationQuery(null);
    ApplicationFeed apps = fs.Query(query);
    ApplicationEntry app = apps.CreateEntry();
    app.Title.Text = "My First App";
    app = apps.Insert(app);

How do I find an existing project?

At this point you have to manually filter the entries in an ApplicationFeed. See the following snippet:

    FormsService fs = ....;
    ApplicationQuery query = fs.CreateApplicationQuery(null);
    ApplicationFeed apps = fs.Query(query);
    foreach(ApplicationEntry app in apps.Entries) 
    {
        if( app.Title.Text == "My First App" )
            return app.Id.Uri;
    }

How do I delete a project?

ApplicationEntry app = ...; // find the right application 
 
app.Delete();

How do I upload a project for a specific user?

First get a hold of the corresponding UserEntry for the desired user, and then use the users ApplicationFeed.

string fileName = ....;
UserEntry user = ....;
 
MediaFileSource source = new MediaFileSource(fileName, 
ApplicationFeed.MEDIA_SOURCE_TYPE);
 
ApplicationFeed apps = user.ApplicationFeed;
ApplicationEntry app = apps.CreateEntry();
 
app.MediaSource = source;
app = apps.Insert(app);

How do I upload a project?

string fileName = ....;
string appName = ....;
FormsService formsService = ....;
 
MediaFileSource source = new MediaFileSource(fileName, 
ApplicationFeed.MEDIA_SOURCE_TYPE);
 
ApplicationQuery query = formsService.CreateApplicationQuery(null);
ApplicationFeed apps = formsService.Query(query);
ApplicationEntry app = apps.CreateEntry();
app.MediaSource = source;
app = apps.Insert(app);

How do I rename a project?

String filename = ...;
ApplicationEntry app = ...; // find the right application 
 
app.Title.Text = appName;
app.Update();

The method ApplicationEntry.Update() is only available in .Net Client API version 5.1 Patch 3 and later.

How do I download a project?

FormsService formsService = ....;          
ApplicationEntry entry = ....;          
string fileName = ....;          
 
Stream contentStream = formsService.QueryContent(entry.Content);   
 
//if the Application needs to be written to a file:
using (FileStream fileStream = File.Create(fileName))
{
    contentStream.CopyTo(fileStream); 
} 

  

After I found a ApplicationEntry for the first time can I get the entry directly?

If you have an entry id you can retrieve the entry directly.

    string appId = ...;
    FormsService fs = ....;
    ApplicationEntry app = fs.GetApplication(appId);

How do I get the URL to a form so it can be embedded in my HTML pages?

First get a hold of the corresponding FormTypeEntry, then get the form URL as shown in the snipped below:

    FormTypeEntry formType = ...; // find the correct formtype entry
    string formTypeUrl = formType.FormTypeEmbedLink.AbsoluteUri;

Then using the URL in formTypeUrl above you can generate the following script tag in your html page:

<script type="text/javascript" src="{formTypeUrl}"></script>

This will embed the form in your page inside an <iframe/>.

How do I get the URL to the form designer so it can be embedded in my HTML pages?

First get a hold of the corresponding FormTypeEntry, then get the formType URL as shown in the snipped below:

    FormTypeEntry formType = ...; // find the correct formtype entry
    string designerUrl = formType.FormTypeEditorEmbedLink.AbsoluteUri;

Then using the designerUrl above you can generate the following script tag in your html page:

<script type="text/javascript" src="{designerUrl}"></script>

This will embed the form designer in your page inside an <iframe/>. 


How do I get the URL to the form submissions so it can be embedded in my HTML pages?

First get a hold of the corresponding FormTypeEntry, then get the form URL as shown in the snipped below:

    FormTypeEntry formType = ...; // find the correct formtype entry
    string formSubmissionsUrl = formType.SubmissionsEmbedLink.AbsoluteUri;

Then using the formSubmissionsUrl above you can generate the following script tag in your html page:

<script type="text/javascript" src="{formSubmissionsUrl}"></script>

This will embed the submissions view in your page inside an <iframe/>.

How do I get the URL to the form instance so it can be embedded in my HTML pages?

First get a hold of the corresponding FormTypeEntry, then get the form instance URL as shown in the snippet below:

FormTypeEntry formType = ....;
NameValueCollection nvc = null;
 
Uri formInstanceUri = formType.CreateFormInstance(nvc);
 
string formInstanceUrl = formInstanceUri.AbsoluteUri;

Then using the formInstanceUrl above you can generate the following iframe tag in your html page:

  <iframe   src="{formInstanceUrl}"/> 

This will embed the form instance in your page inside an <iframe/>. 

How do I get the URL to return the form instance embed java script?

First get a hold of the corresponding FormTypeEntry and then get the URL as shown in the snippet below:

FormTypeEntry formType = ...; // find the correct formtype entry

NameValueCollection nvc = new NameValueCollection();
nvc.Add("_data", "{TextArea3:TestTestTest}");

Uri formInstanceEmbedUri = formType.CreateFormInstanceEmbed(nvc, null);

String formInstanceUrl = formInstanceEmbedUri.AbsoluteUri;

Then using the formInstanceUrl above you can generate the following script tag in your html page:

  <script type="text/javascript"  
  src="{formInstanceUrl}"></script> 

This will embed the form instance in your page inside an <iframe/>. 

  • The method FormTypeEntry.CreateFormInstanceEmbed(NameValueCollection, params MediaSource[]) is only available in .Net Client API version 5.1 Patch 3 and later.
  • See this documentation for more information about available URL parameters.

How do I get a form entry based on a known id? 

This is often needed when you need to relate a frevvo form with another concept your application (e.g. you application has the concept of a report that has an associated frevvo form). In this case you will store the form id somewhere and when needed fetch the form entry to embed it in your page, delete it, etc.
Here is how you get the for a form entry (in fact any entry):

    FormTypeEntry formType = ...; // find an entry
    string formTypeId = formType.Id.Uri;

Here you can associate the formtype id with your application objects and retrieve the corresponding entry at any time as follows:

    string formtypeId = "....";
    FormTypeEntry formtype = service.GetFormType(formtypeId);

How do I delete a form (or any other entry)?

By calling the delete method on the FormTypeEnty.

    FormTypeEntry formType = ...;
    formType.Delete;

How do I create a new form?

First you have to get a hold of the form feed from an existing application. See How do I get the list of all forms for a given application?.

    FormsService service = ...;
    ApplicationEntry app = ...; // find an application
    FormTypeFeed formtypes = app.FormTypeFeed;
    FormTypeEntry formtype = formtypes.CreateEntry();
    formtype.Title.Text = name;
    formtype.Summary.Text = description;
    formtype = formtypes.Insert(formtype);

When inserting the original formtype variable will not' be updated and the updated entry will be returned by the Insert method.

How do I create a new form using an existing one as a template?

The only difference between creating a new form and creating a new one based on an existing form is that instead of using the entry created by calling 'ftFeed.createEntry()' you will be using an existing form entry. Find an existing form entry, update its name and description and use that entry to insert into a feed. Do not override the entry id otherwise the insert will fail.

    FormsService service = ...;
    ApplicationEntry app = ...; // find an application
    FormTypeFeed formtypes = app.FormTypeFeed;
    FormTypeEntry template = ...; // find template formtype entry
    // modify key template properties
    template.Title.Text = name;
    template.Summary.Text = description;
    FormTypeEntry formtype = formtypes.Insert(template);

How do I create a form instance?

 Use the code below to create a form instance: 

FormsService service = ...; 

string id = "_LIAtYHC3EeKVINiYeE5iPA!_qrSmgInoEeKOdqjLR19yFQ!test1"; 
FormTypeEntry formType = service.GetFormType(id); 
FormEntry form = formType.CreateFormEntry(); 

How do I create a form instance in edit mode?

FormsService service = ...; 

string id = "_LIAtYHC3EeKVINiYeE5iPA!_qrSmgInoEeKOdqjLR19yFQ!test1"; 
FormTypeEntry formType = service.GetFormType(id); 
FormEntry formEntry = formType.CreateEditingFormEntry();

The method FormTypeEntry.CreateEditingFormEntry is only available in .Net Client API version 5.1 Patch 3 and later.

How do I save edits to a form instance that was created in edit mode?

FormTypeEntry formType = ...; 

FormEntry formEntry = formType.CreateEditingFormEntry();

//make edits to form

formEntry.SubmitEdit();

The method FormEntry.SubmitEdit is only available in .Net Client API version 5.1 Patch 3 and later.

How do I cancel edits to a form instance that was created in edit mode?

FormTypeEntry formType = ...; 

FormEntry formEntry = formType.CreateEditingFormEntry(); 

//make edits to form 

formEntry.SubmitEdit(false);

The method FormEntry.SubmitEdit is only available in .Net Client API version 5.1 Patch 3 and later.

How do I create a form such that the document set is returned when the form is submitted?

First get a hold of the corresponding FormTypeEntry and then specify the _formActionDocs parameter as true when creating the FormEntry.

FormTypeEntry formTypeEntry = ...; // find the correct formtype entry

// request all data come back as part of the submit response 
NameValueCollection linkParams = new NameValueCollection();
linkParams.Add("_formActionDocs", "true");  
linkParams.Add("_data","{FirstName:TestA,LastName:TestB}");

FormEntry formEntry = formTypeEntry.CreateFormEntry(linkParams);

The _formActionDocs parameter is only supported by .Net Client API version 5.1 Patch 3 and later.

How do I receive the document set (including attachments) for the Form when submitted?  

FormEntry formEntry = ...; // created with the _formActionDocs param set to true

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;
}
  • The method FormEntry.SubmitInstance() will return null if the FormEntry was not created with the _formActionDocs parameter set to true.
  • The method FormEntry.SubmitInstance() is only available in .Net Client API version 5.1 Patch 3 and later.

How do I pre-populate values when creating an Instance? 

When creating a form instance, you can supply data to pre-populate fields.  There are a couple of ways to do this.  The first way is to supply a name value collection, which holds control names and values.  The second way is to supply an XML document, with control names and values. Suppose your form has two text fields, named A and B respectively.  Also, suppose you wish to prefill these 2 controls with values, as shown:

Example 1 – using a name value collection

 This example uses a special parameter named _data.  The value carries a formatted string containing the form values, as shown below.

FormsService service = ...; 

NameValueCollection nvc = new NameValueCollection(); 
nvc.Add("_data", "{A:TestA,B:TestB}");

string id = "_LIAtYHC3EeKVINiYeE5iPA!_qrSmgInoEeKOdqjLR19yFQ!test1"; 
FormTypeEntry formType = service.GetFormType(id);
FormEntry form = formType.CreateFormEntry(nvc); 

Example 2 – using an XML document

This example uses an XML document.  The document structure contains the form values which are to be applied, as shown below.

<ns:form xmlns:ns="http://www.frevvo.com/schemas/_lvxDAF_vEd2bxNL8keLevQ" 
         name="FormTypeAtomTest">
   <A>TestA</A>
   <B>TestB</B>
</ns:form> 

FormsService service = ...;

using (FileStream docStream = File.Open(@"C:\temp\_data.xml", FileMode.Open))
{
       string id = "_LIAtYHC3EeKVINiYeE5iPA!_qrSmgInoEeKOdqjLR19yFQ!test1"; 
       FormTypeEntry formType = service.GetFormType(id);
       FormEntry form = formType.CreateFormEntry(docStream);
} 

Example 3 – using link parameters and an XML document

<ns:form xmlns:ns="http://www.frevvo.com/schemas/_lvxDAF_vEd2bxNL8keLevQ" 
 
         name="FormTypeAtomTest"> 
    <A>TestA</A>
    <B>TestB</B>
    <C>2013-06-30</C>
</ns:form> 

FormsService service = ...; 
NameValueCollection nvc = new NameValueCollection();
nvc.Add("_formTz", "Asia/Kolkata");


using (FileStream docStream = File.Open(@"C:\temp\_data2.xml", FileMode.Open))
{
      string id = "_LIAtYHC3EeKVINiYeE5iPA!_qrSmgInoEeKOdqjLR19yFQ!test1"; 
      FormTypeEntry formType = service.GetFormType(id);
      FormEntry form = formType.CreateFormEntry(nvc, docStream);
}
  • The method FormTypeEntry.CreateFormEntry(NameValueCollection, Stream) is only available in .Net Client API version 5.1 Patch 3 or later.
  • See this documentation for more information about available URL parameters.

Example 4 – using link parameters and multiple files

<ns:form xmlns:ns="http://www.frevvo.com/schemas/_lvxDAF_vEd2bxNL8keLevQ"         
         name="FormTypeAtomTest">
    <A>TestA</A>
    <B>TestB</B>
    <C>2013-06-30</C> 
</ns:form> 

<p0:form xmlns:p0="http://www.frevvo.com/schemas/_RErWMNR6EeKYJfUGgkkEjg"> 
   <Section518>
      <Name>test1</Name>
   </Section518>
</p0:form>

FileStream customerDataXml = new FileStream(file1_path,FileMode.Open);
FileStream signText = new FileStream(file2_path, FileMode.Open);

FormsService service = ...;
NameValueCollection nvc = new NameValueCollection();
nvc.Add("_formTz", "Asia/Kolkata");

string id = "_LIAtYHC3EeKVINiYeE5iPA!_qrSmgInoEeKOdqjLR19yFQ!test2"; 
FormTypeEntry formType = service.GetFormType(id);        
FormEntry formEntry = formTypeEntry.CreateFormEntry(nvc,            
                    new MediaFileSource(customerDataXml, "customer", "application/xml"),                  
                    new MediaFileSource(signText, "form", "application/xml"));


customerDataXml.Dispose();
signText.Dispose();
  • The method FormTypeEntry.CreateFormEntry(NameValueCollection, params MediaSource[]) is only available in .Net Client API version 5.1 Patch 3 or later.
  • See this documentation for more information about available URL parameters.

How do I edit a form control?

Suppose you have a form with controls named A and B.  Further, suppose the form is initially empty, and you wish to programmatically set the control values to TestA and TestB respectively.  First you have to get a hold of the form instance (see 'How do I create a form instance?).

FormEntry form = ...;

ControlEntry controlA = form.FindControlEntry("A");
controlA.Value = "TestA";
ControlEntry controlB = form.FindControlEntry("B");
controlB.Value = "TestB";  

Objects, of any kind, that are part of a workflow cannot access the list of controls for the workflow.  Attempted access of FormTypeEntry.ControlTypeFeed, FormTypeEntry.ControlTypeFeedLink, FormEntry. ControlFeed, or FormEntry.ControlFeedLink will result in a NotSupportedException.

How do I submit a form?

First you have to get a hold of the form instance (see 'How do I create a form instance?). When you are finished editing your form, you may submit it as follows:

FormEntry form = ...; 
SubmissionEntry submission = form.Submit(); 

How can I print a submission as PDF (if no snapshot was saved)?

First you have to get a hold of the form instance (see 'How do I create a form instance?).

FormEntry form = ...;
SubmissionEntry submission = form.Submit(); 
using (Stream file = File.OpenWrite("C:\temp"))
{
submission.PrintFormInstance(file);
}

Printing objects of any kind that are part of a workflow is not supported and will result in a NotSupportedException.  

How can I save a form for working on later?

First you have to get a hold of the form instance (see 'How do I create a form instance?).

FormEntry form = ...; 
form.Save(); 

How can I resume working on a form I saved earlier?

Suppose you saved a form as in the above example.  Now, suppose you want to resume working on the form.  When you save a form, it becomes available for retrieval via the task feed.

string userName = "someUserName";
FormsService service = ...;

UserEntry userEntry =
service.GetUser(userName);

//NOTE: there may be multiple
entries in the TaskFeed list.  The last
entry in the list is the most recently added item. 
TaskEntry taskEntry = userEntry.TaskFeed.Entries[0] as TaskEntry;  

FormEntry form =
taskEntry.CreateFormInstance(); 

How do I upload an XSD Schema?

You can upload XSD schemas using the following code. Note that if the xsd being uploaded consists of multiple files you must upload the dependencies one by one making sure you start with the one without any dependencies, i.e. only upload schemas when all its dependencies are already uploaded.

    // Need an application to upload a schema
    ApplicationEntry app = ....;

    // create a mediasource to the xsd file
    string fileName = "\path\to\myschema.xsd";
    MediaFileSource source = new MediaFileSource (fileName, SchemaFeed.MEDIA_SOURCE_TYPE);

    // create a SchemaEntry 
    SchemaFeed schemas = app.SchemaFeed;
    SchemaEntry newSchema = schemas.CreateEntry ();

    // set the entry's media source
    newSchema.MediaSource = source;

    // perform the upload
    newSchema = schemas.Insert (newSchema);

How do I query the DocumentType's for a SchemaEntry?

You can list all the DocumentType's contained in a SchemaEntry by using the following code. Why would you want to do that? You use Schema DocumentType's to add to FormType's so controls can be auto-generated from it.

    SchemaEntry schema = ....; // got the schema somehow (maybe uploaded, maybe you    queried the existing schemas)
    DocumentTypeFeed docTypes = schema.DocumentTypeFeed;
    foreach( DocumentTypeEntry docType in docTypes.Entries )
    {
        Console.WriteLine(docType);
    }

How do I add a Schema DocumentType to a FormType?

Let's say I have a purchase order xsd and would like to auto generate a form for it. Let's say that I already uploaded the xsd and have a SchemaEntry at hand.

    ApplicationEntry app = ...; //
    SchemaEntry schema = ... ; // go the schemaentry somehow
    DocumentTypeFeed xsdDocTypes = schema.DocumentTypeFeed;
    DocumentTypeEntry xsdDocType = null;
    foreach(DocumentTypeEntry current in xsdDocTypes.Entries)
    {
        if( current.Title.Text == "http://myschema.com#purchaseorder" )
            srcDocType = current;
    }

    // create an empty form
    FormTypeFeed fts = app.FormTypeFeed;
    FormTypeEntry ft = fts.CreateEntry();
    ft.Title.Text = "My Purchase Order Form";
    ft = fts.Insert(ft);

    // Create a FormType DocumentTypeEntry based on the xsd one
    DocumentTypeFeed ftDocTypes = ft.DocumentTypeFeed;
    DocumentTypeEntry ftDocType = ftDocTypes.CreateEntry(xsdDocType);

    // add the schema DocumentType to the form
    ftDocType = ftDocTypes.Insert(ftDocType);

Now you have a new form named My Purchase Order Form and you have the purchase order element added to the Data Source pane in the Designer. Using the designer, expand the Data Source pane and click the plus button to auto-generate the form controls (note that the API will be expanded to support auto generating controls).

I added a DocumentType from a Schema to my FormType. Why do I see two DocumentTypes?

Every FormType always has 1 default DocumentType that cannot be removed. This is the DocumentType managed by frevvo and updated when controls from the palette are added or removed from the form. For this DocumentType the Delete() method will fail (you can check whether a DocumentType can be deleted or not using the entry's ReadOnly property).

How do I delete a FormType DocumentType that was added from Schema?

The following code will remove all FormType DocumentTypes that were added from Schema:

    FormTypeEntry ft = ...;
    DocumentTypeFeed docTypes = ft.DocumentTypeFeed;
    foreach(DocumentTypeEntry docType in docTypes.Entries )
    {
        if( !docType.ReadOnly )
            docType.Delete(); // not read-only so this must be from schema
    }

How do I set a form's Deployment State?

    FormTypeEntry ft = ...;
    ft.DeployState = DeployState.Production;
    // or
    ft.DeployState = DeployState.Development;

How do I copy a form?

Copying entails inserting an existing entry into a feed. The key difference between this case and a regular feed insert() is that the entry being inserted already has an id: this will trigger a copy.

    FormTypeEntry entry = ...;
    
    FormTypeFeed targetFeed = ...;
    FormTypeEntry copy = targetFeed.CreateEntry(); 
    copy.Id = entry.Id; 
    copy.Title.Text = "My copy"; 
    copy = targetFeed.Insert(copy); 

Functions only available in .net client API version 5.2 or later

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

How do I upload a project for a specific user?

There are three options when uploading a project for a user: Insert, Copy or Replace: 

string fileName = ....;
UserEntry user = ....; 
 
// If an entry with the same id already exists, it will be replaced.
// Otherwise, the archive will be uploaded with the same id.
ApplicationEntry entry = user.ApplicationFeed.UploadAndReplaceApplication(fileName); 
 
// If an entry with the same id already exists, it will be copied.
// Otherwise, the archive will be uploaded with the same id.
ApplicationEntry entry = user.ApplicationFeed.UploadAndCopyApplication(fileName); 
 
// If an entry with the same id already exists, it will be copied. 
// Otherwise, the archive will be uploaded with a new id.
ApplicationEntry entry = user.ApplicationFeed.UploadAndInsertApplication(fileName); 

How do I update the ElementName for a Form or Workflow?

FormTypeEntry fe = TestApplication.FormTypeFeed.CreateEntry();
fe.ElementName = "test";
TestApplication.FormTypeFeed.Insert(fe);. 

Update the ElementName property: 

fe.ElementName = "TemporaryForm";
fe.Update(); 

How do I upload a form/workflow?

There are three options when uploading a workflow or form: Insert, Copy or Replace:

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);  

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. 

FormTypeEntry formTypeEntry = ....; 

// request 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 frevvo v5.3 or later:

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?

string scriptFileName = ....; 
ApplicationEntry appEntry = ....;
 
appEntry.SetScript(scriptFileName);

How do I Delete a custom script?

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

How do I Download a custom script?

ApplicationEntry appEntry = ....; 

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

How do I Upload a Style?

string styleFileName = ....; 
bool doReplace = ....;

StyleFeed feed = TestUser.StyleFeed;


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

How do I Delete a Style?

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:

UserEntry testUser = ....;
StyleFeed userStyleFeed = testUser.StyleFeed;
foreach (StyleEntry entry in userStyleFeed.Entries) 
{
Console.WriteLine("Style: " + style.Title.Text);
}

Or you can Query via the FormsService class:

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 Workflow?

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

formTypeEntry.Update();  

How do I upload a form/workflow?

There are three options when uploading a workflow or form: Insert, Copy or Replace. You can use a Stream or a file path location when uploading.

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 = ....;
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?

string signaturePictFile = ....;
string signatureXmlFile = ....; 
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;
}

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

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:

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

/// Add a Document to this builder from a given stream

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

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

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

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

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

/// Add an xml signature to this builder from a given stream

public FormEntryBuilder DigitalSignature(Stream inputStream, string contentType, string
fileName) 

This method deprecates the previous method:

public FormEntryBuilder DigitalSignature(Stream inputStream, string contentType)

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

FormTypeEntry fte = ….; 

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

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

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:

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:

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 frevvo v6.1.5 or later:

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?

Users csv upload through the .net client api 

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

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:

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:

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.

What do I do if API submission access fails?

Ensure the form/workflow submissions you are trying to access has either the userid or Roles that the user is a member of in "Who can view submissions" ACL.

How do I use the Security Manager Built-In Admin?

LDAP, SAML, and SAML Azure Security Managers provide a built-in admin login directly to frevvo, which is helpful if your security manager logins should become inaccessible and you need to access frevvo.  This built in admin is automatically enabled from the API when using SAML, but for LDAP it needs to be explicitly enabled by setting the custom property "backdoorLogin" to true in the loginAs call. This will allow the API to login in the same way a built in admin can login using /frevvo/web/admin/login.

service.loginAs("loginAsUser", "adminuser@tenant"), "????", true, null, null, null, null, Map.of("backdoorLogin", "true"));