1
votes

I'm developing an approval workflow in SP Designer 2007. I need a form field that will allow the user to verify that they have entered a working email address from Active Directory into a form field. (This will be the email address of the user's supervisor who grants approval - if this email address is wrong the entire process is derailed). I'm thinking it would work just like the Address Book button in an email form. Or better yet, like the Check Name button that simply checks the email address currently entered and verifies it by underlining it or some other visual cue.

Seems like an obviously useful behavior - I must be missing something - I am new to SP. Thanks!

1

1 Answers

0
votes

Can you not run an LDAP query using the current users username, getting the user "Manager" field. Use that to get the managers email address.

That way the user only overrides the email address if they explicitly want someone elses.

Here is a little code to help you do an LDAP query

  using System.DirectoryServices;
//DirectoryEntry de = new DirectoryEntry("LDAP://wel0101");

    DirectoryEntry de = new DirectoryEntry();
    DirectorySearcher deSearch = new DirectorySearcher(de);
    //deSearch.PropertiesToLoad.Add("Email");

    SearchResultCollection results;
    deSearch.SearchScope = SearchScope.Subtree;
    deSearch.Filter ="(&(objectClass=user)(cn=bacchu*))";
    //deSearch.
    results = deSearch.FindAll();

    foreach (SearchResult result in results)
    {
        ResultPropertyCollection props = result.Properties;
        richTextBox1.Text += "------------------------\n";
        foreach (string propName in props.PropertyNames)
        {
            richTextBox1.Text += propName + ":\"" +  props[propName][0] + "\"\n";
        }
    }

    richTextBox1.Text += "Done" + DateTime.Now.ToString() + "\n";