Versions Compared

Key

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

On this page:

Table of Contents
maxLevel2

Note

In v9.1 and later '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?

...

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 new 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 quite convenient useful when you want to login using the same user that is logged into your application project without having to know their password.

...

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  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 projects 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
    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:

...

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

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

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

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

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

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

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

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

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

How do I download

...

a project?

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

...

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

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

...

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?  

...

Note

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 an application for a project for a user: Insert, Copy or Replace: 

...

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.

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

...

 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.

...