简体   繁体   English

使用Java EWS API检索“别名”

[英]Retrieve “Alias” using Java EWS API

I am trying to find out the "Alias" of a contact/room. 我试图找出联系人/房间的“别名”。

Is it anyway possible to retrieve it via the java ews api. 是否有可能通过java ews api检索它。 If not, is there another alternative eg the EWS SOAP Web Services? 如果不是,是否还有其他替代方法,例如EWS SOAP Web服务?

Currently I am only receiving mail address, company name, display name, department and office location ... That would suggest, when I fill out the information in the contact form (see image below) this information should also be retrieved through the EWS API. 目前,我只收到邮件地址,公司名称,显示名称,部门和办公地点...这表明,当我在联系表(见下图)中填写信息时,也应通过EWS API检索此信息。 。 But "Alias" is missing. 但是缺少“别名”。

图片

I searched for the alias Information in those java objects. 我在这些java对象中搜索了别名Information。 Especially the "PropertyBag" Class. 特别是“ PropertyBag”类。 "getAlias()" returns null. “ getAlias()”返回null。

        NameResolution nameResolution = nameResolutionIterator.next();

        Contact contact = nameResolution.getContact();
        contact.getAlias(); // This one returns null..
        PropertyBag propertyBag = contact.getPropertyBag();
        Collection<Object> propertiesValues = propertyBag.getProperties()
                .values();
        Set<PropertyDefinition> propertiesKeys = propertyBag
                .getProperties().keySet();

If you have Exchange 2010 SP2 (or later) installed you can use the ContactDataShape property https://msdn.microsoft.com/en-us/library/office/aa565329(v=exchg.150).aspx which was added in SP2 to tell exchange to return this property. 如果安装了Exchange 2010 SP2(或更高版本),则可以使用SP2中添加的ContactDataShape属性https://msdn.microsoft.com/zh-cn/library/office/aa565329(v=exchg.150).aspx告诉交易所返回此属性。 Eg the following will work in Sp2 and later 例如,以下内容将在Sp2和更高版本中起作用

        PropertySet psPropSet = new PropertySet(BasePropertySet.FirstClassProperties);
        NameResolutionCollection coll = service.ResolveName("glen", ResolveNameSearchLocation.DirectoryOnly,true , psPropSet);
        foreach (NameResolution nameRes in coll)
        {
            Console.WriteLine("Contact name: " + nameRes.Contact.Alias);
        }

Cheers Glen 干杯格伦

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM