EWS API-更新ContactsGroup显示名称

时间:2018-09-07 17:24:49

标签: c# outlook exchangewebservices

我正在使用EWS api在Outlook中重命名ContactsGroup。我有一种方法可以重命名组:

String Cus_Name = (String) cmbCus_NameAdd.getSelectedItem();
String Cus_Id = lblCus_IDAdd2.getText();
String Odr_No = lblOrderNoAdd2.getText();
String Matir = lblMeterialAdd2.getText();
String amount = txtNoOfProductAdd.getText();
String date = lblDateAdd2.getText();
String time = lblTimeAdd2.getText();
String place = (String) cmbPlaceAdd.getSelectedItem();

String newLine = System.getProperty("line.separator");
String Details = "Customer Name - " + Cus_Name + "" + newLine + " Customer ID - " + Cus_Id + "" + newLine + " Order No - " + Odr_No + "" + newLine + " Material - " + Matir + "" + newLine + " Amount - " + amount + "" + newLine + " Date - " + date + "" + newLine + " Time - " + time + "" + newLine + " Place - " + place + "";

ByteArrayOutputStream out = QRCode.from(Details).to(ImageType.JPG).stream(); // this line creates QR code
File f = new File("C:\\Users\\Pulasthi Dinusha\\Desktop\\MainGui\\lib\\QR_Generator_Libs\\" + Odr_No + ".jpg");
FileOutputStream fos;
try {
    fos = new FileOutputStream(f);
    fos.write(out.toByteArray());
    fos.flush();

} catch (FileNotFoundException ex) {
    Logger.getLogger(test2.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
    Logger.getLogger(test2.class.getName()).log(Level.SEVERE, null, ex);
}
ImageIcon iconLogo = new ImageIcon("C:\\Users\\Pulasthi Dinusha\\Desktop\\MainGui\\lib\\QR_Generator_Libs\\" + Odr_No + ".jpg");
// In init() method write this code
lblQRcodeAdd.setIcon(iconLogo);

和找到组的方法:

    public bool ChangeGroupName(string oldGroupName, string newGroupName)
    {
        bool result = false;
        var folder = FindFolderByName(_folderName);
        if (folder == null)
        {
            return true;
        }

        ContactGroup group = FindGroupByName(oldGroupName, folder.Id);
        if (group != null)
        {
            group.DisplayName = newGroupName;
            group.Update(ConflictResolutionMode.AlwaysOverwrite);
        }
        result = (FindGroupByName(newGroupName, folder.Id) != null);
        return result;
    }

在重命名该群组后-我无法使用新名称找到该群组。

但是,如果我使用的是旧的-小组在那里。在属性中,它具有新名称DiplayName,并且在Outlook中也可以正确显示,但是此FindGroupByName方法找不到它。 IsDirty等于false。有人遇到过这样的问题吗? Outlook服务器是否存在某种延迟(我在第二次呼叫之前等待了一段时间)?有什么可能的解决方案?也许有些文档可能会有所帮助?

0 个答案:

没有答案