// loop through all documents  in a given collection
Document imageDoc = col.getFirstDocument();
Document tmpImageDoc = null;  

while  (imageDoc != null) {

	String  documentIdentifier = imageDoc.getItemValueString("DocID");

	// check for embedded Objects
	if(imageDoc.hasEmbedded()) {

		// Notes v2 attachment style
		Vector allItems = imageDoc.getItems();
		Iterator it = allItems.iterator();

		while (it.hasNext()) {
			
			// check  for attachment item
			Item element = (Item) it.next();
			
			if(element.getType()  == Item.ATTACHMENT) {
				
				// retrieve filename
				String name = element.getValueString();
				EmbeddedObject eo = imageDoc.getAttachment(name);
				
				// extract file to disk
 				// be sure to have an existing directory
				File tmpPathCreate = new File("c:\\Export\\" + documentIdentifier +  "\\");
				if(!tmpPathCreate.exists())  {
					tmpPathCreate.mkdirs();
				}

				eo.extractFile("c:\\Export\\"  + documentIdentifier + "\\" + eo.getSource());
 			}
 		}
 	}

	// memory management
	// notes objects have to be
	// recycled - gc doesn't know about
	// heavy weight c++ objects
 	tmpImageDoc  = col.getNextDocument(imageDoc);
 	imageDoc.recycle();
	imageDoc = null;
	imageDoc = tmpImageDoc;
}