locked
Employee Physical Delivery Office Name is not fetching from DirectorySearcher RRS feed

  • Question

  • User969356990 posted

    Hi Friends,

    In our application, we have an email id for help desk tickets. Users around the organisation sends email to this mail id to raise their ticket. 

    we are using DirectorySearcher to fetch the physicalDeliveryOfficeName. The logic was fetching the employee physical office location(as configured on outlook) until email id password expire. After resetting the mail id password, the physicalDeliveryOfficeName is not fetching, but rest of the details are available. There are no code changes done. Please suggest some ideas where it is going wrong.

    Also, if the mail id password is expired, where and all we need to reset the password. 

    using (DirectorySearcher searcher = new DirectorySearcher(root, filter, new string[] { "displayName", "employeeNumber", "physicalDeliveryOfficeName" }))
                                {
                                    searcher.ReferralChasing = ReferralChasingOption.All;
                                    SearchResultCollection result = searcher.FindAll();
                                    if (result.Count == 1)
                                    {
                                        SearchResult employee = result[0];
                                        var displayname = employee.Properties["displayName"];
                                        if(displayname.Count>0)
                                            eDisplayName = displayname[0].ToString();
     
                                        var employeeNumber = employee.Properties["employeeNumber"];
                                        if (employeeNumber.Count > 0)
     
                                            eNumber = employeeNumber[0].ToString();
     
                                        var physicalDeliveryOfficeName = employee.Properties["physicalDeliveryOfficeName"];
                                        if (physicalDeliveryOfficeName.Count > 0)
     
                                            eLocation = physicalDeliveryOfficeName[0].ToString();
                                    }
                                    return result;
                                }
    Many thanks in advance
    Haritha
    Wednesday, May 9, 2018 1:04 PM

All replies

  • User61956409 posted

    Hi Haritha,

    using (DirectorySearcher searcher = new DirectorySearcher(root, filter, new string[] { "displayName", "employeeNumber", "physicalDeliveryOfficeName" })

    I’d like to know the search filter that you used in your code snippet.

    With Regards,

    Fei Han

    Monday, May 14, 2018 5:51 AM