<?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>SharePoint Development</title>
	<atom:link href="http://www.sharepointdevelopment.me/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sharepointdevelopment.me</link>
	<description>Planning, Implementation, and Advanced Development of SharePoint solutions.</description>
	<lastBuildDate>Tue, 31 Jul 2012 04:00:13 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Log Manager With Extra Information Using SharePoint 2010 Unified Logging Service</title>
		<link>http://www.sharepointdevelopment.me/2012/07/log-manager-with-extra-information-using-sharepoint-2010-unified-logging-service/</link>
		<comments>http://www.sharepointdevelopment.me/2012/07/log-manager-with-extra-information-using-sharepoint-2010-unified-logging-service/#comments</comments>
		<pubDate>Tue, 31 Jul 2012 04:00:13 +0000</pubDate>
		<dc:creator>Brock</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Logging]]></category>
		<category><![CDATA[ULS]]></category>

		<guid isPermaLink="false">http://www.sharepointdevelopment.me/?p=563</guid>
		<description><![CDATA[Here is a wrapper class which covers the SharePoint ULS interface and logs information to the ULS.]]></description>
				<content:encoded><![CDATA[<p>Here is a wrapper class which covers the SharePoint ULS interface and logs information to the ULS. I attempted to add as much information as I could and allow for a property dictionary to be appended to the log entry.</p>
<pre>namespace Demo.Web.Logging
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.SharePoint.Administration;
    using System.Diagnostics.Eventing;
    using System.Runtime.InteropServices;
    using System.Security.AccessControl;
    using System.Security.Principal;
    using System.Threading;
    using System.Diagnostics;

    public class LogManager
    {
        public static void Write(Exception ex, SPDiagnosticsCategory category, TraceSeverity severity)
        {
            if (ex.Data != null &amp;&amp; !ex.Data.Contains("CallingFunction"))
            {
                ex.Data.Add("CallingFunction", System.Reflection.MethodBase.GetCurrentMethod().ReflectedType.Name);
            }
            Dictionary&lt;string, object&gt; props = null;
            if (ex.Data != null &amp;&amp; ex.Data.Count &gt; 0)
            {
                props = new Dictionary&lt;string, object&gt;();
                foreach (string key in ex.Data)
                {
                    props.Add(key, ex.Data[key]);
                }
            }
            LoggingService.Log(ex.ToString(), props);
        }

        public static void Write(string message, Dictionary&lt;string, object&gt; props)
        {

            LoggingService.Log(message, props);
        }

        public static void Write(string message, Dictionary&lt;string, object&gt; props, TraceSeverity severity)
        {
            LoggingService.Log(message, props, severity);
        }

        public static void Write(string message, Dictionary&lt;string, object&gt; props, TraceSeverity severity, string categoryName)
        {
            LoggingService.Log(message, props, severity, categoryName);
        }

        public static void Write(string message, Dictionary&lt;string, object&gt; props, TraceSeverity severity, SPDiagnosticsCategory category)
        {
            //SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory("My Category", TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, ex.Message, ex.StackTrace);
            LoggingService.Log(message, props, severity, category);
        }
    }

    #region [ Internal ULS Access Implementation ]

    internal class LoggingService : SPDiagnosticsServiceBase
    {
        public static string DemoDiagnosticAreaName = "Demo";
        private static LoggingService _Current;
        public static LoggingService Current
        {
            get
            {
                if (_Current == null)
                {
                    _Current = new LoggingService();
                }

                return _Current;
            }
        }

        private LoggingService()
            : base("Demo Logging Service", SPFarm.Local)
        {

        }

        protected override IEnumerable&lt;spdiagnosticsarea&gt; ProvideAreas()
        {
            List&lt;spdiagnosticsarea&gt; areas = new List&lt;spdiagnosticsarea&gt;
            {
                new SPDiagnosticsArea(DemoDiagnosticAreaName, new List&lt;spdiagnosticscategory&gt;
                {
                    new SPDiagnosticsCategory("Application", TraceSeverity.Unexpected, EventSeverity.Error),
                    new SPDiagnosticsCategory("WebService", TraceSeverity.Unexpected, EventSeverity.Error),
                    new SPDiagnosticsCategory("WebConfigMod", TraceSeverity.Unexpected, EventSeverity.Error)
                })
            };

            return areas;
        }

        public static void Log(string message)
        {
            Log(message, null);
        }

        public static void Log(string message, Dictionary&lt;string, object&gt; props)
        {
            Log(message, props, TraceSeverity.Unexpected);
        }
        public static void Log(string message, Dictionary&lt;string, object&gt; props, TraceSeverity severity)
        {
            Log(message, props, TraceSeverity.Unexpected, "Application");
        }
        public static void Log(string message, Dictionary&lt;string, object&gt; props, TraceSeverity severity, string categoryName)
        {
            SPDiagnosticsCategory category = LoggingService.Current.Areas[DemoDiagnosticAreaName].Categories[categoryName];
            Log(message, props, severity, category);
        }
        public static void Log(string message, Dictionary&lt;string, object&gt; props, TraceSeverity severity, SPDiagnosticsCategory category)
        {
            if (props == null)
            {
                props = new Dictionary&lt;string, object&gt;();
            }
            if (!props.ContainsKey("CallingFunction"))
            {
                props.Add("CallingFunction", (new StackTrace()).GetFrame(1).GetMethod().Name);
            }
            string propSerial = "{" + string.Join(",", props.Select(
                d =&gt; string.Format("\"{0}\":\"{1}\"", d.Key, d.Value.ToString())
                ).ToArray()) + "}";

            //SPDiagnosticsCategory category = LoggingService.Current.Areas[DemoDiagnosticAreaName].Categories[categoryName];
            LoggingService.Current.WriteTrace(0, category, TraceSeverity.Unexpected, message + " ~ Properties: " + propSerial);
        }
    }

    #endregion
    }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.sharepointdevelopment.me/2012/07/log-manager-with-extra-information-using-sharepoint-2010-unified-logging-service/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SharePoint 2010 Custom Application Page Affix Ribbon To Top Using CSS</title>
		<link>http://www.sharepointdevelopment.me/2012/07/sharepoint-2010-custom-application-page-affix-ribbon-to-top-using-css/</link>
		<comments>http://www.sharepointdevelopment.me/2012/07/sharepoint-2010-custom-application-page-affix-ribbon-to-top-using-css/#comments</comments>
		<pubDate>Tue, 17 Jul 2012 04:00:36 +0000</pubDate>
		<dc:creator>Brock</dc:creator>
				<category><![CDATA[Branding]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[branding]]></category>
		<category><![CDATA[ribbon]]></category>

		<guid isPermaLink="false">http://www.sharepointdevelopment.me/?p=562</guid>
		<description><![CDATA[Microsoft felt it necessary to do far more work than necessary to fix the ribbon div to the top of the window. Here's a pure CSS solution that bypasses SharePoint 2010's default JavaScript-based approach.]]></description>
				<content:encoded><![CDATA[<p>Migrating existing applications into SharePoint can be difficult depending on the JavaScript functionality of the old code. Using the default SharePoint 2010 custom application page, the s4-workspace is a div that is re-sized and scrollable to allow the SharePoint ribbon to display. I don&#8217;t know why Microsoft felt it necessary to do far more work than necessary to fix a div to the top of the window.</p>
<p><a href="http://www.sharepointdevelopment.me/wp-content/uploads/2012/07/ribbon.png"><img class="alignnone size-full wp-image-577" src="http://www.sharepointdevelopment.me/wp-content/uploads/2012/07/ribbon.png" alt="The SharePoint 2010 Ribbon" width="344" height="142" /></a></p>
<p>Below is the code I used to fix the scroll bars on the page. This makes the ribbon not fixed and will scroll out of view. This could be enough if you don&#8217;t use the ribbon in your pages.</p>
<pre>body {
    overflow: auto ! important;
}
body.v4master {
    height:inherit;
    width:inherit;
    overflow:visible!important;
}

body #s4-workspace {
   overflow-y:auto !important;
   overflow-x:auto !important;
   height:auto !important;
}</pre>
<p>If the ribbon absolutely must be at the top of the page. You can add this bit of code after the above code to properly affix the div to the top of the visible window. My tests showed that this worked for me in IE8, IE9, and Firefox.</p>
<pre>body #s4-ribbonrow {
    left: 0;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 101;
}
body #s4-workspace {
    padding-top: 44px;
}</pre>
<p>That should be it. Not too hard.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharepointdevelopment.me/2012/07/sharepoint-2010-custom-application-page-affix-ribbon-to-top-using-css/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Harnessing the power of the SPCalendarView control</title>
		<link>http://www.sharepointdevelopment.me/2012/03/harnessing-the-spcalendarview/</link>
		<comments>http://www.sharepointdevelopment.me/2012/03/harnessing-the-spcalendarview/#comments</comments>
		<pubDate>Tue, 13 Mar 2012 04:51:51 +0000</pubDate>
		<dc:creator>Grant</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[ECMA]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[SOD]]></category>

		<guid isPermaLink="false">http://www.sharepointdevelopment.me/?p=539</guid>
		<description><![CDATA[The SPCalendarView control in SharePoint 2010 is really pretty snappy. It loads data with the slight of hand that is AJAX and leaves the user with an oh-so-pleasant user experience. So, if SharePoint developers wish to use the SPCalendarView control and deliver the same user experience with custom data; that should be pretty straight forward, right? [...]]]></description>
				<content:encoded><![CDATA[<p>The <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.spcalendarview.aspx" target="_blank">SPCalendarView</a> control in SharePoint 2010 is really pretty snappy. It loads data with the slight of hand that is AJAX and leaves the user with an oh-so-pleasant user experience. So, if SharePoint developers wish to use the SPCalendarView control and deliver the same user experience with custom data; that should be pretty straight forward, right? Ehhh&#8230; kind of&#8230;</p>
<p>All kidding aside, the control has a few somewhat odd quirks:</p>
<ol>
<li>There are no events for when the view type changes from week, day or month. This is a simple string value that is set (by you) when the page loads. Not only this; but the value is case-sensitive (all lowercase).</li>
<li>The control doesn&#8217;t seem to work outside of a Web Part. If the control is used in a user control; binding an <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.spcalendaritemcollection.aspx" target="_blank">SPCalendarItemCollection</a> to the datasource appears to have no affect. <a href="http://www.thelineberrys.com/default-category/spcalendarview-not-working-as-expected-in-sharepoint-foundation-2010-2.html" target="_blank">I found a workaround</a>, but I really feel there has to be an easier answer, plus I&#8217;d have to forego all of the AJAX-ness that made me want to use the control to begin with!</li>
<li>If you DO decide to use the SPCalendarView in a Web Part; it must be derived from the <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webpartpages.webpart.aspx" target="_blank">SharePoint Web Part</a> class, not the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.webpart(v=vs.90).aspx" target="_blank">ASP.NET Web Part</a> class.</li>
</ol>
<p>OK, now that I&#8217;ve named a few of the limitations; how many of you just gave up? Hold on! I have some good news&#8230;.</p>
<p>After digging through a lot of JavaScript in the SharePoint ECMA Script Library, I was able to pin point the issue and in short; the control was never really designed to work outside of a Web Part. The control is very heavy on the AJAX, in fact the data is stored in a JSON fragment on the page then loaded after the page is loaded. The AJAX implementation of the control can be found in the SP.UI.ApplicationPages.Calendar.js file at the SharePoint root. In this file you&#8217;ll see the following function definition:</p>
<pre>SP.UI.ApplicationPages.ElementUtility.$3f = function ($p0) {
    return $get('WebPart' + $p0);
}</pre>
<p>Notice that the function is assuming that the control that is being requested for binding is ALWAYS a Web Part (remember, the calendar data is in a JSON fragment and loaded in JavaScript AFTER the page loads). The function always prepends the string &#8216;WebPart&#8217; to the ID of the control when supplying the argument to the $get function. Obviously if we are using the SPCalendarView in a user control or application page, this is going to fail. So how do we fix it?</p>
<p>Since SharePoint 2010 has the handy SP.SOD class; we can write a function that executes when the page loads and will redefine the above function.</p>
<p>Let&#8217;s assume we have a user control that&#8217;s hosting the SPCalendarView and let&#8217;s place the following code above our SPCalendarView declaration in the ASCX file to use an anonymous function to redefine the offending function like so:</p>
<pre>&lt;script type="text/javascript"&gt;
SP.SOD.executeOrDelayUntilScriptLoaded(function () {
    SP.UI.ApplicationPages.ElementUtility.$3f = function ($p0) {
        return ($p0.substring(0, 3).toUpperCase() == "WPQ")
                   ? $get('WebPart' + $p0)
                   : $get($p0);
    }
}, "SP.UI.ApplicationPages.Calendar.js");
&lt;/script&gt;
&lt;SharePoint:SPCalendarView
  ID="calSample"
  runat="server"&gt;
&lt;/SharePoint:SPCalendarView&gt;</pre>
<p>This little fragment of code will check to see if the provided ID is a Web Part and if it is not; it will try to get the element without adding the &#8216;WebPart&#8217; prefix to the ID. Furthermore, we&#8217;ve addressed the issue that allows use to utilize the SPCalendarView control without modifying any of the OOB JavaScript files in the SharePoint root. Wrapping the whole bit in an SP.SOD.executeOrDelayUntilScriptLoaded function call ensures that the JavaScript file will have been loaded before we try to redefine it.</p>
<p>You might need to make some small changes to the script in your implementation, but with this little JavaScript fragment, you can harness the power of the SPCalendarView control in your custom SharePoint applications.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharepointdevelopment.me/2012/03/harnessing-the-spcalendarview/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Missing Server Side Dependencies? Check Your Recycle Bin</title>
		<link>http://www.sharepointdevelopment.me/2012/03/missing-server-side-dependencies-check-your-recycle-bin/</link>
		<comments>http://www.sharepointdevelopment.me/2012/03/missing-server-side-dependencies-check-your-recycle-bin/#comments</comments>
		<pubDate>Tue, 06 Mar 2012 01:00:00 +0000</pubDate>
		<dc:creator>Keith</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[SharePoint Administration]]></category>
		<category><![CDATA[fab-40]]></category>
		<category><![CDATA[health]]></category>

		<guid isPermaLink="false">http://www.sharepointdevelopment.me/?p=524</guid>
		<description><![CDATA[If you end up deleting Fab 40 Sites after migration, you may end up with the dreaded “Missing Server Side Dependencies” error message in your Health Analyzer. Here's what to do about it.]]></description>
				<content:encoded><![CDATA[<p>We recently had a client we assisted with migrating from MOSS to SharePoint Server 2010.  This migration posed a challenge due to the fact that this client had several sites that were built from the Fab 40 Templates (<a href="http://technet.microsoft.com/en-us/windowsserver/sharepoint/bb407286" target="_blank">Application Templates for Windows SharePoint Services 3.0</a>).  After doing further discovery work with this client, it was determined that only one of the sites was truly being used; however, since this was a detach DB migration plan we decided to not remove those sites until after migration.  This allowed us to keep the current farm in place in case we needed to roll back after migration.  For what it’s worth, we now believe this to be a mistake.  If at all possible, make sure you remediate any sites and features in MOSS before doing a migration.</p>
<p>If, on the other hand, you do end up deleting Fab 40 Sites after migration, you may end up with the dreaded “Missing Server Side Dependencies” error message in your Health Analyzer.</p>
<p><a href="http://www.sharepointdevelopment.me/wp-content/uploads/2012/03/Error.png"><img style="padding-left: 0px; padding-right: 0px; padding-top: 0px; border-width: 0px;" src="http://www.sharepointdevelopment.me/wp-content/uploads/2012/03/Error_thumb.png" border="0" alt="Error" width="516" height="484" /></a></p>
<p>After much research we determined that the issue was not a orphaned feature, but simply that the original site was still in the content database because it was still in the Recycle Bin.  Simply removing the site from the Recycle Bin cleared up this Health Analyzer rule in this case.  SharePoint will probably clear this up for you in about 30 days after migration when it cleans out the Recycle Bin, but if you would like to resolve this error message without waiting you can do so by deleting the deleted sites from your Recycle Bin manually.  Just be sure you truly never want to restore those sites.  Hope this helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharepointdevelopment.me/2012/03/missing-server-side-dependencies-check-your-recycle-bin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SharePoint Is Not A Platform For Developers. And That&#8217;s Okay.</title>
		<link>http://www.sharepointdevelopment.me/2012/02/sharepoint-is-not-a-platform-for-developers-and-thats-okay/</link>
		<comments>http://www.sharepointdevelopment.me/2012/02/sharepoint-is-not-a-platform-for-developers-and-thats-okay/#comments</comments>
		<pubDate>Wed, 29 Feb 2012 01:00:27 +0000</pubDate>
		<dc:creator>Jon</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Application Development]]></category>
		<category><![CDATA[sharepoint-2007]]></category>

		<guid isPermaLink="false">http://www.sharepointdevelopment.me/?p=500</guid>
		<description><![CDATA[It's SharePoint's world. We just develop in it. When you know and embrace your platform, however, something excellent happens.]]></description>
				<content:encoded><![CDATA[<p><img class="size-full wp-image-507 alignnone" style="border-style: initial; border-color: initial;" title="the_world_revolves_sharepoint" src="http://www.sharepointdevelopment.me/wp-content/uploads/2012/02/the_world_revolves_sharepoint3.png" alt="" width="289" height="241" /></p>
<p>It&#8217;s SharePoint&#8217;s world. We just develop in it.</p>
<p>This sentiment is all too familiar to many SharePoint devs I have spoken with, including myself. Solid developers—but mired in the constraints of a platform whose boundaries are not always clear.</p>
<p>Here&#8217;s the thing. SharePoint is not a platform for developers—it&#8217;s a <em>productivity tool </em>that empowers end users. The fact that there are as many places in its pipeline for .NET nerds to stick their considerable proboscises into as there are is actually pretty generous.</p>
<p>Any platform derives its value from the altitude of its starting point. The price of the ticket to this altitude is the loss of control over exactly where you can go from there.</p>
<p>Happy SharePoint developers understand its power <em>and </em>embrace its constraints. If all you notice is how much the SharePoint infrastructure seems to get in your way, or you mope through your tasks under a cloud of &#8220;we don&#8217;t have to do it this way in <em>regular</em> ASP.NET&#8221;, you are sure to miscalculate your code&#8217;s relationship with its host, and many of the little decisions you make every day as a developer will be skewed, or even straight up wrong.</p>
<p>When you know and embrace your platform, however, something excellent happens. The big picture comes into focus, and you are set free to see new patterns and approaches to your work. Specifically, you gain a better understanding of what code belongs within the constraints of SharePoint, and what code does not. For example? Sahil Malik has <a href="http://www.devx.com/codemag/Article/40508/1954" target="_blank">long been an advocate</a> for SharePoint solutions as lightweight clients to WCF services that house the real .NET nitty-gritty of the application. And my new favorite MVP du SharePoint, Jason Kaczor, relates <a href="http://www.dotnetrocks.com/default.aspx?showNum=745" target="_blank">here</a> how he eschews Web Parts altogether, and develops nimble HTML5 code that accesses SharePoint data via its OData feeds.</p>
<p>Wait. You didn&#8217;t know that <a href="http://blogs.msdn.com/b/ericwhite/archive/2010/12/09/getting-started-using-the-odata-rest-api-to-query-a-sharepoint-list.aspx" target="_blank">SharePoint exposes its data in OData feeds</a>?</p>
<p><strong>Know and embrace your platform.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharepointdevelopment.me/2012/02/sharepoint-is-not-a-platform-for-developers-and-thats-okay/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Opening a Modal Dialog on Page Load from Server-Side Code? Don&#8217;t Forget This Sweet (and Totally Critical) Function Call</title>
		<link>http://www.sharepointdevelopment.me/2011/11/opening-a-modal-dialog-on-page-load-from-server-side-code-dont-forget-this-sweet-and-totally-critical-function-call/</link>
		<comments>http://www.sharepointdevelopment.me/2011/11/opening-a-modal-dialog-on-page-load-from-server-side-code-dont-forget-this-sweet-and-totally-critical-function-call/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 05:00:10 +0000</pubDate>
		<dc:creator>Jon</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Modal Dialog]]></category>

		<guid isPermaLink="false">http://www.sharepointdevelopment.me/?p=472</guid>
		<description><![CDATA[Did you know? Before our page can call upon a modal dialog framework to, say, create a modal dialog, our page has to have *loaded* said modal dialog framework. 

Pray tell, then, O scriptacious gods of portal app pop-upage: how can we ensure that the execution of our dialog invocation is delayed until this fine framework is loaded and ready?]]></description>
				<content:encoded><![CDATA[<p>As my esteemed colleague Eric has previously <a href="http://www.sharepointdevelopment.me/2011/06/passing-data-to-and-from-sharepoint-modal-dialogs/" target="_blank">detailed for us</a>, SharePoint 2010 comes equipped with a snappy little API for working with modal popup dialogs, entirely based in client-side script. In fact, the following is really all the JavaScript you would need to get your dialog off the ground:</p>
<pre style="background: white;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.8pt;">function</span></span></span><span style="font-size: 9.8pt;"> openMySweetModalDialog(id) {
    <span><span style="color: #0000ff;">var</span></span> options = SP.UI.$create_DialogOptions();
    options.width = 500;
    options.height = 250;
    options.url = <span><span style="color: #800000;">"/_layouts/SharePointModalDialog/SweetDialogPage.aspx?id="</span><span style="color: #000000;"> + id</span></span>;
    options.dialogReturnValueCallback =
        Function.createDelegate(<span><span style="color: #0000ff;">null</span></span>, whenMyModalDialogCloses);
    SP.UI.ModalDialog.showModalDialog(options);
}

<span><span style="color: #0000ff;">function</span></span> whenMyModalDialogCloses() {
    alert(<span><span style="color: #800000;">'That was totally sweet.'</span></span>);
}</span></span></pre>
<p>But <a href="http://s3.amazonaws.com/kym-assets/photos/images/original/000/184/151/caution%20this%20is%20sparta.jpg" target="_blank">this is</a> SharePoint—which means (for us developer types, at least) that we&#8217;re couched firmly in the world of ASP.NET WebForms. The ECMAScript we sling around here tends to get put there by server-side code, especially if it calls for a touch of dynamism.</p>
<p>And a modal dialog is, by nature, a dynamic element—if you are using it right, there will likely be some parameters to pass in. An item&#8217;s ID number, for example.</p>
<p>So launching our dialog from the code-behind in just such a case should be a simple matter of formatting a JavaScript string with our parameter value, and then using the page&#8217;s <em>ClientScript</em> control to register us up some startup action:</p>
<pre style="background: white;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.8pt;">public</span></span></span><span style="font-size: 9.8pt;"> <span><span style="color: #0000ff;">partial</span></span> <span><span style="color: #0000ff;">class</span></span> <span><span style="color: #2b91af;">MySweetAppPage</span></span> : <span><span style="color: #2b91af;">LayoutsPageBase</span></span>
{
    <span><span style="color: #0000ff;">protected</span></span> <span><span style="color: #0000ff;">void</span></span> Page_Load(<span><span style="color: #0000ff;">object</span></span> sender, <span><span style="color: #2b91af;">EventArgs</span></span> e)
    {
        OpenMySweetModalDialog(5);
    }

    <span><span style="color: #0000ff;">protected</span></span> <span><span style="color: #0000ff;">void</span></span> OpenMySweetModalDialog(<span><span style="color: #0000ff;">int</span></span> id)
    {
        <span><span style="color: #008000;">// create ECMAScript to call the dialog function and pass the id</span></span>
        <span><span style="color: #0000ff;">var</span></span> script = <span><span style="color: #0000ff;">string</span></span>.Format(<span><span style="color: #a31515;">@"openMySweetModalDialog('{0}'); "</span></span>, id);

        <span><span style="color: #008000;">// emit script to run on page load</span></span>
        Page.ClientScript.RegisterStartupScript(
            <span><span style="color: #0000ff;">typeof</span></span>(<span><span style="color: #2b91af;">LayoutsPageBase</span></span>), <span><span style="color: #2b91af;">Guid</span></span>.NewGuid().ToString(), script, <span><span style="color: #0000ff;">true</span></span>);
    }
}</span></span></pre>
<p>Well that was easy. In fact, I have half a mind to check that in untested, I feel so very positive about it. What&#8217;s that, you say?</p>
<p>Don&#8217;t go into that dark basement?</p>
<p>Fine. I&#8217;ll run it once. You know, just to underscore the excellence of my l33t 5k1llz and give myself a warm, high-fivey sort of feeling.</p>
<p><a href="http://knowyourmeme.com/memes/rage-comics" target="_blank"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px initial initial;" title="Any second now" src="http://www.sharepointdevelopment.me/wp-content/uploads/2011/10/spdialog-rage.png" border="0" alt="Please stand by. A totally sweet dialog will be opening any second now." width="488" height="805" /></a></p>
<p><small><strong>Figure 1.</strong> Crickets.</small></p>
<p><strong>Here&#8217;s The Charlie Brown Football-Kicking Part</strong></p>
<p>So now I&#8217;m laid out on my back, the wind knocked clean from my lungs, a foaming anger brewing over what a cruel mistress SharePoint is to have yanked this football away from me. Halfway through actualizing my happy place and realigning my nerd chakra, I decide that this mystery warrants a little DOM sniffing.</p>
<p>First, some good news. The sky is still blue, and still firmly above our heads: the <em>RegisterStartupScript</em> call works, because our humble line of script has been rendered to the markup in all its glory:</p>
<p><a href="http://www.sharepointdevelopment.me/wp-content/uploads/2011/10/image.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="http://www.sharepointdevelopment.me/wp-content/uploads/2011/10/image_thumb.png" border="0" alt="image" width="413" height="244" /></a></p>
<p>Still further good news. The SharePoint Modal Dialog Framework is not a lie that our parents have us wash down with warm milk and a hug—calling our function from the JavaScript console actually does invoke the popup as intended:</p>
<p><a href="http://www.sharepointdevelopment.me/wp-content/uploads/2011/10/image1.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="http://www.sharepointdevelopment.me/wp-content/uploads/2011/10/image_thumb1.png" border="0" alt="image" width="617" height="450" /></a></p>
<p>Then what manner of pigskin-yanking tomfoolery stands in the way of our function landing the punt while the page is loading?</p>
<h3>Order Up</h3>
<p>Did you know? Before our page can call upon a modal dialog framework to, say, create a modal dialog, <em>our page has to have loaded said modal dialog framework</em>.</p>
<p>It also turns out that this framework is defined in SharePoint&#8217;s aptly-named <em>sp.ui.dialog.js</em> file. Pray tell, then, O scriptacious gods of portal app pop-upage: how can we ensure that the execution of our dialog invocation is delayed until this fine script file is duly at the ready?</p>
<p><a href="http://www.sharepointdevelopment.me/wp-content/uploads/2011/10/image2.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="http://www.sharepointdevelopment.me/wp-content/uploads/2011/10/image_thumb2.png" border="0" alt="image" width="666" height="237" /></a></p>
<p>Oh, how they do provide.</p>
<h3>How Sweet It Is</h3>
<p>So, when we put that little nugget to work for us, the <em>official right way</em> to invoke a SharePoint dialog from server-side code looks something like this:</p>
<pre style="background: white;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.8pt;">protected</span></span></span><span style="font-size: 9.8pt;"> <span><span style="color: #0000ff;">void</span></span> OpenMySweetModalDialog(<span><span style="color: #0000ff;">int</span></span> id)
{
    <span><span style="color: #008000;">// wrap our call in a parameter-less function, and  </span></span>
    <span><span style="color: #008000;">// delay its execution until sp.ui.dialog.js is loaded</span></span>
    <span><span style="color: #0000ff;">var</span></span> script = <span><span style="color: #0000ff;">string</span></span>.Format(
        <span style="color: #a31515;"><span>@"function reallyOpenDialogForRealYouGuys() {{ </span>
<span>            openMySweetModalDialog('{0}'); </span>
<span>        }}; </span>
<span>        SP.SOD.executeOrDelayUntilScriptLoaded(reallyOpenDialogForRealYouGuys, 'sp.ui.dialog.js'); "</span></span>,
        id);

    <span><span style="color: #008000;">// emit script to run on page load</span></span>
    Page.ClientScript.RegisterStartupScript(
        <span><span style="color: #0000ff;">typeof</span></span>(<span><span style="color: #2b91af;">LayoutsPageBase</span></span>), <span><span style="color: #2b91af;">Guid</span></span>.NewGuid().ToString(), script, <span><span style="color: #0000ff;">true</span></span>);
}</span></span></pre>
<p>A press of my well-worn F5 key, and:</p>
<p><a href="http://www.sharepointdevelopment.me/wp-content/uploads/2011/10/image3.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="http://www.sharepointdevelopment.me/wp-content/uploads/2011/10/image_thumb3.png" border="0" alt="image" width="609" height="438" /></a></p>
<p>There. How you like me now, webpage?</p>
<p><a href="http://www.sharepointdevelopment.me/wp-content/uploads/2011/10/image4.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="http://www.sharepointdevelopment.me/wp-content/uploads/2011/10/image_thumb4.png" border="0" alt="image" width="242" height="175" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharepointdevelopment.me/2011/11/opening-a-modal-dialog-on-page-load-from-server-side-code-dont-forget-this-sweet-and-totally-critical-function-call/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building Configurable SharePoint Solutions</title>
		<link>http://www.sharepointdevelopment.me/2011/09/building-configurable-sharepoint-solutions/</link>
		<comments>http://www.sharepointdevelopment.me/2011/09/building-configurable-sharepoint-solutions/#comments</comments>
		<pubDate>Tue, 06 Sep 2011 22:55:43 +0000</pubDate>
		<dc:creator>Grant</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[SharePoint Administration]]></category>

		<guid isPermaLink="false">http://www.sharepointdevelopment.me/?p=429</guid>
		<description><![CDATA[John Ferringer recently spoke at the Fort Wayne SPUG meeting discussing topics in best practices for SharePoint development. During the course of his presentation, one topic was mentioned that struck a chord with me: &#34;be nice to your SharePoint administrators&#34;. Some of us in the SharePoint space (in fact, many of my associates) are IT [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://twitter.com/#!/ferringer" target="_blank">John Ferringer</a> recently <a href="http://mycentraladmin.wordpress.com/2011/08/17/presentation-sharepoint-2010-development-best-practices-spufw-8-17-2011/" target="_blank">spoke at the Fort Wayne SPUG</a> meeting discussing topics in best practices for SharePoint development. During the course of his presentation, one topic was mentioned that struck a chord with me: &quot;be nice to your SharePoint administrators&quot;. Some of us in the SharePoint space (in fact, many of my associates) are IT hybrids. Many of us are developers by trade and SharePoint/network administrators by requirement, or vice versa and I&#8217;ve been fortunate enough to work as both a developer and a network administrator. We&#8217;re intimately familiar with the nuts and bolts of SharePoint as well as the pillars of SharePoint infrastructure (Active Directory, DNS, SQL Server, IIS, Windows Server, etc.). Unfortunately, this can sometimes lead us down a path of development that assumes deployment and maintenance of our solutions will be handled by ourselves, or folks like us. Ease of deployment and configuration of our solutions should be a guiding principle of our development efforts in SharePoint. Let&#8217;s examine one scenario:</p>
<h2>Scenario:</h2>
<p>You have been tasked to create a farm solution that must be configurable upon deployment. Configuration settings must be stored centrally, allowing SharePoint farm administrators to modify configuration settings from Central Administration. Globally stored settings will be accessed by features with Web application, site collection and Web scopes.</p>
<h2>Solution:</h2>
<p>I&#8217;ll begin by stating that there are numerous ways to satisfy the requirements, but I am going to focus on one potential approach. Consider the following:</p>
<ol>
<li><a href="http://msdn.microsoft.com/en-us/library/ms465980.aspx" target="_blank"><strong>Custom Actions</strong></a> are very handy ways to plug navigational elements into the SharePoint UI. Understanding and identifying the appropriate location for a custom action can greatly assist in the management of your solution. For example, the following CAML wrapped up in a farm feature can add links (<a href="http://msdn.microsoft.com/en-us/library/ms478271.aspx" target="_blank"><em>UrlAction</em></a> elements) to configuration pages. The <em>Location</em> attribute will determine where a these elements will be presented. The screenshots below demonstrate how we can surface links to configuration screens right from Central Administration, by specifying that the links are located in<em> Microsoft.SharePoint.Administration.Default</em> location.&#160;
<p><a href="http://www.sharepointdevelopment.me/wp-content/uploads/2011/09/Action1.png" target="_blank"><img style="border-right-width: 0px;margin: 10px 0px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px" class="aligncenter size-medium wp-image-435" border="0" alt="" src="http://www.sharepointdevelopment.me/wp-content/uploads/2011/09/Action1-300x165.png" width="300" height="165" /></a></p>
<p><a href="http://www.sharepointdevelopment.me/wp-content/uploads/2011/09/Action2.png" target="_blank"><img style="border-right-width: 0px;margin: 10px 0px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px" class="aligncenter size-medium wp-image-436" border="0" alt="" src="http://www.sharepointdevelopment.me/wp-content/uploads/2011/09/Action2-300x237.png" width="300" height="237" /></a></p>
<p> Notice that the URLs of the <em>UrlAction</em> elements navigate to an application page that will provide a Web form for administrators to manage these settings. A second <a href="http://msdn.microsoft.com/en-us/library/ms438085.aspx" target="_blank"><em>CustomActionGroup</em></a> is used to provide an expanded set of actions when navigating to the general settings page by clicking the <em>POC Management</em> heading. In this example, we&#8217;ve defined our own custom action location. This location is then referenced using the AdminControlPanel control on the settings page. The result is a behavior that is congruent with other primary areas of configuration in Central Administration:
<p><a href="http://www.sharepointdevelopment.me/wp-content/uploads/2011/09/Action3.png" target="_blank"><img style="border-right-width: 0px;margin: 10px 0px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px" class="aligncenter size-medium wp-image-437" border="0" alt="" src="http://www.sharepointdevelopment.me/wp-content/uploads/2011/09/Action3-300x246.png" width="300" height="246" /></a></p>
<p><a href="http://www.sharepointdevelopment.me/wp-content/uploads/2011/09/Action4.png" target="_blank"><img style="border-right-width: 0px;margin: 10px 0px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px" class="size-medium wp-image-438 aligncenter" border="0" alt="" src="http://www.sharepointdevelopment.me/wp-content/uploads/2011/09/Action4-300x144.png" width="300" height="144" /></a> </p>
</li>
<li><a href="http://msdn.microsoft.com/en-us/library/ee231581.aspx" target="_blank"><strong>Application Pages</strong></a><strong>&#160;</strong>are used to create Web forms for administrators to interact with configuration settings. An application page used in conjunction with a custom action can truly make your custom solution feel seamlessly integrated with SharePoint. This Web form would then save the settings to a central repository for all features to reference. One likely candidate for storing such data would be to use an <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.sppersistedobject.aspx" target="_blank"><em>SPPersistedObject</em></a>. </li>
</ol>
<p>We&#8217;ve really only scratched the surface when it comes to building configurable solutions. Other examples may include:</p>
<ol>
<li>A custom list definition with custom settings. In such an example, a custom action could be made available on the advanced list settings screen. The application page used for managing the settings could then save the settings to the <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.properties.aspx" target="_blank">property bag of the parent <em>SPWeb</em></a>. </li>
<li>A custom Web feature with custom settings. In such an example, a custom action could be made available on the Site Settings screen. The application page used for managing the settings could then save the settings to the <em>SPWeb&#8217;s</em> property bag. </li>
</ol>
<p>The benefits of building solutions that are configurable usually outweigh the required additional development effort. As good stewards of SharePoint development, we should always look to build solutions that leverage SharePoint as a platform, while ensuring that we&#8217;ve provided administrators with the proper tools to manage our solutions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharepointdevelopment.me/2011/09/building-configurable-sharepoint-solutions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change User Profile Synchronization Connection without Losing Profile Data</title>
		<link>http://www.sharepointdevelopment.me/2011/07/change-user-profile-synchronization-connection-without-losing-profile-data/</link>
		<comments>http://www.sharepointdevelopment.me/2011/07/change-user-profile-synchronization-connection-without-losing-profile-data/#comments</comments>
		<pubDate>Thu, 14 Jul 2011 00:00:23 +0000</pubDate>
		<dc:creator>Keith</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[SharePoint Administration]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[user sync service]]></category>

		<guid isPermaLink="false">http://www.sharepointdevelopment.me/?p=372</guid>
		<description><![CDATA[Recently we were dealing with an issue where users were imported from Active Directory into SharePoint User Profiles using the first part of the Fully Qualified Domain Name instead of the NetBIOS Domain Name. This creates issues with the User Profiles, specifically with the Organizational Browser. It appears there is a simple fix by setting the...]]></description>
				<content:encoded><![CDATA[<p>Recently we were dealing with an issue where users were imported from Active Directory into SharePoint User Profiles using the first part of the Fully Qualified Domain Name instead of the NetBIOS Domain Name. This creates issues with the User Profiles, specifically with the Organizational Browser. It appears there is a simple fix by setting the “NetBiosDomainNamesEnabled” property of the User Profile Service Application (UPA) to “True”. You can find several examples of how to do this on the web, but simply put:   </p>
<pre style="font-family: consolas;background: white">$sa = Get-SPServiceApplication –Identity &lt;UPA GUID&gt;
$sa.NetBiosDomainNamesEnabled=&quot;True&quot;
$sa.update()</pre>
<p>After this is completed, you must create a new synchronization connection. <strong>Be aware, in our experience, deleting an existing connection will purge your existing profiles.</strong> That works great if done before any profiles have been updated. Our issue was what to do to apply this same fix but preserve existing profiles and their information. The fix? A combination of enabling NetBiosDomainNames on the UPA and resetting Profile Synchronization using PowerShell. First, the situation: We have a profile store with over 2000 profiles in it. Approximately 800 of which have been updated by end users. Due to a previous issue with the UPA, this is the second incarnation of the UPA at this client. Unfortunately after this one was created the synchronization connection was created before the NetBiosDomainNamesEnabled property was flipped. Now we had new profiles coming into the UPA with the first part of the FQDN instead of the NetBIOS name.</p>
<p>You can find the link to TechNet on how to “Reset Profile Synchronization by using Windows PowerShell” <a href="http://technet.microsoft.com/en-us/library/ff681014.aspx#resetSync" target="_blank">here</a>.&#160; This is part of bigger article on maintaining the SharePoint 2010 Profile Synchronization.</p>
<p>Here is the TechNet article verbatim:<br />
  </p>
<fieldset>
<h3><span>Reset profile synchronization</span></h3>
<p>The User Profile Synchronization database serves as a staging area for user profile information. User Profile information that is stored in the profile store and synchronization database is consumed by the User Profile service. By following the below steps, you can safely reset a User Profile Synchronization database without losing information in the profile store.</p>
<h5>To reset profile synchronization by using Windows PowerShell</h5>
<ol>
<li>Verify that you meet the following minimum requirements:
<ul>
<li>See <a href="http://technet.microsoft.com/en-us/library/ff607596.aspx">Add-SPShellAdmin</a>. </li>
<li>You must be a member of the Farm Administrators group on the computer that is running the SharePoint Central Administration Web site. </li>
<li>The farm account, which is created during the SharePoint farm setup, must also be a Local Administrator on the server where the User Profile Synchronization service is deployed.
<p>This is required to start the User Profile Synchronization service. After the User Profile Synchronization service is started you can remove the farm account from the Administrators group.</p>
</li>
</ul>
</li>
<li>As a precaution, back up the User Profile service application. For more information, see <a href="http://technet.microsoft.com/en-us/library/ee428318.aspx">Back up a service application (SharePoint Server 2010)</a>. </li>
<li>If you are using the My Site cleanup timer job, you must disable it before you reset the synchronization database. Otherwise, the job will delete all user profiles and My Sites from the farm. For information about this timer job, see the <a href="http://technet.microsoft.com/en-us/library/cc678870.aspx">Timer job reference (SharePoint Server 2010)</a>. For information about the Windows PowerShell cmdlets that you use to enable and disable this timer job, see <a href="http://technet.microsoft.com/en-us/library/ee906546.aspx">Timer jobs cmdlets (SharePoint Server 2010)</a>. </li>
<li>On the <strong>Start</strong> menu, click <strong>All Programs</strong>. </li>
<li>Click <strong>Microsoft SharePoint 2010 Products</strong>. </li>
<li>Right-click <strong>SharePoint 2010 Management Shell</strong> and then click <strong>Run as administrator</strong>. </li>
<li>In the <strong>User Account Control</strong> dialog box, click <strong>Yes</strong>. </li>
<li>At the Windows PowerShell command prompt, type the following command to stop the SharePoint 2010 Timer service:
<p>Copy Code</p>
<pre>net stop sptimerv4</pre>
</li>
<li>Copy the following code and paste it into a text editor, such as Notepad:
<p>Copy Code</p>
<pre>$syncdb=Get-SPDatabase <em>&lt;SyncDBGUID&gt;</em>
$syncdb.Unprovision()
$syncdb.Status='Offline'
$upa=Get-SPServiceApplication <em>&lt;UPSAppGUID&gt;</em>
$upa.ResetSynchronizationMachine()
$upa.ResetSynchronizationDatabase()
$syncdb.Provision()</pre>
</li>
<li>Replace the following placeholders with values where:
<ul>
<li><em>&lt;SyncDBGUID&gt;</em> is the GUID of the synchronization database. </li>
<li><em>&lt;UPSAppGUID&gt;</em> is the GUID of the User Profile Service application. </li>
</ul>
<p>For more information, see <a href="http://technet.microsoft.com/en-us/library/ff607889.aspx">Get-SPDatabase</a>.</p>
</li>
<li>Save the file as an ANSI-encoded text file and name the file ResetSyncDB.ps1. </li>
<li>At the Windows PowerShell change to the directory where you saved the file. </li>
<li>Type the following command:
<p>Copy Code</p>
<pre>./ResetSyncDB.ps1</pre>
</li>
<li>Using SQL Server Management Studio, create a login in SQL Server for the User Profile Synchronization service account (that is, the farm account). Then, in the Sync database, create a database user that maps to the login and grant it access to the <strong>db_owner</strong> database role. For more information, see <a href="http://go.microsoft.com/fwlink/?LinkId=211993">How to: Create a SQL Server Login</a> (http://go.microsoft.com/fwlink/?LinkId=211993), <a href="http://go.microsoft.com/fwlink/?LinkId=211994">How to: Create a Database User</a> (http://go.microsoft.com/fwlink/?LinkId=211994), and <a href="http://go.microsoft.com/fwlink/?LinkId=211995">Database-Level Roles</a> (http://go.microsoft.com/fwlink/?LinkId=211995). </li>
<li>At the Windows PowerShell command prompt, type the following command to start the SharePoint 2010 Timer service:
<p>Copy Code</p>
<pre>net start sptimerv4</pre>
</li>
<li>Start the Profile Synchronization service. For more information, see the <a href="http://technet.microsoft.com/en-us/library/144e5f6e-0c9c-4f01-9b1f-26190d527e85(Office.14)#StartUPSSProc">Start the User Profile Synchronization service</a> section of the &quot;Configure profile synchronization&quot; topic. </li>
<li>Reset IIS. For more information about how to reset IIS, see the <a href="http://technet.microsoft.com/en-us/library/144e5f6e-0c9c-4f01-9b1f-26190d527e85(Office.14)#ResetIISProc">Reset IIS</a> section of the &quot;Configure profile synchronization&quot; topic. </li>
<li><strong><em>See Below</em></strong> </li>
</ol>
</fieldset>
<p>Here are some addendums to this for our use:</p>
<p>In Step #9, we modified the script to find the User Profile Service Application</p>
<p>$syncdb = Get-SPDatabase | where {$_.name -eq <span style="color: maroon">&quot;User_Profile_Service_Application_Sync_DB&quot;</span>}</p>
<p>$syncdb.Unprovision() $syncdb.Status=<span style="color: maroon">&#8216;Offline&#8217;</span></p>
<p>$upa = Get-SPServiceApplication | where {$_.name -eq <span style="color: maroon">&quot;User Profile Service Application&quot;</span>}</p>
<p>$upa.ResetSynchronizationMachine()</p>
<p>$upa.ResetSynchronizationDatabase()</p>
<p>$syncdb.Provision()</p>
<ul>
<li>Replace with the name of your sync DB and your UPA. </li>
<li>This script does not show any status or progress, so you may adjust your script to show you it is working.<a href="http://www.sharepointdevelopment.me/wp-content/uploads/2011/07/ResetProfileSync.jpg">
<p><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px" class="alignnone" border="0" alt="ResetProfileSync" src="http://www.sharepointdevelopment.me/wp-content/uploads/2011/07/ResetProfileSync_thumb.jpg" width="244" height="122" /></p>
<p>      </a></li>
</ul>
<p>We did not find step #14 necessary.</p>
<p>Step #17 is not necessary if your UPA is on a different server than your Central Admin.</p>
<p>Now make sure you flip the property on the UPA:</p>
<blockquote>
<ol>
<li>Copy the following code and paste it into a text editor, such as Notepad:
<pre style="font-family: consolas">$upa = Get-SPServiceApplication | where {$_.name -eq <span style="color: #800000">&quot;User Profile Service Application&quot;</span>}
$upa.NetBiosDomainNamesEnabled = <span style="color: #800000">&quot;True&quot;</span>
$upa.Update()</pre>
</li>
<li>Replace with the name of your UPA. </li>
<li>Save the file as ANSI-encoded text file and name the file <span style="font-family: consolas">EnableNetBiosDomainNames.ps1</span> </li>
<li>At the Windows PowerShell, type the following command:
<pre style="font-family: consolas">.\EnableNetBiosDomainNames.ps1</pre>
<p>Notice there are now no Synchronization Connections:</p>
<p><p><img style="border-right-width: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px;padding-top: 0px" border="0" alt="EnableNetBiosDomainNames" src="http://www.sharepointdevelopment.me/wp-content/uploads/2011/07/EnableNetBiosDomainNames_thumb.jpg" width="244" height="134" /></p>
</p>
</li>
</ol>
</blockquote>
<p>Step # 18 in the TechNet Article:<br />
  </p>
<fieldset>18.&#160; Create connections to the data sources. For more information, see <a href="http://technet.microsoft.com/en-us/library/ff428105.aspx" target="_blank">Restore a service application (Search Server 2010)</a>.</fieldset>
<p>Run a full profile synchronization.&#160; For more information, see <a href="http://technet.microsoft.com/en-us/library/6cdcb2e3-8a77-4219-ba08-cc1d0ae8944f#section1" target="_blank">Perform a nonrecurring profile synchronization</a>.</p>
<p>I would recommend a full crawl on your search service application as well to make sure all People results are accurate.</p>
<p>This seems to have worked well for us and allowed us to clean up our UPA. I hope it works well for you too.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharepointdevelopment.me/2011/07/change-user-profile-synchronization-connection-without-losing-profile-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passing Data To and From SharePoint Modal Dialogs</title>
		<link>http://www.sharepointdevelopment.me/2011/06/passing-data-to-and-from-sharepoint-modal-dialogs/</link>
		<comments>http://www.sharepointdevelopment.me/2011/06/passing-data-to-and-from-sharepoint-modal-dialogs/#comments</comments>
		<pubDate>Mon, 13 Jun 2011 11:25:47 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Dialogs]]></category>

		<guid isPermaLink="false">http://www.sharepointdevelopment.me/2011/06/passing-data-to-and-from-sharepoint-modal-dialogs/</guid>
		<description><![CDATA[SharePoint Modal Dialogs SharePoint 2010 introduced the ECMAScript Client Object Model. One of the things that it included was the Dialog Framework. This allows modal dialogs to be easily displayed inside of SharePoint. This is typically done by specifying a web page to be displayed as the dialog on top of the current web page. [...]]]></description>
				<content:encoded><![CDATA[<h3>SharePoint Modal Dialogs</h3>
<p>SharePoint 2010 introduced the ECMAScript Client Object Model. One of the things that it included was the Dialog Framework. This allows modal dialogs to be easily displayed inside of SharePoint. This is typically done by specifying a web page to be displayed as the dialog on top of the current web page. In this first example, a page named BasePage.aspx is displaying a dialog that is popupForm.aspx.</p>
<p><a href="http://www.sharepointdevelopment.me/wp-content/uploads/2011/06/image.png"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border-width: 0px" src="http://www.sharepointdevelopment.me/wp-content/uploads/2011/06/image_thumb.png" border="0" alt="image" width="609" height="400" /></a></p>
<h3>Displaying Dialogs</h3>
<p>It is fairly trivial to display a dialog. All you have to do is initialize an options object and call SP.UI.ModalDIalog.showModalDialog. In this example, the page popupForm.aspx will be displayed as the modal dialog. When the dialog is closed, the method named “callbackMethod” will be called.</p>
<div class="wlWriterEditableSmartContent" style="margin: 0px;float: none;padding: 0px">
<div style="border: #000080 1px solid;color: #000;font-family: 'Courier New', Courier, Monospace;font-size: 10pt">
<div style="background: #000080;color: #fff;font-family: Verdana, Tahoma, Arial, sans-serif;font-weight: bold;padding: 2px 5px">Displaying a Dialog</div>
<div style="background: #ddd;overflow: auto">
<ol style="background: #ffffff;margin: 0 0 0 2em;padding: 0 0 0 5px">
<li><span style="color: #0000ff">var</span> options = {</li>
<li> url: <span style="color: #800000">&#8216;popupForm.aspx&#8217;</span>,</li>
<li> args: <span style="color: #0000ff">null</span>,</li>
<li> title: <span style="color: #800000">&#8216;Select Value&#8217;</span>,</li>
<li> dialogReturnValueCallback: dialogCallback,</li>
<li> };</li>
<li>SP.UI.ModalDialog.showModalDialog(options);</li>
</ol>
</div>
</div>
</div>
<h3>Passing Arguments in the URL</h3>
<p>In many cases, you will want to pass a value to the dialog. The first way to do this is to pass it in as a query string. All that needs to be done is to append the appropriate item and value to the URL. In this example, “7” would be passed to the dialog in a query string named “ItemID”.</p>
<div class="wlWriterEditableSmartContent" style="margin: 0px;float: none;padding: 0px">
<div style="border: #000080 1px solid;color: #000;font-family: 'Courier New', Courier, Monospace;font-size: 10pt">
<div style="background: #000080;color: #fff;font-family: Verdana, Tahoma, Arial, sans-serif;font-weight: bold;padding: 2px 5px">Argument in the Query String</div>
<div style="background: #ddd;overflow: auto">
<ol style="background: #ffffff;margin: 0 0 0 2em;padding: 0 0 0 5px">
<li><span style="color: #0000ff">var</span> options = {</li>
<li> url: <span style="color: #800000">&#8216;popupForm.aspx?itemID=7&#8242;</span>,</li>
<li> args: <span style="color: #0000ff">null</span>,</li>
<li> title: <span style="color: #800000">&#8216;Select Value&#8217;</span>,</li>
<li> dialogReturnValueCallback: dialogCallback,</li>
<li> };</li>
<li>SP.UI.ModalDialog.showModalDialog(options);</li>
</ol>
</div>
</div>
</div>
<p>The value would be retrieved by the dialog in the code behind just as any query string would be retrieved. In this example, the code behind written in C#.</p>
<div class="wlWriterEditableSmartContent" style="margin: 0px;float: none;padding: 0px">
<div style="border: #000080 1px solid;color: #000;font-family: 'Courier New', Courier, Monospace;font-size: 10pt">
<div style="background: #000080;color: #fff;font-family: Verdana, Tahoma, Arial, sans-serif;font-weight: bold;padding: 2px 5px">Retrieving the Argument</div>
<div style="background: #ddd;overflow: auto">
<ol style="background: #ffffff;margin: 0 0 0 2em;padding: 0 0 0 5px">
<li><span style="color: #0000ff">int</span> itemID = <span style="color: #2b91af">Convert</span>.ToInt32(Request.QueryString[<span style="color: #a31515">"ItemID"</span>]);</li>
</ol>
</div>
</div>
</div>
<h3>Passing Arguments in the Options Object</h3>
<p>The other way to pass arguments to the use the args field in the options object. In this example, a value of 7 would be passed to the dialog as an argument.</p>
<div class="wlWriterEditableSmartContent" style="margin: 0px;float: none;padding: 0px">
<div style="border: #000080 1px solid;color: #000;font-family: 'Courier New', Courier, Monospace;font-size: 10pt">
<div style="background: #000080;color: #fff;font-family: Verdana, Tahoma, Arial, sans-serif;font-weight: bold;padding: 2px 5px">Argument in the Options Object</div>
<div style="background: #ddd;overflow: auto">
<ol style="background: #ffffff;margin: 0 0 0 2em;padding: 0 0 0 5px">
<li><span style="color: #0000ff">var</span> options = {</li>
<li> url: <span style="color: #800000">&#8216;popupForm.aspx&#8217;</span>,</li>
<li> args: 7,</li>
<li> title: <span style="color: #800000">&#8216;Select Value&#8217;</span>,</li>
<li> dialogReturnValueCallback: dialogCallback,</li>
<li> };</li>
<li>SP.UI.ModalDialog.showModalDialog(options);</li>
</ol>
</div>
</div>
</div>
<p>The value would be retrieved in javascript using the window.frameElement.dialogArgs property.</p>
<div class="wlWriterEditableSmartContent" style="margin: 0px;float: none;padding: 0px">
<div style="border: #000080 1px solid;color: #000;font-family: 'Courier New', Courier, Monospace;font-size: 10pt">
<div style="background: #000080;color: #fff;font-family: Verdana, Tahoma, Arial, sans-serif;font-weight: bold;padding: 2px 5px">Retrieving the Argument</div>
<div style="background: #ddd;overflow: auto">
<ol style="background: #ffffff;margin: 0 0 0 2em;padding: 0 0 0 5px">
<li><span style="color: #0000ff">var</span> itemID = window.frameElement.dialogArgs;</li>
</ol>
</div>
</div>
</div>
<h3>Returning a Value from the Modal Dialog</h3>
<p>When the user closes the modal dialog, at least one value is returned to the base form. This value is passed to the callback function specified in the options object. This value is the dialog result. The value will depend on how the dialog was closed.</p>
<ul>
<li>If the dialog was closed by calling window.frameElement.cancelPopUp, the result will be SP.UI.DialogResult.cancel.</li>
<li>If the dialog was closed by called window.frameElement.commitPopup, the result will be SP.UI.DialogResult.ok.</li>
<li>If the dialog was closed with window.frameElement.commonModalDialogClose, the result is specified in the first parameter.</li>
</ul>
<p>Side Note: The method named cancelPopUp capitalizes the ‘U’. The method named commitPopup does not.</p>
<p>Here is an example of how the callback would handle the result in JavaScript.</p>
<pre>
<div class="wlWriterEditableSmartContent" style="margin: 0px;float: none;padding: 0px">
<div style="border: #000080 1px solid;color: #000;font-family: 'Courier New', Courier, Monospace;font-size: 10pt">
<div style="background: #000080;color: #fff;font-family: Verdana, Tahoma, Arial, sans-serif;font-weight: bold;padding: 2px 5px">Handling the Callback</div>
<div style="background: #ddd;overflow: auto">
<ol style="background: #ffffff;margin: 0 0 0 2.5em;padding: 0 0 0 5px">
	<li><span style="color: #0000ff">function</span> callbackMethod (dialogResult, returnValue) {</li>
	<li>    <span style="color: #0000ff">if</span>(dialogResult == SP.UI.DialogResult.ok){</li>
	<li>        <span style="color: #006400">// The user clicked the OK button.                 </span></li>
	<li>        <span style="color: #006400">// handle commitPopup         </span></li>
	<li>    } <span style="color: #0000ff">else{</span></li>
	<li>        <span style="color: #006400">// The user clicked the Cancel button.                 </span></li>
	<li>        <span style="color: #006400">// handle cancelPopup         </span></li>
	<li>    }</li>
	<li>}</li>
</ol>
</div>
</div>
</div></pre>
<p>If the dialog needs to be closed from the code behind and not from client side code, the JavaScript is simply inserted in the response.</p>
<div class="wlWriterEditableSmartContent" style="margin: 0px;float: none;padding: 0px">
<div style="border: #000080 1px solid;color: #000;font-family: 'Courier New', Courier, Monospace;font-size: 10pt">
<div style="background: #000080;color: #fff;font-family: Verdana, Tahoma, Arial, sans-serif;font-weight: bold;padding: 2px 5px">Closing The Dialog</div>
<div style="background: #ddd;overflow: auto">
<ol style="background: #ffffff;margin: 0 0 0 2em;padding: 0 0 0 5px">
<li><span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> CloseDialog()</li>
<li>{</li>
<li> Context.Response.Write(<span style="color: #a31515">&#8220;&lt;script type=&#8217;text/javascript&#8217;&gt;window.frameElement.commitPopup();&lt;/script&gt;&#8221;</span>);</li>
<li> Context.Response.Flush();</li>
<li> Context.Response.End();</li>
<li>}</li>
</ol>
</div>
</div>
</div>
<h3>Returning an Argument</h3>
<p>If you want to return an argument from the dialog, it is passed as the first parameter to the commitPopup. In this example, the dialog would return 7.</p>
<div class="wlWriterEditableSmartContent" style="margin: 0px;float: none;padding: 0px">
<div style="border: #000080 1px solid;color: #000;font-family: 'Courier New', Courier, Monospace;font-size: 10pt">
<div style="background: #000080;color: #fff;font-family: Verdana, Tahoma, Arial, sans-serif;font-weight: bold;padding: 2px 5px">Returning a Value</div>
<div style="background: #ddd;overflow: auto">
<ol style="background: #ffffff;margin: 0 0 0 2em;padding: 0 0 0 5px">
<li><span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> CloseDialog()</li>
<li>{</li>
<li> <span style="color: #0000ff">string</span> response</li>
<li> = <span style="color: #0000ff">string</span>.Format(<span style="color: #a31515">&#8220;&lt;script type=&#8217;text/javascript&#8217;&gt;window.frameElement.commitPopup(\&#8221;{0}\&#8221;);&lt;/script&gt;&#8221;</span>, 7);</li>
<li> Context.Response.Flush();</li>
<li> Context.Response.End();</li>
<li>}</li>
</ol>
</div>
</div>
</div>
<p>The value is received in the second parameter of the callback method. In the following example, the return value is placed into a hidden field on the base page.</p>
<div class="wlWriterEditableSmartContent" style="margin: 0px;float: none;padding: 0px">
<div style="border: #000080 1px solid;color: #000;font-family: 'Courier New', Courier, Monospace;font-size: 10pt">
<div style="background: #000080;color: #fff;font-family: Verdana, Tahoma, Arial, sans-serif;font-weight: bold;padding: 2px 5px">Handle Return Value</div>
<div style="background: #ddd;overflow: auto">
<ol style="background: #ffffff;margin: 0 0 0 2em;padding: 0 0 0 5px">
<li><span style="color: #0000ff">function</span> callbackMethod (dialogResult, returnValue)</li>
<li>{</li>
<li> <span style="color: #0000ff">if</span> (returnValue != <span style="color: #0000ff">null</span>) {</li>
<li> $get(<span style="color: #800000">&#8216;&lt;%= this.hiddenField.ClientID %&gt;&#8217;</span>).value = returnValue;</li>
<li> }</li>
<li> <span style="color: #0000ff">return</span>;</li>
<li>}</li>
</ol>
</div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sharepointdevelopment.me/2011/06/passing-data-to-and-from-sharepoint-modal-dialogs/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>How To Get IE6-Friendly SharePoint 2007 Development Done on Windows Server 2008 R2</title>
		<link>http://www.sharepointdevelopment.me/2011/06/how-to-get-ie6-friendly-sharepoint-2007-development-done-on-windows-server-2008-r2/</link>
		<comments>http://www.sharepointdevelopment.me/2011/06/how-to-get-ie6-friendly-sharepoint-2007-development-done-on-windows-server-2008-r2/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 16:32:24 +0000</pubDate>
		<dc:creator>Jon</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[ie6]]></category>
		<category><![CDATA[sharepoint-2007]]></category>

		<guid isPermaLink="false">http://www.sharepointdevelopment.me/?p=336</guid>
		<description><![CDATA[The tooling advances that 2010 has provided make it easy to forget that we used to need a Server version of Windows to have a SharePoint instance to develop against, and that, often, the contemporary browser of SharePoint 2007, Internet Explorer 6, was the main target for your work.

And as soon as you get up out of that ridiculous fetal position...]]></description>
				<content:encoded><![CDATA[<p>You&#8217;ve got to hand it to your parents. You were born at a good point in history, and it is pretty sweet to be living in the future. Granted, it&#8217;s never really the future. You know, like from a Buddhist perspective. But you can totally pull a telephone out of your pocket and watch <a href="http://paperkraft.blogspot.com/2010/10/back-to-future-papercraft-hoverboard.html" target="_blank">Marty McFly rock a pink hoverboard</a> on it. If that&#8217;s what you&#8217;re into.</p>
<p>And in terms of this blog, I prefer to write about the <em>latest</em> version of SharePoint. 2010, as of this missive. Because, from a sort of Buddhist perspective, SharePoint 2007 has been done, and is now just an idea. It has been the legacy version for about a year now. And the corner of the Internet where developers write about MOSS and WSS, I&#8217;m fairly certain, is <a href="http://www.bing.com/search?q=sharepoint+2007" target="_blank">full</a>.</p>
<h3>The Pledge</h3>
<p>Regardless of the above granola sprinkles, I do my fair share of work in MOSS 2007. Because, like it or not, this platform was designed for businesses whose aim is probably something other than backing up the Brinks truck for the latest greatest version of portal software every few years.</p>
<p>The tooling advances that 2010s SharePoint and Visual Studio have provided are wondrous and pampering. They make it easy to forget that we used to need a Server version of Windows to have a SharePoint instance to develop against, and that, often, the contemporary browser of SharePoint 2007, Internet Explorer 6, was the main target for your work.</p>
<p>And as soon as you get up out of that ridiculous fetal position, I&#8217;ll walk you through how I get all of this done without having to step into what only <em>appears </em>to be an ordinary phone booth<sup><a id="fn1ref" href="#fn1">[1]</a></sup>.</p>
<h3>The Turn</h3>
<p>As I mentioned above, the foundation for a MOSS 2007 development machine is a Server version of Windows. I use 2008 R2, installed to a Virtual Hard Disk (.vhd) that I boot my laptop to directly. Running this late model of Windows Server lets me leverage IE9 to test for modern browser conditions. And because it is shiny, anachronism be damned.</p>
<p>But it also leads me straight to the rub of this setup: How can I <em>also</em> test my work for IE6 compatibility?</p>
<p>Internet Explorer, of course, does not allow multiple versions to be installed simultaneously on the same machine. Many well-meaning, golden-hearted folk have attempted to circumvent this web dev-lemma with offerings like <a href="http://my-debugbar.com/wiki/IETester/HomePage" target="_blank">IETester</a> and <a href="http://tredosoft.com/Multiple_IE" target="_blank">MultipleIE</a>. The former comes close in some cases to accurately emulating the <a href="http://www.quirksmode.org/compatibility.html" target="_blank">adorable quirks</a> of the browser we love to hate. If you need to ship pixel-perfect branding, though, close just won&#8217;t cut mustard. And I&#8217;m not sure what&#8217;s going on with MultipleIE, but whatever it is, it was not going on in my Windows Server 2008 R2 environment.</p>
<p>So, at this point in devising my rig, the best option seemed to be to virtualize, running IE6 on a Windows XP VM within my already-virtual server. Now, I see what you&#8217;re thinking there, but this is no time for a <a href="http://knowyourmeme.com/memes/inception" target="_blank">cheap Inception reference</a>. We need to go <em>deeper</em>.</p>
<p>The release of Windows 7 (the client edition of my chosen Windows Server version) brought us the virtual security blanket we call <a href="http://www.microsoft.com/windows/virtual-pc/download.aspx" target="_blank">Windows XP Mode</a>. This would be the ideal fix—a virtual Windows XP machine, running bona fide IE6, with the latest Internet Explorer running on the host system so I can <em>eat</em> my cake, too.</p>
<h3>The Prestige</h3>
<p>But I&#8217;m running Windows <em>Server</em>—XP Mode is only supported for <em>client </em>editions of Windows. And maybe I&#8217;m a joker for even trying, but enabling Hyper-V on an already virtual Windows Server made my laptop angry in that special kind of way. You know, when you genuflect for the <em>entire </em>time that the subsequent restore is chugging? That way.</p>
<p>I had all but given up on achieving an IE6-friendly MOSS 2007 development setup on Windows Server 2008 R2, turning my attention instead to strategically unclenching, and to assuring my family that I was still a willing participant in whatever lives they had going on in the meantime.</p>
<p>Okay, now—do you see that? Right where I let go and let God? That&#8217;s about when I happened on <a href="http://vmlite.com/index.php?option=com_content&amp;view=article&amp;id=47&amp;Itemid=143" target="_blank">VMLite</a>.</p>
<p>The good people over at VMLite have worked some manner of dark magick that leverages <a href="http://www.virtualbox.org/" target="_blank">VirtualBox</a> to deliver a Windows XP Mode machine <em>without</em> requiring hardware virtualization, allowing it to hum along contentedly in more or less whatever odd hosting arrangement you can dream up.</p>
<p><a href="http://www.sharepointdevelopment.me/wp-content/uploads/2011/06/xpmode-in-server-2008r2.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="xpmode in server 2008r2" src="http://www.sharepointdevelopment.me/wp-content/uploads/2011/06/xpmode-in-server-2008r2_thumb.png" border="0" alt="xpmode in server 2008r2" width="644" height="364" /></a></p>
<p><span style="font-size: x-small;"><strong>Figure 1. My fully operational SharePoint 2007 battle station</strong></span></p>
<p>Finally, I was afforded the luxury of testing my SharePoint 2007 work in a very particular CSS insane asylum. One that we can hope will very soon be done, and will very soon be just an idea.</p>
<hr />
<ol>
<li id="fn1">If you&#8217;re from the United States and you&#8217;re awesome, that&#8217;s a Bill &amp; Ted reference. If you&#8217;re English or just super into the <a href="http://www.nerdist.com/" target="_blank">Nerdist</a>, it&#8217;s a Doctor Who nod. Dimensionally transcendental, in either case. <a href="#fn1ref">↩</a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.sharepointdevelopment.me/2011/06/how-to-get-ie6-friendly-sharepoint-2007-development-done-on-windows-server-2008-r2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
