Java EWS - 如何获取附件类型

Java EWS - how to get attachment type

我正在处理 EWS java api,我想知道附件是否属于

类型

像这样

 if (attachment is ItemAttachment) // how to in Java api?
 if (attachment is FileAttachment) // how to in Java api?

您可以使用 instanceof:

if (attachment instanceof ItemAttachment) {
...
}