尝试使用 IndependentSoft EWS API 从 Exchange 服务器检索联系人时出现以下错误:
The property can not be used with this type of restriction.
这是我的代码:
public Contact GetContact(string id){
var restriction = new IsEqualTo(PersonaPropertyPath.PersonaId, id);
var persona = _service.FindPeople(StandardFolder.Contacts, restriction).Personas.FirstOrDefault();
if (persona == null)
throw new NullReferenceException("Could not find contact in Exchange");
var contact = new Contact
{
Id = persona.PersonaId.ToString(),
Name = persona.DisplayName
};
if (persona.EmailAddress != null)
{
contact.Email = persona.EmailAddress.EmailAddress;
}
return contact;
}