Insert Documents into FileNetP8
The connector's insert
fetch action can insert documents into the FileNetP8 repository. The object created in the repository will be an instance of the "Document" class, will have file content, and can have metadata.
To use the insert
action, you must construct some XML that specifies where to add each document, and the information to insert. Add the XML to the action as the value of the insertXML
action parameter.
To insert a document, include the following information in the XML:
reference
|
(Required) The title of the new document created in the repository. If a file of the same name already exists in the repository the result will be two files with the same name, because names do not have to be unique. |
ObjectStore property |
(Required) The name of the object store in which to insert the document. |
Folder property |
(Required) The path of the folder in which to insert the document. The path must be a path to an existing folder. |
The following example inserts a document into the folder MyFolder/Subfolder
, in the object store P8ConfigObjectStore
:
<insertXML> <insert> <reference>Inserted Document.txt</reference> <property name="ObjectStore" value="P8ConfigObjectStore"/> <property name="Folder" value="My Folder/Subfolder"/> <file> <type>file</type> <content>C:\Documents\Document.txt</content> </file> </insert> </insertXML>
The <file>
element includes information about the source for the document content. There are several ways in which you can specify the content. For more information, refer to the FileNet P8 Connector Reference.
You can also specify metadata to insert with the document. The "Document" class has a set of default fields, and you can configure more. You can only set fields that have been defined. To set values for metadata fields, use metadata
elements in the XML:
<insertXML> <insert> <reference>Inserted Document with Metadata.txt</reference> <property name="ObjectStore" value="P8ConfigObjectStore"/> <property name="Folder" value="My Folder"/> <metadata name="MyString" value="A String"/> <metadata name="MyString2" value="A second String"/> <metadata name="MyBool" value="true"/> <metadata name="MyInt" value="7"/> <metadata name="MyFloat" value="3.14159"/> <metadata name="MyDate" value="Thu Nov 06 10:45:23 GMT 2014"/> <metadata name="MyId" value="{21115100-0D96-4380-81F0-CAA997E230A8}"/> <file> <type>file</type> <content>C:\Documents\Document.txt</content> </file> </insert> </insertXML>
The XML must be URL encoded before being used in the action command. For example:
http://host:port/action=Fetch&FetchAction=Insert &ConfigSection=MyTask &InsertXML=[URL encoded XML]
For more information about using the insert
fetch action, refer to the FileNet P8 Connector Reference.