c# - Using LDAP/AD to find mailing lists user is subscribed to -


i looking getting list of mailing distribution lists user subscribed to. have never used active directories before, , after reading various answers here , on msdn, i'm confused.

i have query set this:

directorysearcher search = new directorysearcher(); search.filter = string.format("ldap://cn={0},ou=<value here>,dc=<value>...", username); search.searchscope = searchscope.subtree; search.propertiestoload.add("memberof"); searchresult result = search.findone(); if(result != null) {     // stuff here } 

here questions:

  1. what searchroot property within directorysearcher do? need set have query return value?
  2. do need set searchscope value subtree list 1 ou base ou , have search sub ous?
  3. is string sent in propertiestoload.add() generic, or need string defined company?

thanks advice!

(1) searchroot property within directorysearcher do? need set have query return value?

it defines starting point of search; compare file system - defines starting directory start search. you'll looking inside searchroot , possibly you'll looking @ child containers. it's used reduce possible number of containers search something

(2) need set searchscope value subtree list 1 ou base ou , have search sub ous?

if want search ou or other container under searchroot - yes, have search searchscope.subtree - otherwise search @ searchroot container (at objects users, computers, groups inside container - not @ sub-containers).

(3) string sent in propertiestoload.add() generic, or need string defined company?

those ldap attribute names - these can both, the standard ones possible custom extensions company might have defined , installed. here's nice list of ad attributes excel sheet (several, actually).


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -