onPhase Forms latest - This documentation is for onPhase Forms v11.3. Not for you? Earlier documentation is available too.
FAQ - .Net Client API
On this page:
- 1 How do I login/logout to/from a Form server?
- 2 How do I get the list of all themes for the current user?
- 3 How do I get the list of all forms for the current user?
- 4 How do I get the list of all forms for a given project?
- 5 How do I get the list of all schemas for the current user?
- 6 How do I get the list of all schemas for a given project?
- 7 How do I create a project?
- 8 How do I find an existing project?
- 9 How do I delete a project?
- 10 How do I upload a project for a specific user?
- 11 How do I upload a project?
- 12 How do I rename a project?
- 13 How do I download a project?
- 14 How do I get the URL to a form so it can be embedded in my HTML pages?
- 15 How do I get the URL to the form designer so it can be embedded in my HTML pages?
- 16 How do I get the URL to the form instance so it can be embedded in my HTML pages?
- 17 How do I get the URL to return the form instance embed java script?
- 18 How do I get a form entry based on a known id?
- 19 How do I delete a form (or any other entry)?
- 20 How do I create a new form?
- 21 How do I create a new form using an existing one as a template?
- 22 How do I create a form instance?
- 23 How do I create a form instance in edit mode?
- 24 How do I save edits to a form instance that was created in edit mode?
- 25 How do I cancel edits to a form instance that was created in edit mode?
- 26 How do I create a form such that the document set is returned when the form is submitted?
- 27 How do I receive the document set (including attachments) for the Form when submitted?
- 28 How do I pre-populate values when creating an Instance?
- 29 How do I edit a form control?
- 30 How do I submit a form?
- 31 How can I get the submissions for a Form/Workflow?
- 32 How can I print a submission as PDF (if no snapshot was saved)?
- 33 How can I save a form for working on later?
- 34 How can I resume working on a form I saved earlier?
- 35 How do I upload an XSD Schema?
- 36 How do I query the DocumentType's for a SchemaEntry?
- 37 How do I add a Schema DocumentType to a FormType?
- 38 I added a DocumentType from a Schema to my FormType. Why do I see two DocumentTypes?
- 39 How do I delete a FormType DocumentType that was added from Schema?
- 40 How do I set a form's Deployment State?
- 41 How do I copy a form?
- 42 Functions only available in .net client API version 5.2 or later
- 43 Functions only available in the .net api for frevvo v5.3 or later:
- 43.1 How do I Upload a custom script?
- 43.2 How do I Delete a custom script?
- 43.3 How do I Download a custom script?
- 43.4 How do I Upload a Style?
- 43.5 How do I Delete a Style?
- 43.6 How do I get the list of Styles for the current user?
- 43.7 How do I set the Style property for a Form or Workflow?
- 43.8 How do I upload a form/workflow?
- 43.9 How do I use FormEntryBuilder convenience class to reinstantiate forms with signatures for submission?
- 44 Functions only available in the .net api for frevvo v6.1.2 or later:
- 44.1 Ability to create a new form instance using an alternate service/user:
- 44.2 Addition of required fileName parameter to stream-based FormEntryBuilder methods:
- 44.3 Add a Document to the builder from a given stream
- 44.4 Get the Raw Link to the form/workflow from the FormTypeEntry:
- 44.5 Add convenience method to upload schema file(s) in zip form:
- 44.6 Added convenience method to upload Schema file(s) in .xsd file form:
- 44.7 Added convenience method to upload Schema file(s) in MediaSource form:
- 45 Functions only available in the .net api for frevvo v6.1.5 or later:
- 46 What do I do if API submission access fails?
- 47 How do I use the Security Manager Built-In Admin?
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 log in, 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 log in 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 an 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;