- PR -

ActiveDirectoryに関して

1
投稿者投稿内容
ごろ
会議室デビュー日: 2008/08/07
投稿数: 3
投稿日時: 2008-08-07 14:24
.NET2005 VB アプリケーション上からActiveDirectoryのプロパティ(部署名)を
取得する方法がわかりません。
どなたかわかる方は教えて下さい。
ごろ
会議室デビュー日: 2008/08/07
投稿数: 3
投稿日時: 2008-08-07 16:52
ActiveDirectory関係で、
以前に書込みされたソースを元に実施したらうまく部署名が取れました。

Dim path As String = "LDAP://domain名"
Dim root As New DirectoryEntry(path)
Dim schr As New DirectorySearcher(root)
schr.Filter = String.Format("(&(objectClass=user)(name={0}))", ユーザ名)
Dim sr As SearchResult = schr.FindOne()
Dim userEntry = sr.GetDirectoryEntry()
Dim strdata As String = userEntry.Properties("department").Value
userEntry.Close()
root.Close()
ごろ
会議室デビュー日: 2008/08/07
投稿数: 3
投稿日時: 2008-08-07 18:02
部署以外のプロパティの取得に関しては、以下の様にできます。

姓(sn) = userEntry.Properties("sn").Value)
名(givenName) = userEntry.Properties("givenName").Value)
First name(FirstName) = userEntry.Properties("FirstName").Value)
イニシャル(initials) = userEntry.Properties("initials").Value)
Last name(LastName) = userEntry.Properties("LastName").Value)
表示名(displayName) = userEntry.Properties("displayName").Value)
Display name(FullName) = userEntry.Properties("FullName").Value)
説明(description) = userEntry.Properties("description").Value)
事業所(physicalDeliveryOfficeName) = userEntry.Properties("physicalDeliveryOfficeName").Value)
電話番号(telephoneNumber) = userEntry.Properties("telephoneNumber").Value)
その他電話番号(otherTelephone) = userEntry.Properties("otherTelephone").Value)
Eメール(mail) = userEntry.Properties("mail").Value)
webページ(wWWHomePage) = userEntry.Properties("wWWHomePage").Value)
その他Webページ(url) = userEntry.Properties("url").Value)
番地(streetAddress) = userEntry.Properties("streetAddress").Value)
私書箱(postOfficeBox) = userEntry.Properties("postOfficeBox").Value)
市区町村(l) = userEntry.Properties("l").Value)
都道府県(st) = userEntry.Properties("st").Value)
郵便番号(postalCode) = userEntry.Properties("postalCode").Value)
国コード(countryCode) = userEntry.Properties("countryCode").Value)

自宅(homePhone) = userEntry.Properties("homePhone").Value)
その他の電話番号(otherHomePhone) = userEntry.Properties("otherHomePhone").Value)
ポケットベル(pager) = userEntry.Properties("pager").Value)
その他のポケットベル(otherPager) = userEntry.Properties("otherPager").Value)
携帯電話(mobile) = userEntry.Properties("mobile").Value)
その他の携帯電話(otherMobile) = userEntry.Properties("otherMobile").Value)
FAX(facsimileTelephoneNumber) = userEntry.Properties("facsimileTelephoneNumber").Value)
その他のFAX(otherFacsimileTelephoneNumber) = userEntry.Properties("otherFacsimileTelephoneNumber").Value)
IP電話(ipPhone) = userEntry.Properties("ipPhone").Value)
その他のIP電話(otheripPhone) = userEntry.Properties("otheripPhone").Value)
メモ話(info) = userEntry.Properties("info").Value)

役職(title) = userEntry.Properties("title").Value)
部署(department) = userEntry.Properties("department").Value)
会社(company) = userEntry.Properties("company").Value)
上司(manager) = userEntry.Properties("manager").Value)
1

スキルアップ/キャリアアップ(JOB@IT)