none
NameResolution.contact.alias is null RRS feed

  • Question


  • I have used below link for resolving the name.

    http://msdn.microsoft.com/en-us/library/gg274399(v=exchg.80).aspx

    But i have modify my code with below to load contact detail.

    I want to store Alias for resolved names. but it gives null value to me.

    I checked in the outlook and i can see Alias in it.

    Please help me.

    Thanks.

    NameResolutionCollection coll = service.ResolveName(s,ResolveNameSearchLocation.DirectoryOnly, true);
                foreach (NameResolution nameRes in coll) {
                    
                    Console.WriteLine("Contact name: " + nameRes.Contact.Alias);

    ----------------------------------------------------------- Hardik Shah



    Friday, October 18, 2013 11:25 AM

Answers

  • If you have Exchange 2010 SP2 (or later) installed and your using Version 2.0 of the EWS Managed API you can use the ContactDataShape property which was added in SP2 to tell exchange to return this property. Eg the following will work in Sp2 and later

                PropertySet psPropSet = new PropertySet(BasePropertySet.FirstClassProperties);
                NameResolutionCollection coll = service.ResolveName("glen", ResolveNameSearchLocation.DirectoryOnly,true , psPropSet);
                foreach (NameResolution nameRes in coll)
                {
                    Console.WriteLine("Contact name: " + nameRes.Contact.Alias);
                }
    Cheers
    Glen
    • Marked as answer by Hardik.S.Shah Monday, October 21, 2013 10:45 AM
    Monday, October 21, 2013 5:19 AM

All replies

  • If you have Exchange 2010 SP2 (or later) installed and your using Version 2.0 of the EWS Managed API you can use the ContactDataShape property which was added in SP2 to tell exchange to return this property. Eg the following will work in Sp2 and later

                PropertySet psPropSet = new PropertySet(BasePropertySet.FirstClassProperties);
                NameResolutionCollection coll = service.ResolveName("glen", ResolveNameSearchLocation.DirectoryOnly,true , psPropSet);
                foreach (NameResolution nameRes in coll)
                {
                    Console.WriteLine("Contact name: " + nameRes.Contact.Alias);
                }
    Cheers
    Glen
    • Marked as answer by Hardik.S.Shah Monday, October 21, 2013 10:45 AM
    Monday, October 21, 2013 5:19 AM
  • Thanks Glen. It is working and faster then my earlier AD code.

    ----------------------------------------------------------- Hardik Shah

    Monday, October 21, 2013 10:46 AM