<?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>mylifeinaminute.com &#187; MSDN</title>
	<atom:link href="http://www.mylifeinaminute.com/category/microsoft/msdn/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mylifeinaminute.com</link>
	<description>You can learn a lot in a minute</description>
	<lastBuildDate>Wed, 18 Jan 2012 02:33:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Setting AutoCleanupDays With PowerShell in SharePoint 2010</title>
		<link>http://www.mylifeinaminute.com/2011/09/08/setting-autocleanupdays-with-powershell-in-sharepoint-2010/</link>
		<comments>http://www.mylifeinaminute.com/2011/09/08/setting-autocleanupdays-with-powershell-in-sharepoint-2010/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 18:39:34 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[MSDN]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Office]]></category>
		<category><![CDATA[Sharepoint Server]]></category>
		<category><![CDATA[SharePoint Server 2010]]></category>
		<category><![CDATA[TechNet]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://www.mylifeinaminute.com/?p=1117</guid>
		<description><![CDATA[The Problem In it&#8217;s default configuration, SharePoint (2007 and 2010) will delete workflow associations after 60 days (e.g. the information found on the Workflow Status page). There are times when you may want to alter this functionality and retain the association for a longer period of time. In SharePoint 2007, the recommendation from Microsoft (per [...]]]></description>
			<content:encoded><![CDATA[<h2>The Problem</h2>
<p>In it&#8217;s default configuration, <a href="/tag/sharepoint/" title="SharePoint">SharePoint</a> (<a href="/tag/sharepoint-2007/" title="SharePoint 2007">2007</a> and <a href="/tag/sharepoint-2010/" title="SharePoint 2010">2010</a>) will delete <a href="/tag/workflow/" title="Workflow">workflow</a> associations after 60 days (<em>e.g.</em> the information found on the Workflow Status page). There are times when you may want to alter this functionality and retain the association for a longer period of time.</p>
<p>In SharePoint 2007, the <a title="Disable automatic cleanup of workflow history (SharePoint Server 2007)" href="http://technet.microsoft.com/en-us/library/cc298800(office.12).aspx">recommendation from Microsoft</a> (per <a href="/category/microsoft/technet/" title="TechNet">TechNet</a>), is to disable the <strong>Workflow Auto Cleanup</strong> timer job. The <strong>Workflow Auto Cleanup</strong> timer job is a web application scoped timer job. As such, disabling the job is often not the optimal solution; as disabling the job will ensure that cleanup is not occurring for all of the site collections within the web application for which the timer job was disabled.</p>
<p><a href="http://www.mylifeinaminute.com/images/2011/09/TimerJob.png" rel="lightbox[1117]"><img class="aligncenter size-medium wp-image-1120" title="Timer Jobs" src="http://www.mylifeinaminute.com/images/2011/09/TimerJob-300x184.png" alt="" width="300" height="184" /></a><a href="http://www.mylifeinaminute.com/images/2011/09/TimerJobDisable.png" rel="lightbox[1117]"><img class="aligncenter size-medium wp-image-1121" title="Disable Timer Job" src="http://www.mylifeinaminute.com/images/2011/09/TimerJobDisable-300x135.png" alt="" width="300" height="135" /></a></p>
<h2>The Solution</h2>
<p>Thankfully, there is a property (<a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.workflow.spworkflowassociation.autocleanupdays.aspx" title="SPWorkflowAssociation.AutoCleanupDays Property">SPWorkflowAssociation.AutoCleanupDays</a>) that is exposed with the workflows associated with a given list/content type. And once again, <a href="/tag/powershell/" title="PowerShell">PowerShell</a> comes to the rescue, giving us the ability to manipulate the cleanup days at a more granular level. This ensures that we do not disable the timer job for an entire web application.</p>
<p>Presented as two functions, we can manipulate the workflow association settings for either the workflows associated with a list or the workflows associated with a content type attached to a list.</p>
<h3>Set-SPListWorkflowAssocationCleanup</h3>
<p>The following function allows us to set the AutoCleanupDays for all of the workflows associated with a given list.</p>
<pre class="brush: powershell; title: ; notranslate">
Set-SPListWorkflowAssocationCleanup -WebUrl &quot;http://intranet&quot; -ListName &quot;Shared Documents&quot; -CleanupDays 365 -ReportOnly:$false
</pre>
<pre class="brush: powershell; title: ; notranslate">
function Set-SPListWorkflowAssocationCleanup {
    param (
        [string] $WebUrl = $(Read-Host -prompt &quot;Enter a Url&quot;),
        [string] $ListName = $(Read-Host -prompt &quot;Enter a List Name&quot;),
        [int32] $CleanupDays = $(Read-Host -prompt &quot;Enter the number of Cleanup Days&quot;),
        [switch] $ReportOnly = $true
        )        

    $web = Get-SPWeb $WebUrl;
    if ($web -eq $null) {
        Write-Error -message &quot;Error: Web Not Found&quot; -category InvalidArgument
    } else {
        $list = $web.Lists[$ListName];
        if ($list -eq $null) {
            Write-Error -message &quot;Error: List Not Found&quot; -category InvalidArgument
        } else {
            [Microsoft.SharePoint.Workflow.SPWorkflowAssociation[]] $wfaMods = @();
            foreach ($wfa in $list.WorkflowAssociations) {
                $message = &quot;Found Workflow Association for &quot; + $wfa.Name + &quot; with AutoCleanupDays set to &quot; + $wfa.AutoCleanupDays
                Write-Verbose -message $message -verbose

                if ($ReportOnly -eq $false) {
                    $wfa.AutoCleanupDays = $CleanupDays;
                    $wfaMods = $wfaMods + $wfa;
                }
            }

            if ($ReportOnly -eq $false) {
                foreach ($wfa in $wfaMods) {
                    $message = &quot;Setting AutoCleanupDays for &quot; + $wfa.Name + &quot; to &quot; + $CleanupDays
                    Write-Verbose -message $message -verbose
                    $list.WorkflowAssociations.Update($wfa);
                }
            }
        }
    }
}
</pre>
<h3>Set-SPListContentTypeWorkflowAssocationCleanup</h3>
<p>The following function allows us to set the AutoCleanupDays for all of the workflows associated with content type for a given list.</p>
<pre class="brush: powershell; title: ; notranslate">
Set-SPListContentTypeWorkflowAssocationCleanup -WebUrl &quot;http://intranet&quot; -ListName &quot;Shared Documents&quot; -ContentTypeName &quot;Document Content Type&quot; -CleanupDays 365 -ReportOnly:$false
</pre>
<pre class="brush: powershell; title: ; notranslate">
function Set-SPListContentTypeWorkflowAssocationCleanup {
    param (
        [string] $WebUrl = $(Read-Host -prompt &quot;Enter a Url&quot;),
        [string] $ListName = $(Read-Host -prompt &quot;Enter a List Name&quot;),
        [string] $ContentTypeName = $(Read-Host -prompt &quot;Enter a Content Type Name&quot;),
        [int32] $CleanupDays = $(Read-Host -prompt &quot;Enter the number of Cleanup Days&quot;),
        [switch] $ReportOnly = $true
        )        

    $web = Get-SPWeb $WebUrl;
    if ($web -eq $null) {
        Write-Error -message &quot;Error: Web Not Found&quot; -category InvalidArgument
    } else {
        $list = $web.Lists[$ListName];
        if ($list -eq $null) {
            Write-Error -message &quot;Error: List Not Found&quot; -category InvalidArgument
        } else {
            $ct = $list.ContentTypes[$ContentTypeName];
            if ($ct -eq $null) {
                Write-Error -message &quot;Error: Content Type Not Found&quot; - category InvalidArgument
            } else {
                [Microsoft.SharePoint.Workflow.SPWorkflowAssociation[]] $wfaMods = @();
                foreach ($wfa in $ct.WorkflowAssociations) {
                    $message = &quot;Found Workflow Association for &quot; + $wfa.Name + &quot; with AutoCleanupDays set to &quot; + $wfa.AutoCleanupDays
                    Write-Verbose -message $message -verbose

                    if ($ReportOnly -eq $false) {
                        $wfa.AutoCleanupDays = $CleanupDays;
                        $wfaMods = $wfaMods + $wfa;
                    }
                }

                if ($ReportOnly -eq $false) {
                    foreach ($wfa in $wfaMods) {
                        $message = &quot;Setting AutoCleanupDays for &quot; + $wfa.Name + &quot; to &quot; + $CleanupDays
                        Write-Verbose -message $message -verbose
                        $ct.WorkflowAssociations.Update($wfa);
                    }
                }
            }
        }
    }
}
</pre>
<h2>Conclusion</h2>
<p>By manipulating the workflow associations for a list at the list/content type level the default configuration of a SharePoint farm can be retained (<em>e.g.</em> Workflow associations removed after 60 days) and in those cases where there is a business need, the workflow associations can be maintained for a longer period of time.</p>
<h2>Reference</h2>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.workflow.spworkflowassociation.autocleanupdays.aspx" title="SPWorkflowAssociation.AutoCleanupDays Property">SPWorkflowAssociation.AutoCleanupDays Property</a></li>
<li><a title="SharePoint Timer job reference (Office SharePoint Server)" href="http://technet.microsoft.com/en-us/library/cc678870(office.12).aspx">SharePoint Timer job reference (Office SharePoint Server)</a></li>
<li><a title="Timer job reference (SharePoint Server 2010)" href="http://technet.microsoft.com/en-us/library/cc678870.aspx">Timer job reference (SharePoint Server 2010)</a></li>
<li><a href="http://sympmarc.com/2008/10/14/sharepoint-workflow-history-disappears/" title="SharePoint Workflow History Disappears">SharePoint Workflow History &#8220;Disappears&#8221;</a></li>
</ul>
<p><map name='google_ad_map_1117_0feb153b14d1a0fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/1117?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_1117_0feb153b14d1a0fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=1117&amp;url= http%3A%2F%2Fwww.mylifeinaminute.com%2F2011%2F09%2F08%2Fsetting-autocleanupdays-with-powershell-in-sharepoint-2010%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.mylifeinaminute.com/2011/09/08/setting-autocleanupdays-with-powershell-in-sharepoint-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UrlAction Tokens in SharePoint 2010</title>
		<link>http://www.mylifeinaminute.com/2011/09/02/urlaction-tokens-in-sharepoint-2010/</link>
		<comments>http://www.mylifeinaminute.com/2011/09/02/urlaction-tokens-in-sharepoint-2010/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 19:25:28 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[MSDN]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Office]]></category>
		<category><![CDATA[Sharepoint Server]]></category>
		<category><![CDATA[SharePoint Server 2010]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://www.mylifeinaminute.com/?p=1100</guid>
		<description><![CDATA[When creating CustomAction Elements, a number of tokens are available for use within the UrlAction Element in SharePoint 2010. The list of UrlAction tokens in SharePoint 2010 has grown ever so slightly (For a SharePoint 2007 reference, see UrlAction Tokens Of The CustomAction Feature). Tokens Key Available in 2007 Available in 2010 Token Replacement ~site/ [...]]]></description>
			<content:encoded><![CDATA[<p>When creating <a title="CustomAction Element" href="http://msdn.microsoft.com/en-us/library/ms460194.aspx">CustomAction Elements</a>, a number of tokens are available for use within the <a title="UrlAction Element" href="http://msdn.microsoft.com/en-us/library/ms478271(v=office.14).aspx">UrlAction Element</a> in <a href="/tag/sharepoint-2010/" title="SharePoint 2010">SharePoint 2010</a>. The list of <a title="UrlAction Element" href="http://msdn.microsoft.com/en-us/library/ms478271(v=office.14).aspx">UrlAction</a> tokens in SharePoint 2010 has grown ever so slightly (For a <a href="/tag/sharepoint-2007/" title="SharePoint 2007">SharePoint 2007</a> reference, see <a title="UrlAction Tokens Of The CustomAction Feature" href="http://hristopavlov.wordpress.com/2008/12/08/urlaction-tokens-of-the-customaction-feature/">UrlAction Tokens Of The CustomAction Feature</a>).</p>
<h4>Tokens</h4>
<table border="0" cellspacing="0" cellpadding="0" style="width:100%">
<tr>
<th>Key</th>
</tr>
<tr>
<td>Available in 2007</td>
</tr>
<tr  style="background-color: #FFFBCC">
<td>Available in 2010</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0" style="width:100%">
<tbody>
<tr>
<th>Token</th>
<th>Replacement</th>
</tr>
<tr>
<td>~site/</td>
<td><a title="SPWeb.ServerRelativeUrl Property" href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.serverrelativeurl.aspx">SPContext.Current.Web.ServerRelativeUrl</a></td>
</tr>
<tr>
<td>~sitecollection/</td>
<td><a title="SPSite.ServerRelativeUrl Property" href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsite.serverrelativeurl.aspx">SPContext.Current.Site.ServerRelativeUrl</a></td>
</tr>
<tr>
<td>{ItemId}</td>
<td><a title="SPListItem.ID Property" href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.id.aspx">SPListItem.ID</a>.ToString() <em>or</em> <a title="Code Snippet: Get the BdcIdentity of All Items in an External List on the Server" href="http://msdn.microsoft.com/en-us/library/ff464434.aspx">SPListItem["BdcIdentity"]</a> (external data source)</td>
</tr>
<tr>
<td>{ItemUrl}</td>
<td><a title="SPListItem.Url Property" href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.url.aspx">SPListItem.Url</a></td>
</tr>
<tr>
<td>{SiteUrl}</td>
<td><a title="SPWeb.Url Property" href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.url.aspx">SPWeb.Url</a></td>
</tr>
<tr>
<td>{ListId}</td>
<td><a title="SPList.ID Property" href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splist.id.aspx">SPList.ID</a>.<a title="Guid.ToString Method (String)" href="http://msdn.microsoft.com/en-us/library/97af8hh4.aspx">ToString(&#8220;B&#8221;)</a></td>
</tr>
<tr>
<td>{RecurrenceId}</td>
<td><a title="SPListItem.RecurrenceID Property" href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.recurrenceid.aspx">SPListItem.RecurrenceID</a></td>
</tr>
<tr style="background-color: #FFFBCC">
<td>{ListUrlDir}</td>
<td><a title="SPList.RootFolder Property" href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splist.rootfolder.aspx">SPList.RootFolder</a>.<a title="SPFolder.Url Property" href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfolder.url.aspx">Url</a></td>
</tr>
<tr style="background-color: #FFFBCC">
<td>{Source}</td>
<td>Current Request Url</td>
</tr>
</tbody>
</table>
<h4>Microsoft.SharePoint.SPCustomActionElement.ReplaceUrlTokens</h4>
<pre class="brush: csharp; title: ; notranslate">
internal static string ReplaceUrlTokens(string urlAction, SPWeb web, SPList list, SPListItem item)
{
	if (string.IsNullOrEmpty(urlAction))
	{
		return urlAction;
	}
	if (item != null)
	{
		int d = item.ID;
		string str1 = d.ToString(CultureInfo.InvariantCulture);
		if (list.HasExternalDataSource)
		{
			str1 = item[&quot;BdcIdentity&quot;] as string;
		}
		urlAction = urlAction.Replace(&quot;{ItemId}&quot;, str1);
		urlAction = urlAction.Replace(&quot;{ItemUrl}&quot;, item.Url);
		string recurrenceID = str1;
		if (!string.IsNullOrEmpty(item.RecurrenceID))
		{
			recurrenceID = item.RecurrenceID;
		}
		urlAction = urlAction.Replace(&quot;{RecurrenceId}&quot;, recurrenceID);
	}
	if (web != null)
	{
		urlAction = urlAction.Replace(&quot;{SiteUrl}&quot;, web.Url);
	}
	if (list != null)
	{
		urlAction = &quot;{ListId}&quot;.Replace(Guid guid = list.ID, guid.ToString(&quot;B&quot;));
		if (list.RootFolder != null)
		{
			urlAction = urlAction.Replace(&quot;{ListUrlDir}&quot;, list.RootFolder.Url);
		}
	}
	HttpContext current = HttpContext.Current;
	if (current != null &amp;&amp; current.Request != null)
	{
		string rawUrl = current.Request.RawUrl;
		Uri contextUri = SPAlternateUrl.ContextUri;
		if (!string.IsNullOrEmpty(rawUrl) &amp;&amp; null != contextUri)
		{
			string str2 = null;
			if (!SPUtility.StsStartsWith(rawUrl, &quot;/&quot;))
			{
				str2 = string.Concat(contextUri.GetLeftPart(UriPartial.Authority), &quot;/&quot;, rawUrl);
			}
			else
			{
				str2 = string.Concat(contextUri.GetLeftPart(UriPartial.Authority), rawUrl);
			}
			urlAction = urlAction.Replace(&quot;{Source}&quot;, SPHttpUtility.UrlKeyValueEncode(str2));
		}
	}
	urlAction = SPUtility.GetServerRelativeUrlFromPrefixedUrl(urlAction);
	return urlAction;
}
</pre>
<h4>Reference</h4>
<ul>
<li><a title="CustomAction Element" href="http://msdn.microsoft.com/en-us/library/ms460194.aspx">CustomAction Element</a></li>
<li><a title="UrlAction Element" href="http://msdn.microsoft.com/en-us/library/ms478271(v=office.14).aspx">UrlAction Element</a></li>
<li><a title="UrlAction Tokens Of The CustomAction Feature" href="http://hristopavlov.wordpress.com/2008/12/08/urlaction-tokens-of-the-customaction-feature/">UrlAction Tokens Of The CustomAction Feature</a></li>
</ul>
<p><map name='google_ad_map_1100_0feb153b14d1a0fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/1100?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_1100_0feb153b14d1a0fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=1100&amp;url= http%3A%2F%2Fwww.mylifeinaminute.com%2F2011%2F09%2F02%2Furlaction-tokens-in-sharepoint-2010%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.mylifeinaminute.com/2011/09/02/urlaction-tokens-in-sharepoint-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SharePoint Governance Resources</title>
		<link>http://www.mylifeinaminute.com/2011/01/19/sharepoint-governance-resources/</link>
		<comments>http://www.mylifeinaminute.com/2011/01/19/sharepoint-governance-resources/#comments</comments>
		<pubDate>Wed, 19 Jan 2011 14:21:45 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[MSDN]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Sharepoint Server]]></category>
		<category><![CDATA[TechNet]]></category>
		<category><![CDATA[Windows SharePoint Services]]></category>
		<category><![CDATA[governance]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[SharePoint documentation]]></category>
		<category><![CDATA[SharePoint Installation]]></category>

		<guid isPermaLink="false">http://www.mylifeinaminute.com/?p=654</guid>
		<description><![CDATA[Governance is something that should be at the top of the list for any SharePoint implementation (no matter how small). The following are some checklists/whitepapers/etc. provided by Microsoft that can get you started. Plan Governance SharePoint Governance Checklist Guide SharePoint Collaboration Service Governance Plan SharePoint Intranet Portal Governance White Paper SharePoint Deployment Guide and Checklists [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Governance" href="/tag/governance/">Governance</a> is something that should be at the top of the list for any SharePoint implementation (no matter how small). The following are some checklists/whitepapers/etc. provided by <a title="Microsoft" href="/category/microsoft/">Microsoft</a> that can get you started.</p>
<ul>
<li><a title="Plan Governance" href="http://technet.microsoft.com/en-us/library/cc263341(office.12).aspx">Plan Governance</a></li>
<li><a title="SharePoint Governance Checklist Guide" href="http://office.microsoft.com/download/afile.aspx?AssetID=AM102306291033">SharePoint Governance Checklist Guide</a></li>
<li><a title="SharePoint Collaboration Service Governance Plan" href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=ed2e4753-f162-4c23-ba9e-beb8c88f74d4&amp;displaylang=en">SharePoint Collaboration Service Governance Plan</a></li>
<li><a title="SharePoint Intranet Portal Governance White Paper" href="http://go.microsoft.com/fwlink/?LinkId=163922&amp;clcid=0x409">SharePoint Intranet Portal Governance White Paper</a></li>
<li><a title="SharePoint Deployment Guide and Checklists" href="http://office.microsoft.com/download/afile.aspx?AssetID=AM102552101033">SharePoint Deployment Guide and Checklists</a></li>
</ul>
<p>This is of course only sampling of what&#8217;s available. Feel free to sound off in the comments with your go-to resources for <a title="SharePoint" href="/tag/sharepoint/">SharePoint</a> governance.</p>
<p><map name='google_ad_map_654_0feb153b14d1a0fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/654?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_654_0feb153b14d1a0fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=654&amp;url= http%3A%2F%2Fwww.mylifeinaminute.com%2F2011%2F01%2F19%2Fsharepoint-governance-resources%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.mylifeinaminute.com/2011/01/19/sharepoint-governance-resources/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SharePoint Guidance</title>
		<link>http://www.mylifeinaminute.com/2010/07/06/sharepoint-guidance/</link>
		<comments>http://www.mylifeinaminute.com/2010/07/06/sharepoint-guidance/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 23:24:05 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[MSDN]]></category>
		<category><![CDATA[Office]]></category>
		<category><![CDATA[Sharepoint Server]]></category>
		<category><![CDATA[SharePoint Server 2010]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[SharePoint Guidance]]></category>

		<guid isPermaLink="false">http://www.mylifeinaminute.com/?p=496</guid>
		<description><![CDATA[From MSDN: Designing and developing rich, robust Microsoft® SharePoint® applications can be challenging. The following releases are designed to help solution developers and architects make the right decisions and follow proven practices when building applications for SharePoint. Each release contains guidance documentation, source code for reference implementations, reusable library code, and Quick Starts. Definitely worth [...]]]></description>
			<content:encoded><![CDATA[<p>From MSDN:</p>
<blockquote><p>Designing and developing rich, robust Microsoft® SharePoint® applications can be challenging. The following releases are designed to help solution developers and architects make the right decisions and follow proven practices when building applications for SharePoint. Each release contains guidance documentation, source code for reference implementations, reusable library code, and Quick Starts.</p></blockquote>
<p>Definitely worth exploring further if you looking to see how others are building on top of the product stack and what the SharePoint MVPs view as essential for developing robust applications.</p>
<h4>Reference</h4>
<ul>
<li><a title="SharePoint Guidance" href="http://msdn.microsoft.com/en-us/library/ff650022.aspx">SharePoint Guidance on MSDN</a></li>
</ul>
<p><map name='google_ad_map_496_0feb153b14d1a0fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/496?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_496_0feb153b14d1a0fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=496&amp;url= http%3A%2F%2Fwww.mylifeinaminute.com%2F2010%2F07%2F06%2Fsharepoint-guidance%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.mylifeinaminute.com/2010/07/06/sharepoint-guidance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MSDN Magazine: 10 Best Practices For Building SharePoint Solutions</title>
		<link>http://www.mylifeinaminute.com/2009/03/10/msdn-magazine-10-best-practices-for-building-sharepoint-solutions/</link>
		<comments>http://www.mylifeinaminute.com/2009/03/10/msdn-magazine-10-best-practices-for-building-sharepoint-solutions/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 01:16:44 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[MSDN]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Office]]></category>
		<category><![CDATA[Sharepoint Server]]></category>
		<category><![CDATA[Windows SharePoint Services]]></category>
		<category><![CDATA[moss 2007]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.mylifeinaminute.com/?p=338</guid>
		<description><![CDATA[MSDN Magazine has a SharePoint focused article this month titled 10 Best Practices For Building SharePoint Solutions. If you&#8217;re trying to wrap your head around the scope and depth of developing solutions on top of SharePoint, the article makes for a good primer.]]></description>
			<content:encoded><![CDATA[<p><a title="MSDN Magazine" href="http://msdn.microsoft.com/en-us/magazine/default.aspx">MSDN Magazine</a> has a SharePoint focused article this month titled <a title="10 Best Practices For Building SharePoint Solutions" href="http://msdn.microsoft.com/en-us/magazine/dd458798.aspx">10 Best Practices For Building SharePoint Solutions</a>. If you&#8217;re trying to wrap your head around the scope and depth of developing solutions on top of SharePoint, the article makes for a good primer.</p>
<p><map name='google_ad_map_338_0feb153b14d1a0fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/338?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_338_0feb153b14d1a0fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=338&amp;url= http%3A%2F%2Fwww.mylifeinaminute.com%2F2009%2F03%2F10%2Fmsdn-magazine-10-best-practices-for-building-sharepoint-solutions%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.mylifeinaminute.com/2009/03/10/msdn-magazine-10-best-practices-for-building-sharepoint-solutions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>In Case You Missed It &#8211; Content Deployment Webcast</title>
		<link>http://www.mylifeinaminute.com/2009/01/07/in-case-you-missed-it-content-deployment-webcast/</link>
		<comments>http://www.mylifeinaminute.com/2009/01/07/in-case-you-missed-it-content-deployment-webcast/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 16:45:09 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[MSDN]]></category>
		<category><![CDATA[Office]]></category>
		<category><![CDATA[Server 2008]]></category>
		<category><![CDATA[Sharepoint Server]]></category>
		<category><![CDATA[Visual Studio 2005]]></category>
		<category><![CDATA[Visual Studio 2008]]></category>
		<category><![CDATA[content deployment]]></category>
		<category><![CDATA[moss 2007]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.mylifeinaminute.com/?p=294</guid>
		<description><![CDATA[Spencer Harbar presented an excellent webcast on content deployment in SharePoint 2007 yesterday. If you&#8217;ve ever wanted to learn more about it, now is the time. Go check it out.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.harbar.net/">Spencer Harbar</a> presented an excellent webcast on <a title="Plan content deployment" href="http://technet.microsoft.com/en-us/library/cc263428.aspx">content deployment</a> in <a href="/tag/moss-2007/">SharePoint 2007</a> yesterday. If you&#8217;ve ever wanted to learn more about it, now is the time.</p>
<p><a href="http://www.harbar.net/archive/2009/01/07/content-deployment-webcast-now-available-on-demand.aspx">Go check it out</a>.</p>
<p><map name='google_ad_map_294_0feb153b14d1a0fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/294?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_294_0feb153b14d1a0fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=294&amp;url= http%3A%2F%2Fwww.mylifeinaminute.com%2F2009%2F01%2F07%2Fin-case-you-missed-it-content-deployment-webcast%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.mylifeinaminute.com/2009/01/07/in-case-you-missed-it-content-deployment-webcast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing Absolute URLs in a Content Editor Web Part</title>
		<link>http://www.mylifeinaminute.com/2008/12/24/fixing-absolute-urls-in-a-content-editor-web-part/</link>
		<comments>http://www.mylifeinaminute.com/2008/12/24/fixing-absolute-urls-in-a-content-editor-web-part/#comments</comments>
		<pubDate>Wed, 24 Dec 2008 15:00:24 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[MSDN]]></category>
		<category><![CDATA[Office]]></category>
		<category><![CDATA[Sharepoint Server]]></category>
		<category><![CDATA[TechNet]]></category>
		<category><![CDATA[Windows SharePoint Services]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[control adapter]]></category>
		<category><![CDATA[moss 2007]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.mylifeinaminute.com/?p=271</guid>
		<description><![CDATA[Maxime Bombardier has a post on the subject of fixing one of the bigger issues with the Content Editor web part. For the uninitiated, a Content Editor web part always renders absolute URLs when the rich-text editing capabilities are used. I must admit that I would have never have thought to use a control adapter [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogs.msdn.com/maximeb/default.aspx" title="Maxime Bombardier">Maxime Bombardier</a> has a post on the subject of fixing one of the bigger issues with the Content Editor web part. For the uninitiated, a <a href="http://www.contenteditorwebpart.com/default.aspx">Content Editor web part</a> always renders absolute URLs when the rich-text editing capabilities are used. I must admit that I would have never have thought to use a <a href="http://msdn.microsoft.com/en-us/library/67276kc5.aspx" title="Architectural Overview of Adaptive Control Behavior">control adapter</a> to manipulate the output of the web part on the fly. Now that I have learned something new, you should too.</p>
</p>
<p><a href="http://blogs.msdn.com/maximeb/archive/2008/12/23/fixing-absolute-urls-for-all-alternate-access-mappings-aam-of-content-editor-web-part-with-a-control-adapter.aspx" title="Fixing absolute URLs for all Alternate Access Mappings (AAM) of Content Editor Web Part with a Control Adapter">Go check it out</a>.</p>
<p><map name='google_ad_map_271_0feb153b14d1a0fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/271?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_271_0feb153b14d1a0fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=271&amp;url= http%3A%2F%2Fwww.mylifeinaminute.com%2F2008%2F12%2F24%2Ffixing-absolute-urls-in-a-content-editor-web-part%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.mylifeinaminute.com/2008/12/24/fixing-absolute-urls-in-a-content-editor-web-part/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updating User Profile Properties for the Current User</title>
		<link>http://www.mylifeinaminute.com/2008/12/16/updating-user-profile-properties-for-the-current-user/</link>
		<comments>http://www.mylifeinaminute.com/2008/12/16/updating-user-profile-properties-for-the-current-user/#comments</comments>
		<pubDate>Tue, 16 Dec 2008 16:46:48 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[MSDN]]></category>
		<category><![CDATA[Office]]></category>
		<category><![CDATA[Sharepoint Server]]></category>
		<category><![CDATA[TechNet]]></category>
		<category><![CDATA[Visual Studio 2005]]></category>
		<category><![CDATA[Visual Studio 2008]]></category>
		<category><![CDATA[Windows SharePoint Services]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[moss 2007]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint Profile Management]]></category>

		<guid isPermaLink="false">http://www.mylifeinaminute.com/?p=256</guid>
		<description><![CDATA[Updates to a user&#8217;s profile properties can be performed with the following:]]></description>
			<content:encoded><![CDATA[<p>Updates to a user&#8217;s profile properties can be performed with the following:</p>
<p><span id="more-256"></span></p>
<pre>
<pre class="brush: csharp; title: ; notranslate">
SPSite site = SPContext.GetContext(HttpContext.Current).Site;
                ServerContext serverContext = ServerContext.GetContext(site);

                UserProfileManager profileManager = new UserProfileManager(serverContext);
                UserProfile currentUserProfile = profileManager.GetUserProfile(System.Web.HttpContext.Current.User.Identity.Name);

                if (this.chkTerms.Checked)
                    currentUserProfile[&quot;TermsOfUseAccepted&quot;].Value = &quot;true&quot;;
                else
                    currentUserProfile[&quot;TermsOfUseAccepted&quot;].Value = &quot;false&quot;;

                currentUserProfile[&quot;SecurityQuestion1&quot;].Value = this.lstQuestion1.SelectedItem.Text + &quot;|&quot; + Server.HtmlEncode(this.txtQuestion1Ans.Text);
                currentUserProfile[&quot;SecurityQuestion2&quot;].Value = this.lstQuestion2.SelectedItem.Text + &quot;|&quot; + Server.HtmlEncode(this.txtQuestion2Ans.Text);
                currentUserProfile[&quot;SecurityQuestion3&quot;].Value = this.lstQuestion3.SelectedItem.Text + &quot;|&quot; + Server.HtmlEncode(this.txtQuestion3Ans.Text);

                currentUserProfile.Commit();

                site.RootWeb.Dispose();
                site.Dispose();
</pre>
</pre>
<p><map name='google_ad_map_256_0feb153b14d1a0fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/256?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_256_0feb153b14d1a0fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=256&amp;url= http%3A%2F%2Fwww.mylifeinaminute.com%2F2008%2F12%2F16%2Fupdating-user-profile-properties-for-the-current-user%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.mylifeinaminute.com/2008/12/16/updating-user-profile-properties-for-the-current-user/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Retrieving User Profile Properties for the Current User</title>
		<link>http://www.mylifeinaminute.com/2008/12/16/retrieving-user-profile-properties-for-the-current-user/</link>
		<comments>http://www.mylifeinaminute.com/2008/12/16/retrieving-user-profile-properties-for-the-current-user/#comments</comments>
		<pubDate>Tue, 16 Dec 2008 16:42:10 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[MSDN]]></category>
		<category><![CDATA[Office]]></category>
		<category><![CDATA[Sharepoint Server]]></category>
		<category><![CDATA[TechNet]]></category>
		<category><![CDATA[Visual Studio 2005]]></category>
		<category><![CDATA[Visual Studio 2008]]></category>
		<category><![CDATA[Windows SharePoint Services]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[moss 2007]]></category>
		<category><![CDATA[Shared Services Provider]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint Profile Management]]></category>
		<category><![CDATA[SharePoint User Management]]></category>

		<guid isPermaLink="false">http://www.mylifeinaminute.com/?p=254</guid>
		<description><![CDATA[Retrieving a user&#8217;s profile properties can be achieved with the following block: Note that this buids on Creating Custom Profile Properties Through Code.]]></description>
			<content:encoded><![CDATA[<p>Retrieving a user&#8217;s profile properties can be achieved with the following block:</p>
<p><span id="more-254"></span></p>
<pre>
<pre class="brush: csharp; title: ; notranslate">
SPSite site = SPContext.GetContext(HttpContext.Current).Site;
            ServerContext serverContext = ServerContext.GetContext(site);

            UserProfileManager profileManager = new UserProfileManager(serverContext);
            UserProfile currentUserProfile = null;

            if (profileManager.UserExists(System.Web.HttpContext.Current.User.Identity.Name))
                currentUserProfile = profileManager.GetUserProfile(System.Web.HttpContext.Current.User.Identity.Name);
            else
                currentUserProfile = profileManager.CreateUserProfile(System.Web.HttpContext.Current.User.Identity.Name);

            string termsOfUseAnswered = (string)currentUserProfile[&quot;TermsOfUseAccepted&quot;].Value;
            string securityQuestion1 = (string)currentUserProfile[&quot;SecurityQuestion1&quot;].Value;
            string securityQuestion2 = (string)currentUserProfile[&quot;SecurityQuestion2&quot;].Value;
            string securityQuestion3 = (string)currentUserProfile[&quot;SecurityQuestion3&quot;].Value;
</pre>
</pre>
<p>Note that this buids on <a href="/2008/12/16/creating-custom-profile-properties-through-code-c/" title="Creating Custom Profile Properties Through Code (C#)">Creating Custom Profile Properties Through Code</a>.</p>
<p><map name='google_ad_map_254_0feb153b14d1a0fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/254?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_254_0feb153b14d1a0fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=254&amp;url= http%3A%2F%2Fwww.mylifeinaminute.com%2F2008%2F12%2F16%2Fretrieving-user-profile-properties-for-the-current-user%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.mylifeinaminute.com/2008/12/16/retrieving-user-profile-properties-for-the-current-user/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating Custom Profile Properties through Code (C#)</title>
		<link>http://www.mylifeinaminute.com/2008/12/16/creating-custom-profile-properties-through-code-c/</link>
		<comments>http://www.mylifeinaminute.com/2008/12/16/creating-custom-profile-properties-through-code-c/#comments</comments>
		<pubDate>Tue, 16 Dec 2008 16:27:21 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[MSDN]]></category>
		<category><![CDATA[Office]]></category>
		<category><![CDATA[Sharepoint Server]]></category>
		<category><![CDATA[TechNet]]></category>
		<category><![CDATA[Visual Studio 2005]]></category>
		<category><![CDATA[Visual Studio 2008]]></category>
		<category><![CDATA[Windows SharePoint Services]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[moss 2007]]></category>
		<category><![CDATA[Shared Services Provider]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint Profile Management]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.mylifeinaminute.com/?p=248</guid>
		<description><![CDATA[I recently needed to add several custom profile properties through a web part for tracking a users&#8217; security preferences for a particular web application. The following is the method used to create four new properties in the SSP: Note that the current context (HttpContext.Current) needs to be saved off, set to null, then reinstated upon [...]]]></description>
			<content:encoded><![CDATA[<p>I recently needed to add several custom profile properties through a web part for tracking a users&#8217; security preferences for a particular web application.</p>
<p>The following is the method used to create four new properties in the SSP:</p>
<p><span id="more-248"></span></p>
<pre>
<pre class="brush: csharp; title: ; notranslate">
private void VerifyCreateBaseProfileProperties()
        {
            SPSite site = SPContext.GetContext(HttpContext.Current).Site;
            Guid siteId = site.ID;
            HttpContext savedContext = HttpContext.Current;

            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                using (SPSite elevatedSite = new SPSite(siteId))
                {
                    try
                    {
                        HttpContext.Current = null;

                        elevatedSite.AllowUnsafeUpdates = true;
                        elevatedSite.RootWeb.AllowUnsafeUpdates = true;

                        ServerContext serverContext = ServerContext.GetContext(elevatedSite);

                        UserProfileManager profileManager = new UserProfileManager(serverContext);
                        UserProfileConfigManager profileConfigManager = new UserProfileConfigManager(serverContext);
                        PropertyCollection propertyCollection = profileConfigManager.GetProperties();

                        bool question1Exists = false;
                        bool question2Exists = false;
                        bool question3Exists = false;
                        bool termsOfUseExists = false;

                        foreach (Property property in profileManager.Properties)
                        {
                            switch (property.Name)
                            {
                                case &quot;SecurityQuestion1&quot;:
                                    question1Exists = true;
                                    break;
                                case &quot;SecurityQuestion2&quot;:
                                    question2Exists = true;
                                    break;
                                case &quot;SecurityQuestion3&quot;:
                                    question3Exists = true;
                                    break;
                                case &quot;TermsOfUseAccepted&quot;:
                                    termsOfUseExists = true;
                                    break;
                            }
                        }

                        if (!question1Exists)
                        {
                            Property question1 = propertyCollection.Create(false);
                            question1.Name = &quot;SecurityQuestion1&quot;;
                            question1.DisplayName = &quot;Security Question 1&quot;;
                            question1.Type = &quot;string&quot;;
                            question1.PrivacyPolicy = PrivacyPolicy.OptIn;
                            question1.DefaultPrivacy = Privacy.Private;
                            question1.Description = &quot;Security Question 1&quot;;
                            question1.IsSearchable = false;
                            question1.IsVisibleOnEditor = false;
                            question1.IsAlias = false;
                            question1.Length = 100;
                            question1.IsUserEditable = true;
                            propertyCollection.Add(question1);
                        }
                        if (!question2Exists)
                        {
                            Property question2 = propertyCollection.Create(false);
                            question2.Name = &quot;SecurityQuestion2&quot;;
                            question2.DisplayName = &quot;Security Question 2&quot;;
                            question2.Type = &quot;string&quot;;
                            question2.PrivacyPolicy = PrivacyPolicy.OptIn;
                            question2.DefaultPrivacy = Privacy.Private;
                            question2.Description = &quot;Security Question 2&quot;;
                            question2.IsSearchable = false;
                            question2.IsVisibleOnEditor = false;
                            question2.IsAlias = false;
                            question2.Length = 100;
                            question2.IsUserEditable = true;
                            propertyCollection.Add(question2);
                        }
                        if (!question3Exists)
                        {
                            Property question3 = propertyCollection.Create(false);
                            question3.Name = &quot;SecurityQuestion3&quot;;
                            question3.DisplayName = &quot;Security Question 3&quot;;
                            question3.Type = &quot;string&quot;;
                            question3.PrivacyPolicy = PrivacyPolicy.OptIn;
                            question3.DefaultPrivacy = Privacy.Private;
                            question3.Description = &quot;Security Question 3&quot;;
                            question3.IsSearchable = false;
                            question3.IsVisibleOnEditor = false;
                            question3.IsAlias = false;
                            question3.Length = 100;
                            question3.IsUserEditable = true;
                            propertyCollection.Add(question3);
                        }
                        if (!termsOfUseExists)
                        {
                            Property termsofUsequestion = propertyCollection.Create(false);
                            termsofUsequestion.Name = &quot;TermsOfUseAccepted&quot;;
                            termsofUsequestion.DisplayName = &quot;Terms Of Use Accepted&quot;;
                            termsofUsequestion.Type = &quot;string&quot;;
                            termsofUsequestion.PrivacyPolicy = PrivacyPolicy.OptIn;
                            termsofUsequestion.DefaultPrivacy = Privacy.Private;
                            termsofUsequestion.Description = &quot;Terms Of Use Accepted&quot;;
                            termsofUsequestion.IsSearchable = false;
                            termsofUsequestion.IsVisibleOnEditor = false;
                            termsofUsequestion.IsAlias = false;
                            termsofUsequestion.Length = 10;
                            termsofUsequestion.IsUserEditable = true;
                            propertyCollection.Add(termsofUsequestion);
                        }
                    }
                    catch (Exception exc)
                    {
                    }
                    finally
                    {
                        elevatedSite.Dispose();
                    }
                }
            });

            site.Dispose();
            HttpContext.Current = savedContext;
        }
</pre>
</pre>
<p>Note that the current context (HttpContext.Current) needs to be saved off, set to null, then reinstated upon the completion of the method.</p>
<p><map name='google_ad_map_248_0feb153b14d1a0fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/248?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_248_0feb153b14d1a0fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=248&amp;url= http%3A%2F%2Fwww.mylifeinaminute.com%2F2008%2F12%2F16%2Fcreating-custom-profile-properties-through-code-c%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.mylifeinaminute.com/2008/12/16/creating-custom-profile-properties-through-code-c/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Served from: www.mylifeinaminute.com @ 2012-02-05 08:38:44 by W3 Total Cache -->
