<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>redaware &#187; AD</title>
	<atom:link href="http://www.redaware.net/tag/ad/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.redaware.net</link>
	<description></description>
	<lastBuildDate>Thu, 09 Sep 2010 15:06:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>VB.NET: Retrieving Active Directory account properties</title>
		<link>http://www.redaware.net/2009/08/vb-net-retrieving-active-directory-account-properties/</link>
		<comments>http://www.redaware.net/2009/08/vb-net-retrieving-active-directory-account-properties/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 08:22:24 +0000</pubDate>
		<dc:creator>tsymonds</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[AD]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Windows 2003 Server]]></category>

		<guid isPermaLink="false">http://www.redaware.net/?p=61</guid>
		<description><![CDATA[The .NET Framework includes an API called System.DirectoryServices. The sample VB.NET code below shows how to retrieve user account properties from the Active Directory. In order to use System.DirectoryServices classes, you will need to first add a reference to System.DirectoryServices. Imports System.DirectoryServices is required at the very top of your VB.NET code. Function GetUserProperties(ByVal GetUser, [...]]]></description>
			<content:encoded><![CDATA[<p>The .NET Framework includes an API called System.DirectoryServices. The sample VB.NET code below shows how to retrieve user account properties from the Active Directory.</p>
<p>In order to use System.DirectoryServices classes, you will need to first add a reference to <strong>System.DirectoryServices</strong>. </p>
<p><strong>Imports System.DirectoryServices</strong> is required at the very top of your VB.NET code.</p>
<pre class="brush: vb;">
Function GetUserProperties(ByVal GetUser, ByVal Result)
        Dim objSearch As New DirectorySearcher
        objSearch.SearchRoot = New DirectoryEntry(&quot;LDAP://dc=domain,dc=co,dc=uk&quot;)
        objSearch.Filter = GetUser
        'cn = Full Name, givenName = First name, initials = Middle names, sn = Surname, mail = email address
        objSearch.PropertiesToLoad.AddRange(New String() {&quot;cn&quot;, &quot;giveName&quot;, &quot;initials&quot;, &quot;sn&quot;, &quot;department&quot;, &quot;mail&quot;, &quot;Manager&quot;})
        Dim objResult As SearchResult
        objResult = objSearch.FindOne()
        GetUserProperties = (objResult.Properties(Result)(0))
End Function
</pre>
<p>Replace <strong>dc=domain, dc=co, dc=uk</strong> with your AD settings.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge">
<ul class="socials">
		<li class="shr-comfeed">
			<a href="http://www.redaware.net/2009/08/vb-net-retrieving-active-directory-account-properties/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=VB.NET%3A+Retrieving+Active+Directory+account+properties++-+http://b2l.me/kjek7&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.redaware.net/2009/08/vb-net-retrieving-active-directory-account-properties/&amp;t=VB.NET%3A+Retrieving+Active+Directory+account+properties+" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.redaware.net/2009/08/vb-net-retrieving-active-directory-account-properties/&amp;title=VB.NET%3A+Retrieving+Active+Directory+account+properties+&amp;summary=The%20.NET%20Framework%20includes%20an%20API%20called%20System.DirectoryServices.%20The%20sample%20VB.NET%20code%20below%20shows%20how%20to%20retrieve%20user%20account%20properties%20from%20the%20Active%20Directory.%0D%0A%0D%0AIn%20order%20to%20use%20System.DirectoryServices%20classes%2C%20you%20will%20need%20to%20first%20add%20a%20reference%20to%20System.DirectoryServices.%20%0D%0A%0D%0AImpor&amp;source=redaware" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://www.redaware.net/2009/08/vb-net-retrieving-active-directory-account-properties/&amp;title=VB.NET%3A+Retrieving+Active+Directory+account+properties+" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.redaware.net/2009/08/vb-net-retrieving-active-directory-account-properties/&amp;title=VB.NET%3A+Retrieving+Active+Directory+account+properties+" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.redaware.net/2009/08/vb-net-retrieving-active-directory-account-properties/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://www.redaware.net/2009/08/vb-net-retrieving-active-directory-account-properties/&amp;title=VB.NET%3A+Retrieving+Active+Directory+account+properties+" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.redaware.net/2009/08/vb-net-retrieving-active-directory-account-properties/&amp;title=VB.NET%3A+Retrieving+Active+Directory+account+properties+" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.redaware.net/2009/08/vb-net-retrieving-active-directory-account-properties/&amp;title=VB.NET%3A+Retrieving+Active+Directory+account+properties+" rel="nofollow" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="shr-yahoomail">
			<a href="http://compose.mail.yahoo.com/?Subject=VB.NET%3A+Retrieving+Active+Directory+account+properties+&amp;body=Link: http://www.redaware.net/2009/08/vb-net-retrieving-active-directory-account-properties/ (sent via shareaholic)%0D%0A%0D%0A----%0D%0A The%20.NET%20Framework%20includes%20an%20API%20called%20System.DirectoryServices.%20The%20sample%20VB.NET%20code%20below%20shows%20how%20to%20retrieve%20user%20account%20properties%20from%20the%20Active%20Directory.%0D%0A%0D%0AIn%20order%20to%20use%20System.DirectoryServices%20classes%2C%20you%20will%20need%20to%20first%20add%20a%20reference%20to%20System.DirectoryServices.%20%0D%0A%0D%0AImpor" rel="nofollow" class="external" title="Email this via Yahoo! Mail">Email this via Yahoo! Mail</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://www.redaware.net/2009/08/vb-net-retrieving-active-directory-account-properties/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
