<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: How to prevent members of a certain group from filling out, submitting or even viewing a form?</title><link>https://www.infopathdev.com:443/forums/thread/77717.aspx</link><pubDate>Wed, 18 Apr 2012 19:47:26 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:77717</guid><dc:creator>meyerdenney</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/77717.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=77717</wfw:commentRss><description>It looks like The standard way for SharePoint to handle this is to call: 

SPUtility.HandleAccessDenied(new UnauthorizedAccessException());

 is what I was looking for</description></item><item><title>How to prevent members of a certain group from filling out, submitting or even viewing a form?</title><link>https://www.infopathdev.com:443/forums/thread/77715.aspx</link><pubDate>Wed, 18 Apr 2012 18:44:20 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:77715</guid><dc:creator>meyerdenney</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/77715.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=77715</wfw:commentRss><description>Lets say I have a few users in a group called &amp;quot;Restricted&amp;quot; and I don&amp;#39;t want them to be able to view or submit forms. Should I add some code in the Form_Loading event that checks what groups the current user is a member of? If so, how would I prevent the form from loading? So far the code I have doesn&amp;#39;t seem to work.


SPGroupCollection grpCol = SPContext.Current.Web.CurrentUser.Groups;

                try
                {
                    SPGroup group = grpCol[&amp;quot;Restricted&amp;quot;];
                    
                    // if this doesn&amp;#39;t throw an exception, they are not part of that group, so exit
                    return;
                }
                catch (Exception ex)
                {
                    // if exception is thrown, they don&amp;#39;t belong to that group, so continue                    
                }</description></item></channel></rss>