Estou utilizando a API java-libpst, mas ainda estou com dúvidas, pois não encontrei nada a respeito, e quero algumas sugestões. O código está da seguinte forma:
import java.util.Vector;
import com.pff.PSTException; import com.pff.PSTFile; import com.pff.PSTFolder;
public class ArquivoPst {
public static void main(String[] args) {
}
public ArquivoPst(String filename) {
try {
PSTFile pstFile = new PSTFile(
"/home/nanodata-karolineleite/Testes/LeitorPst/ArquivoPst/pst temporario.pst");
System.out.println(pstFile.getMessageStore().getDisplayName());
processFolder(pstFile.getRootFolder());
} catch (Exception err) {
err.printStackTrace();
}
}
int depth = -1;
private Object email;
public void processFolder(PSTFolder folder) throws PSTException, java.io.IOException {
depth++;
if (depth > 0) {
printDepth();
System.out.println(folder.getDisplayName());
}
// go through the folders...
if (folder.hasSubfolders()) {
Vector<PSTFolder> childFolders = folder.getSubFolders();
for (PSTFolder childFolder : childFolders) {
processFolder(childFolder);
}
}
}
private void printDepth() {
for (int x = 0; x < depth - 1; x++) {
System.out.print(" | ");
}
System.out.print(" |- ");
}
public Object getEmail() {
return email;
}
public void setEmail(Object email) {
this.email = email;
}
}
Pom
4.0.0 org.springframework.boot spring-boot-starter-parent 2.1.6.RELEASE br.com.nanodata.PST LeitorPst 0.0.1-SNAPSHOT LeitorPst Demo project for Spring Boot
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.pff</groupId>
<artifactId>java-libpst</artifactId>
<version>0.9.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>