I tried to confirm whether an email address is a valid Lync User by the follow methods but it is not giving proper results.
LyncClient client = LyncClient.GetClient();
Contact contact = client.ContactManager.GetContactByUri("xxx@xxx.com");
Method1:
if(contact.UnifiedCommunicationType == UnifiedCommunicationType.Enabled)
{
}
else if(contact.UnifiedCommunicationType == UnifiedCommunicationType.NotEnabled)
{
}
else if(contact.UnifiedCommunicationType == UnifiedCommunicationType.Unknown)
{
}
In this method I get either unknown for random email address and NotEnabled for a valid Lync User. However, Iam not getting "Invalid".
Method2 :
ContactType contact_type = (ContactType)contact.GetContactInfomration(ContactInformationType.ContactType);
if(contact_type == ContactType.Person)
{
}
else if(contact_type == ContactType.Invalid)
{
}
else if(contact_type == ContactType.Unknown)
{
}
In this method, I am getting "Person" regardless of the emailaddress. Hence, I dont this this is the way.
Can you please advice me how to achieve this?
Note: All I want to do is to check if an incoming email's sender in outlook is a valid lync user or not.