Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 7

.

NET API Demo Sample Application for


P8 Content Engine
© Copyright IBM Corporation 2007, 2014 ALL RIGHTS RESERVED.

Overview

This C# sample application demonstrates the capabilities of the Content Engine running
under the FileNet P8 Platform. Note that this code sample relies on the Content
Engine .NET API, which interacts with the server through the Content Engine Web
Services Interface (WSI). Operations demonstrated include:
1. Configuring the server
2. Creating a document
3. Getting a document
4. Creating a folder
5. Creating a custom object
6. Getting a custom object
7. Creating a compound document
8. Getting a compound document
9. Creating an ad-hoc query

You’ll find additional information about these operations in the Content Engine Java
and .NET Developer’s Guide, available in the IBM Knowledge Center.

Contents

This sample code distribution contains the following files:


 Readme: Installation and usage instructions (this file)
 Visual Studio project files
 Source Files:
The following source files were coded and commented by IBM. Source files that
are included with the project but not listed here were generated by Visual Studio.
o AdhocQueryForm.cs: Creates an ad-hoc query
o CEConnection.cs: CE connection class
o CEUtil.cs: Utility class
o CreateCompoundDocForm.cs: Creates a compound document
o CreateCustomObjectForm.cs: Creates a custom object
o CreateDocForm.cs: Creates a new document
o CreateFolderForm.cs: Creates a new folder.
o GetCompoundDocForm.cs: Gets a compound document.
o GetCustomObjectForm.cs: Gets a custom object
o GetDocForm.cs: Gets a new document.
o MainForm.cs: Main UI class.
Prerequisites

 Content Engine installed with a domain and at least one object store created.
 A Windows® client machine that has the following installed:
● Microsoft .NET 4.0 Framework or higher. .NET 4.0 or higher frameworks
contain the Windows Communication Foundation (WCF).

WCF requires a secure HTTPS connection. To run this sample application


with WCF, you must import the SSL certificate from the Content Platform
Engine server to the client workstation. Download the server certificate, and
import it into a certificate store using the Certificate MMC snap-in. For
example, you can import the certificate into the Trusted People certificate
store.

Alternatively, to run the sample application with an unsecured HTTP


connection, Microsoft Web Service Extensions (WSE) 3.0 must also be
installed along with the .NET framework.
● Content Engine .NET API (FileNet.Api.dll). The DLL is located in this
Content Engine directory: <drive>:\FileNet\ContentEngine. If you will be
building and running the sample application on a different machine, you
must copy FileNet.Api.dll to that machine.
● Microsoft Visual Studio 2010 or higher (needed to build the app, not to run
it)

Building the Application

To build the sample application, use the following steps:


1. Open the application project in Visual Studio by double clicking the Demo.sln file.
2. In the Solution Explorer pane, verify that the References include the .NET
Framework class library (System.*), the Content Engine .NET API (FileNet.Api), and
Microsoft.Web Service Extensions (WSE) 3.0 (Microsoft.Web.Services3).
Note: You need Microsoft.Web Service Extensions (WSE) 3.0 only if you run the
sample application with an unsecured HTTP connection.
3. If references are missing, add them by selecting “Add Reference…” from the Project
menu.

If the Content Engine .NET API is missing, select FileNet.Api from the .NET tab of
the Add Reference dialog and click OK. If FileNet.Api does not appear on the .NET
tab, then switch to the Browse tab, navigate to the location of FileNet.Api.dll, select
it, and click OK.

If you are building on the same machine where the Content Engine is installed, you’ll
find FileNet.Api.dll in the <drive>:Program Files\FileNet\ContentEngine directory.
4. To build the application, choose Build Solution from the Build menu.

Running the Application


Run the sample application by either launching it through Microsoft Visual Studio, or by
double clicking on the CESample.exe file that is generated by building the sample.

Once launched, the application’s main form appears, prompting for the URL of the server
to which to connect.

Enter the URL, substituting the placeholders with actual values for your system. The
default HTTP or HTTPS port for WebLogic is 7001 or 7002; the default HTTP or HTTPS
port for WebSphere is 9080 or 9443; the default HTTP or HTTPS port for JBoss servers
is 8080 or 8443.

Also enter a valid username and password for your system.

Click the Connect button. If connection to the server is successful, a set of buttons
appear on the bottom of the window. Clicking a button takes you to a form that
demonstrates a basic API operation.

Using the Application

The following sections describe each of the forms available in the Demo application.

Creating a Document
To create a document, select the Create Doc button from the main form, enter
information in the following fields, and click the Create button.
 Select OS: Click the radio button and select an object store.
 Document Title: The title of the document (sets the DocumentTitle property).
 Include content: If you wish the new document to hold content, select this check
box and use the Browse button to select the location of the file containing the
content.
 MIME Type: If you have selected the above check box, enter the mime type of
the content. Default is “text/plain”.
 Document Class: Enter the document class for the new document. Default is
Document.
 File in Folder: If you wish to file the new document in a folder, select this check
box and enter the name of the folder. The default is “/”.
 Check In: If you wish to check-in the new document, select this check box.

Getting a Document
To get a document, select the Get Doc button from the main form, enter information in
the following fields, and click the Get button.
 Select OS: Click the radio button and select an object store.
 By Path: Specify the path of the document.
 By ID: Specify the ID of the document.
 Include content: If you wish to get the new document content, select this check
box and use the Browse button to select the directory where the file containing the
document content is to be located.
 Include ACL: If you wish to see the ACL (Access Control List) for the document,
select this check box.

Creating a Folder
To create a folder, select the Create Folder button from the main form, enter information
in the following fields, and click the Create button.
 Select OS: Click the radio button and select an object store.
 Name: The name of the folder (setting of the FolderName property).
 Parent Folder: The folder in which the new folder will be created (setting of the
Parent property). To specify the root, enter “/”.
 Folder Class: The folder class of the new folder.

Creating a Custom Object


To create a custom object, select the Create CustomObject button from the main form,
enter information in the following fields, and click the Create button.
 Select OS: Click the radio button and select an object store.
 Object Class: The object class to be created. Default is CustomObject. If you
enter a nonexistent class, the sample will throw an exception.

The sample does not support custom classes that include custom properties.
 File in Folder: If you wish to file the new custom object in a folder, select this
check box and specify the folder name (e.g. “/”).

Getting a Custom Object


To get a custom object, select the Get CustomObject button from the main form, enter
information in the following fields, and click the Get button.
 Select OS: Click the radio button and select an object store.
 By Path: Specify the path of the custom object.
 By ID: Specify the ID of the custom object.

Creating a Compound Document


To create a compound document, select the Create CompoundDoc button from the main
form, enter information in the following fields, and click the Create button.
 Select OS: Click the radio button and select an object store.
 Parent Document Title: The parent document to be included in a new compound
document.
 Child Doc Title: The child document to be included in a new compound
document.

Getting a Compound Document


To get a compound document, select the Get CompoundDoc button from the main form,
enter information in the following fields, and click the Get button.
 Select OS: Click the radio button and select an object store.
 Specify ID: Specify the ID of the compound document.
Creating an Adhoc Query
To create and execute an SQL query, select the Adhoc Query button from the main form,
enter information in the following fields, and click the Query button.
 SELECT: Enter the SELECT clause of the query.
 FROM: Enter the FROM clause of the query.
 WHERE: Enter the WHERE clause of the query.
 Max Rows: If you don’t want to return all of the result rows, select the check box
and enter the maximum number of rows to return.

If the query is successful, its results will be displayed.

Notices

This information was developed for products and services offered in the U.S.A.

IBM may not offer the products, services, or features discussed in this document in other
countries. Consult your local IBM representative for information on the products and
services currently available in your area. Any reference to an IBM product, program, or
service is not intended to state or imply that only that IBM product, program, or service
may be used. Any functionally equivalent product, program, or service that does not
infringe any IBM intellectual property right may be used instead. However, it is the user's
responsibility to evaluate and verify the operation of any non-IBM product, program, or
service.

IBM may have patents or pending patent applications covering subject matter described
in this document. The furnishing of this document does not grant you any license to these
patents. You can send license inquiries, in writing, to:

IBM Director of Licensing


IBM Corporation
North Castle Drive
Armonk, NY 10504-1785
U.S.A.

For license inquiries regarding double-byte (DBCS) information, contact the IBM
Intellectual Property Department in your country or send inquiries, in writing, to:

Intellectual Property Licensing


Legal and Intellectual Property Law
IBM Japan, Ltd.
3-2-12, Roppongi, Minato-ku, Tokyo 106-8711 Japan

The following paragraph does not apply to the United Kingdom or any other
country where such provisions are inconsistent with local law: INTERNATIONAL
BUSINESS MACHINES CORPORATION PROVIDES THIS PUBLICATION "AS IS"
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF NON-
INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
PURPOSE. Some states do not allow disclaimer of express or implied warranties in
certain transactions, therefore, this statement may not apply to you.

This information could include technical inaccuracies or typographical errors. Changes


are periodically made to the information herein; these changes will be incorporated in
new editions of the publication. IBM may make improvements and/or changes in the
product(s) and/or the program(s) described in this publication at any time without notice.

Any references in this information to non-IBM Web sites are provided for convenience
only and do not in any manner serve as an endorsement of those Web sites. The materials
at those Web sites are not part of the materials for this IBM product and use of those Web
sites is at your own risk.

IBM may use or distribute any of the information you supply in any way it believes
appropriate without incurring any obligation to you.

Licensees of this program who wish to have information about it for the purpose of
enabling: (i) the exchange of information between independently created programs and
other programs (including this one) and (ii) the mutual use of the information which has
been exchanged, should contact:

IBM Corporation
J46A/G4
555 Bailey Avenue
San Jose, CA 95141-1003
U.S.A.

Such information may be available, subject to appropriate terms and conditions,


including in some cases, payment of a fee.

The licensed program described in this document and all licensed material available for it
are provided by IBM under terms of the IBM Customer Agreement, IBM International
Program License Agreement or any equivalent agreement between us.

Any performance data contained herein was determined in a controlled environment.


Therefore, the results obtained in other operating environments may vary significantly.
Some measurements may have been made on development-level systems and there is no
guarantee that these measurements will be the same on generally available systems.
Furthermore, some measurements may have been estimated through extrapolation. Actual
results may vary. Users of this document should verify the applicable data for their
specific environment.

Information concerning non-IBM products was obtained from the suppliers of those
products, their published announcements or other publicly available sources. IBM has not
tested those products and cannot confirm the accuracy of performance, compatibility or
any other claims related to non-IBM products. Questions on the capabilities of non-IBM
products should be addressed to the suppliers of those products.

All statements regarding IBM's future direction or intent are subject to change or
withdrawal without notice, and represent goals and objectives only.

COPYRIGHT LICENSE:

This information contains sample application programs in source language, which


illustrate programming techniques on various operating platforms. You may copy,
modify, and distribute these sample programs in any form without payment to IBM, for
the purposes of developing, using, marketing or distributing application programs
conforming to the application programming interface for the operating platform for
which the sample programs are written. These examples have not been thoroughly tested
under all conditions. IBM, therefore, cannot guarantee or imply reliability, serviceability,
or function of these programs. The sample programs are provided "AS IS", without
warranty of any kind. IBM shall not be liable for any damages arising out of your use of
the sample programs.

Trademarks

 The following terms are trademarks or registered trademarks of International


Business Machines Corporation in the United States, other countries, or both:
o IBM
o WebSphere
 FileNet is a registered trademark of FileNet Corporation, in the United States,
other countries, or both.
 Microsoft and Windows are registered trademarks of Microsoft Corporation in the
United States, other countries, or both.
 Other company, product, or service names may be trademarks or service marks of
others.

You might also like