Versions Compared

Key

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

 

On this page:

...

Note

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 applications for the current user?

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

...

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

How do I upload an Application for a specific user?

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

...

Code Block
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.

...

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:

...

Note

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?

...

  

Code Block
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;
}
Note
  • 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:

...

Note
  • 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?).

...

Note

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

How do I upload an Application for a specific user?

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

Code Block
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 Flow?

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

...

There are 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 = ....;
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);  

...