<?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>Kraft Kennedy &#124; Technology Blog &#187; Directory Servicces</title>
	<atom:link href="http://blogs.kraftkennedy.com/index.php/tag/directory-servicces/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.kraftkennedy.com</link>
	<description>Trends and insight into legal technology, infrastructure and strategic thinking.</description>
	<lastBuildDate>Tue, 07 Sep 2010 13:56:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Audience Targeting in Windows SharePoint Services 3.0, based on AD Groups</title>
		<link>http://blogs.kraftkennedy.com/index.php/2009/07/13/audience-targeting-in-wss/</link>
		<comments>http://blogs.kraftkennedy.com/index.php/2009/07/13/audience-targeting-in-wss/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 19:07:34 +0000</pubDate>
		<dc:creator>Michael Fettner</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Enterprise Content Management]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Directory Servicces]]></category>
		<category><![CDATA[MOSS]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://blogs.kraftkennedy.com/index.php/2009/07/13/audience-targeting-in-windows-sharepoint-services-3-0-based-on-ad-groups/</guid>
		<description><![CDATA[WSS does not have a user profile service and does not allow any kind of native targeting of content to users in different groups. This is one of the more serious limitations of WSS, especially for corporate intranets, where pages might need to be customized for users in different offices. MOSS, on the other hand, [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblogs.kraftkennedy.com%2Findex.php%2F2009%2F07%2F13%2Faudience-targeting-in-wss%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblogs.kraftkennedy.com%2Findex.php%2F2009%2F07%2F13%2Faudience-targeting-in-wss%2F" height="61" width="51" /></a></div><p>WSS does not have a user profile service and does not allow any kind of native targeting of content to users in different groups. This is one of the more serious limitations of WSS, especially for corporate intranets, where pages might need to be customized for users in different offices. MOSS, on the other hand, allows for the creation of audiences and easy targeting of content. As is typically the case with WSS, it is possible to achieve this functionality by writing code.</p>
<p>One way to do this is by adding a reference in your code to &#8220;System.DirectoryServices,&#8221; which allows you to query Active Directory. With that class, you can compare the current user to an Active Directory group&#8217;s membership collection, and add logic based on whether or not the user is in the group. If you plan to edit an aspx page directly, you will also have to add a page parser path in web.config, so that the code in the page will run. Rather than editing the page directly, it is often preferable to create a control or web part for security and manageability reasons.</p>
<p>If editing an aspg page directly in SharePoint Designer, just add the following line to the top of the page, so that the correct assembly is referenced.</p>
<p><span style="color:red">&lt;%@ <code>Assembly Name="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" %&gt;</code></span></p>
<p>Then add a code block into the page that gets the current user and compares it to the group membership. The following example uses VB.Net and sees if the current user is in the &#8220;NY Staff&#8221; group. If so, then the script redirects to the page &#8220;NY.aspx.&#8221; Rather than redirecting, you could also add code to write out customized content based on the membership information.</p>
<p>               <span style="color:red">&lt;%</span></p>
<p style="margin-left: 36pt"><span style="color:red"> </span><code><span style="color:red">   Try<br />
</span></code><code><span style="color:red">   'Get group membership for current user<br />
</span></code><code><span style="color:red">        Dim DomainUser As String = Replace(User.Identity.Name, "\", "/")<br />
</span></code><code><span style="color:red">        Dim ADEntry As New System.DirectoryServices.DirectoryEntry("WinNT://" &amp; DomainUser)<br />
</span></code><code><span style="color:red">        Dim MembersCollection As Object 'Underlaying is a IADsMembers interface<br />
</span></code><code><span style="color:red">        MembersCollection = ADEntry.Invoke("Groups")<br />
</span></code><code><span style="color:red">        Dim group As Object 'IADsGroup interface<br />
</span></code><code><span style="color:red">        Dim vFound As Boolean = False<br />
</span></code><code><span style="color:red">        For Each group In MembersCollection<br />
</span></code><code><span style="color:red">            If LCase(group.Name) = "ny staff" Then<br />
</span></code><code><span style="color:red">                vFound = True<br />
</span></code><code><span style="color:red">                Exit For<br />
</span></code><code><span style="color:red">            End If<br />
</span></code><code><span style="color:red">        Next<br />
</span></code><code><span style="color:red">        'Do something if group is found<br />
</span></code><code><span style="color:red">        If vFound Then<br />
</span></code><code><span style="color:red">            Response.redirect("NY.aspx")<br />
</span></code><code><span style="color:red">        End If<br />
</span></code><code><span style="color:red">      Catch ex As Exception<br />
</span></code><code><span style="color:red">        'response.write(ex.message)<br />
</span></code><code><span style="color:red">      End Try<br />
</span></code><span style="color:red">%&gt;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.kraftkennedy.com/index.php/2009/07/13/audience-targeting-in-wss/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
