我想用EWS获取一个房间的字段Notes
。
这个字段存在于Outlook中,但我无法找到用API获取该字段的方法。
到目前为止,我试着用:
NameResolutionCollection nameResolutions = service.resolveName(room.getName(), ResolveNameSearchLocation.DirectoryThenContacts, true);
但是返回的联系人中不存在Notes
字段。
我也试着用
Contact roomContact = Contact.bind(service, new ItemId(room.getId()), new PropertySet(BasePropertySet.FirstClassProperties, ContactSchema.Body));
// roomContact.getBody().toString() should contains the 'Notes' field
然而,这个房间没有任何ItemId:room.getId()
返回null
最后,我尝试用nameResolution.getContact().load(new PropertySet(ItemSchema.Body))
加载该属性,这一次我有异常InvalidOperationException: This operation can't be performed because this service object doesn't have an Id
。
你知道我如何获取房间的Notes
字段吗?我也可能对找到房间ID感兴趣。
发布于 2015-08-13 21:04:23
您需要使用ResolveName中的ResolveName重载来指定希望由ResolveName返回的所有属性(如果启用,这也将返回用户照片)
PropertySet AllProps = new PropertySet(BasePropertySet.FirstClassProperties);
NameResolutionCollection ncCol = service.ResolveName("User@domain.com", ResolveNameSearchLocation.DirectoryOnly, true, AllProps);
foreach (NameResolution nr in ncCol)
{
Console.WriteLine(nr.Contact.Notes);
}
您不能对从GAL返回的联系人进行加载,因为这不是Exchange对象(例如它没有EWSId)。
干杯格伦
https://stackoverflow.com/questions/31943529
复制相似问题