public void updateSignature(ExchangeService exchange, String signature) {
try {
FolderId f = new FolderId(WellKnownFolderName.Root);
UserConfiguration user = UserConfiguration.bind(exchange,
"OWA.UserOptions", f, UserConfigurationProperties.All);
if (user.getDictionary().containsKey("signaturetext"))
user.getDictionary().setElements("signaturetext", signature);
else
user.getDictionary().addElement("signaturetext", signature);
user.update();
} catch (Exception e) {
e.printStackTrace();
}
}
我收到 user.update() 的空指针异常;我可以在设置新签名之前在控制台中打印旧签名,也可以在字典中设置新签名之后打印。但是,我无法永久更新更改。提前致谢 。