Reputation: 580
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("[email protected]");
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.
Upvotes: 1
Views: 1257
Reputation: 580
Finally, I found the way to understand the lync federated domain from an email address.
The trick is to nslookup the srv record for "_sipfederationtls._tcp.domainname"
Please find the C# code here
Upvotes: 1
Reputation: 2365
Have you tried using the format "sip:[email protected]" for the email address - as it's doing the lookup on a SIP address, not an email address.
MSDN has a sample here: http://msdn.microsoft.com/en-us/library/hh378561.aspx
Upvotes: 0