List items

Get a list of documents. The first parameter is the parentid which is the Id of a FM.  
After the parentid the search field can be passed
  • name or null
  • status or -1
  • userstatus or -1
  • created or 0 (the unix long millisec since 1970 is expected )
The list return MgmtItem objects which represent a document
 
List<MgmtItem> list = con.listItems(parentid, null, -1, -1, 0, MgmtAPI.SORT_CREATED, true);
for(int i = 0; i < list.size(); i++){
	MgmtItem item = list.get(i);
	String name = item.getName();
	String id = item.getId();
	String pool = item.getInfo();
	int status = item.getStatus();
}

Note the list does not return all details such as extra fields and attachments. To get the complete document the getItemDeep is used. 

MgmtItem item = con.getItemDeep(parentid, id);

Now attachments and extra fields can be retrieved

int count = item.getAttachmentCount();
MgmtAttachment att = item.getAttachment(0);

Still the actual attachment file must be downloaded with a separate method.
The second parameter is the id of the attachment and the last is a file path which will be the name of the downloaded

con.getFile(parentid, att.getId(), "c:\\temp\\myfile.txt");