<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Create Custom Policy programmatically</title>
	<atom:link href="http://www.21apps.com/sharepoint/create-custom-policy-programmatically/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.21apps.com/sharepoint/create-custom-policy-programmatically/</link>
	<description></description>
	<lastBuildDate>Fri, 12 Mar 2010 07:58:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Traveller_Adventure</title>
		<link>http://www.21apps.com/sharepoint/create-custom-policy-programmatically/comment-page-1/#comment-938</link>
		<dc:creator>Traveller_Adventure</dc:creator>
		<pubDate>Sun, 28 Jun 2009 04:54:19 +0000</pubDate>
		<guid isPermaLink="false">http://21apps.co.uk/?p=86#comment-938</guid>
		<description>What a useful post here. Very informative for me..TQ friends...&lt;br&gt;&lt;br&gt;Cheers,&lt;br&gt;&lt;a href=&quot;http://coffee-mugs-shop.the-review.info/index.php&quot; rel=&quot;nofollow&quot;&gt;porcelain coffee mugs&lt;/a&gt;&lt;br&gt;(Coffee Mug Online Shop: The Best Coffee Mug Store)</description>
		<content:encoded><![CDATA[<p>What a useful post here. Very informative for me..TQ friends&#8230;</p>
<p>Cheers,<br /><a href="http://coffee-mugs-shop.the-review.info/index.php" rel="nofollow">porcelain coffee mugs</a><br />(Coffee Mug Online Shop: The Best Coffee Mug Store)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Woodward</title>
		<link>http://www.21apps.com/sharepoint/create-custom-policy-programmatically/comment-page-1/#comment-512</link>
		<dc:creator>Andrew Woodward</dc:creator>
		<pubDate>Mon, 27 Oct 2008 12:14:26 +0000</pubDate>
		<guid isPermaLink="false">http://21apps.co.uk/?p=86#comment-512</guid>
		<description>Ven,
The reason is probably due to you not setting any policy bindings, as in the post example:-

policy.PolicyRoleBindings.Add(oWebApplication.PolicyRoles.GetSpecialRole(SPPolicyRoleType.FullControl));</description>
		<content:encoded><![CDATA[<p>Ven,<br />
The reason is probably due to you not setting any policy bindings, as in the post example:-</p>
<p>policy.PolicyRoleBindings.Add(oWebApplication.PolicyRoles.GetSpecialRole(SPPolicyRoleType.FullControl));</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ven</title>
		<link>http://www.21apps.com/sharepoint/create-custom-policy-programmatically/comment-page-1/#comment-510</link>
		<dc:creator>Ven</dc:creator>
		<pubDate>Sun, 26 Oct 2008 04:39:29 +0000</pubDate>
		<guid isPermaLink="false">http://21apps.co.uk/?p=86#comment-510</guid>
		<description>Hi,
   I am trying to get the users from the &quot;Policy of Web Application&quot; in Central Administration through Object Model 

and also trying to add users to the same Policy through object model. I am using the following code to achieve 

this. But I am getting an &quot;Object Reference Not Set to an Instance of an Object&quot; exception when I am trying to call 

the Update Method of the SPWebApplication object.
Please help me. The strange thing happening here is,when I am trying to add the users to the WebApplication policy, 

the users are getting added to though the update fails. The next time when I debug the application, I do see the 

new users added though the update failed. Moreover, I am not able to see the newly added users in the &quot;Policy For 

Web Application&quot; section of the Central Administration. Can anyone please help me out. Here is the code which I am 

using to achieve this.

SPFarm farm = SPFarm.Local;   
SPWebService service = farm.Services.GetValue(&quot;&quot;);   
foreach(SPWebApplication webApp in service.WebApplications)   
{   
  if(webApp.Name == &quot;My Web App&quot;)   
        {   
            webApp.ZonePolicies(SPUrlZone.Default).Add(&quot;username&quot;,&quot;displayname&quot;);   
            webApp.Update();  // I am getting the Object Reference error at this line   
        }   
}   
  

Please help me ASAP.</description>
		<content:encoded><![CDATA[<p>Hi,<br />
   I am trying to get the users from the &#8220;Policy of Web Application&#8221; in Central Administration through Object Model </p>
<p>and also trying to add users to the same Policy through object model. I am using the following code to achieve </p>
<p>this. But I am getting an &#8220;Object Reference Not Set to an Instance of an Object&#8221; exception when I am trying to call </p>
<p>the Update Method of the SPWebApplication object.<br />
Please help me. The strange thing happening here is,when I am trying to add the users to the WebApplication policy, </p>
<p>the users are getting added to though the update fails. The next time when I debug the application, I do see the </p>
<p>new users added though the update failed. Moreover, I am not able to see the newly added users in the &#8220;Policy For </p>
<p>Web Application&#8221; section of the Central Administration. Can anyone please help me out. Here is the code which I am </p>
<p>using to achieve this.</p>
<p>SPFarm farm = SPFarm.Local;<br />
SPWebService service = farm.Services.GetValue(&#8221;");<br />
foreach(SPWebApplication webApp in service.WebApplications)<br />
{<br />
  if(webApp.Name == &#8220;My Web App&#8221;)<br />
        {<br />
            webApp.ZonePolicies(SPUrlZone.Default).Add(&#8221;username&#8221;,&#8221;displayname&#8221;);<br />
            webApp.Update();  // I am getting the Object Reference error at this line<br />
        }<br />
}   </p>
<p>Please help me ASAP.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
