質問

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.

役に立ちましたか?

解決

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

他のヒント

Have you tried using the format "sip:xxx@xxx.com" 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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top