Prerequisite: FileNet IDM Desktop should be installed in the client machine. Add fnnfo.tbl as reference from "C:\Program Files\FileNet\idm\fnnfo.tbl".
GetCachedFile function is the best function to use for this purpose. It returns the path to the document after it is retrieved to the local cache. Please refer to the IDM Desktop and Web Services Toolkit Help file for more details on its usage.
- Be aware that since the file resides in the local cache, you should copy it as soon as possible, because the Cache Manager may delete it to make room for other documents.
- Also make sure to copy the file - never move or delete, since this will probably cause an abort with the Cache Manager.
- You also need to know which product you are using and where it is running. If you are using IdmWs, the local cache is on the web server box. If using IdmDesktop, the local cache is on the client. This confuses many people.
- Lastly, a program like this can quickly overwhelm your system. Make sure your ephemeral ports are set to maximum. If you start experiencing errors after processing a large quantity of documents, this is usually an indicator that you have exhausted your system's resources. The only solution is to slow your code loop down.
Below is a simple application which takes the document ID from a textbox and saves the image retrieved from the FileNet Image server to c:\temp for that corrosponding document ID.
public partial class Form1 : Form
public static Object objMissing = System.Reflection.Missing.Value;
public static IDMObjects.Neighborhood fnNebHood;
public static IDMObjects.Library fnLibrary;
public static IDMObjects.GenericObject fnGenericObj;
public static IDMObjects.Document fnDoc;
public static IDMObjects.idmObjectType fnObjectType;
public static string fnCache ;
private void button1_Click(object sender, EventArgs e)
string fnUid = "your filenet userid";
string fnPwd = "your filenet password";
fnLibrary = new IDMObjects.Library();
fnLogon = fnLibrary.Logon(fnUid, fnPwd, objMissing,
fnLogon = true;
catch (Exception ex)
MessageBox.Show(ex.ToString(), "FileNet Login Error");
string docID = textBox1.Text;
public void SaveDoc(string argDocid)
fnObjectType = IDMObjects.idmObjectType.idmObjTypeDocument;
fnGenericObj = fnLibrary.GetObject(fnObjectType, argDocid,
objMissing, objMissing, objMissing);
fnDoc = (IDMObjects.Document)fnGenericObj;
int pagec = fnDoc.PageCount;
catch (Exception ex)
string fileNm = fnDoc.GetCachedFile(0, "",
string name = fnDoc.Name;
string onlyName = fnDoc.Name;
string destFile = "C:\\Temp\\" + name + "_1.tif";
If your document is a multiple page .tif image, then set the first argument of
GetCachedFile() to the page number which you want to fetch. Else you can loop that function for the
pageCount to retrieve all the images.