Click here to Skip to main content
Click here to Skip to main content

Tagged as

Get SIP address from active directory

, 27 Jan 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
SIP address from active directory
The below code will be used to get the SIP address from the active directory. SIP address is commonly used in office communicator server. I have used this code to fetch the SIP address. Based on the SIP address, we have applied provisioning on office communicator server 2007.
 
 private string GetSIPAddress(string email)
        {
            DirectoryEntry directoryEntry =
                     new DirectoryEntry(ConfigurationManager.AppSettings["LDAPPATH"]);
 
            string resultValue = "";
 
            using (HostingEnvironment.Impersonate())
            {
                DirectorySearcher directorySearcher = new DirectorySearcher(directoryEntry);
                directorySearcher.Filter = string.Format("(&(objectClass=user)(objectCategory=user) (mail={0}))", email);
 
                directorySearcher.PropertiesToLoad.Add("msRTCSIP-PrimaryUserAddress");
 
                SearchResult result = directorySearcher.FindOne();
 
                if (result != null)
                {
                    if (result.Properties["msRTCSIP-PrimaryUserAddress"] != null)
                    {
                        resultValue = result.Properties["msRTCSIP-PrimaryUserAddress"][0].ToString();
                        resultValue = "'" + resultValue + "'";
                    }
                }
            };
            return resultValue;
        }

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

No Biography provided

Comments and Discussions

 
GeneralI have formatted your code for you since you seem too busy t... PinmemberHenry Minute27-Jan-11 2:59 
GeneralPlease format your code http://www.codeproject.com/Tips/4207... PinsubeditorIndivara27-Jan-11 0:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.141220.1 | Last Updated 27 Jan 2011
Article Copyright 2011 by PankajKLohani
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid