<?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>Chris: Geek Guy &#187; group</title>
	<atom:link href="http://chris.gg/tag/group/feed/" rel="self" type="application/rss+xml" />
	<link>http://chris.gg</link>
	<description>Tech news and other stuff from a UK-based web developer and all-round geek</description>
	<lastBuildDate>Tue, 06 Dec 2011 19:40:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>How to check whether a SharePoint user is in a particular group</title>
		<link>http://chris.gg/2010/02/how-to-check-whether-a-sharepoint-user-is-in-a-particular-group/</link>
		<comments>http://chris.gg/2010/02/how-to-check-whether-a-sharepoint-user-is-in-a-particular-group/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 17:00:51 +0000</pubDate>
		<dc:creator>Chris Barnes</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[group]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[smartpart]]></category>
		<category><![CDATA[user]]></category>
		<category><![CDATA[web part]]></category>
		<guid isPermaLink="false">http://chris.gg/?p=608</guid>
		<description><![CDATA[Here&#8217;s a quick function I wrote to check whether a user is a member of a particular SharePoint group: private bool IsMemberOf(string groupName) { SPUser user = SPContext.Current.Web.CurrentUser; try { if (user.Groups[groupName] != null) return true; else return false; } catch { return false; } } The try-catch is required as &#8211; somewhat counter-intuitively &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick function I wrote to check whether a user is a member of a particular SharePoint group:</p>
<pre lang="csharp">
private bool IsMemberOf(string groupName)
{
    SPUser user = SPContext.Current.Web.CurrentUser;
    try
    {
        if (user.Groups[groupName] != null)
            return true;
        else
            return false;
    }
    catch
    {
        return false;
    }
}
</pre>
<p>The try-catch is required as  &#8211; somewhat counter-intuitively &#8211; SharePoint seems to throw a &#8220;Group not found&#8221; error if the user is not a member of the group.</p>
]]></content:encoded>
			<wfw:commentRss>http://chris.gg/2010/02/how-to-check-whether-a-sharepoint-user-is-in-a-particular-group/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

