<?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>Yaroslav Pentsarskyy on SharePoint Development &#187; MOSS</title>
	<atom:link href="http://www.sharemuch.com/category/moss/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sharemuch.com</link>
	<description>Yaroslav writes about his SharePoint developer findings</description>
	<lastBuildDate>Sun, 05 Sep 2010 05:05:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Have SharePoint public site &#8211; here is how to make it mobile friendly</title>
		<link>http://www.sharemuch.com/2010/08/27/have-sharepoint-public-site-here-is-how-to-make-mobile-friendly/</link>
		<comments>http://www.sharemuch.com/2010/08/27/have-sharepoint-public-site-here-is-how-to-make-mobile-friendly/#comments</comments>
		<pubDate>Sat, 28 Aug 2010 03:00:44 +0000</pubDate>
		<dc:creator>Yaroslav Pentsarskyy</dc:creator>
				<category><![CDATA[MOSS]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[sharepoint 2010]]></category>
		<category><![CDATA[sharepoint mobile]]></category>
		<category><![CDATA[sharepoint mobile redirect]]></category>

		<guid isPermaLink="false">http://www.sharemuch.com/?p=1374</guid>
		<description><![CDATA[SharePoint, especially 2010 release, is becoming more popular as a public site platform &#8211; and with an increased number of mobile devices &#8211; mobile site experience is expected. Both SharePoint and SharePoint 2010 have mobile support. When user with a &#8230; <a href="http://www.sharemuch.com/2010/08/27/have-sharepoint-public-site-here-is-how-to-make-mobile-friendly/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fwww.sharemuch.com%252F2010%252F08%252F27%252Fhave-sharepoint-public-site-here-is-how-to-make-mobile-friendly%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Have%20SharePoint%20public%20site%20-%20here%20is%20how%20to%20make%20it%20mobile%20friendly%22%20%7D);"></div>
<p>SharePoint, especially 2010 release, is becoming more popular as a public site platform &#8211; and with an increased number of mobile devices &#8211; mobile site experience is expected.</p>
<p>Both SharePoint and SharePoint 2010 have mobile support. When user with a mobile device accesses the site &#8211; the site redirects users to a mobile version of the site. In this article we will cover how to make sure that you redirect all of the latest devices to a mobile site as well as how the actual redirect happens.</p>
<p>If you Navigate to the root of your SharePoint site in IIS (Ex. C:\Inetpub\wwwroot\wss\VirtualDirectories\80) you will locate <strong>App_Browsers</strong> &#8211; the folder that contains browser definitions. In order to ensure you have support for all of the latest browsers &#8211; you can download the latest browser definition file (mobile.browser) from codeplex &#8211; <a href="http://mdbf.codeplex.com" target="_self">Mobile Device Browser File</a> (credit goes to Mark Bice for this one) .</p>
<p>Now copy the <strong>mobile.browser </strong>file you downloaded to <strong>Devices</strong> folder in <strong>App_Browsers</strong> which you will have to create.</p>
<p>If you worked with ASP.Net before you probably know that <strong>HttpContext </strong>has a property that will determine whether your browser is a mobile browser &#8211; <strong>HttpContext.Current.Request.Browser.IsMobileDevice </strong>. This will ordinarily return false unless you have an up to date mobile.browser file &#8211; so keep your browser definitions current.</p>
<p>What happens next is really up to you. You can create a user control in the masterpage of your SharePoint site; the user control will have a code behind that will determine whether the current browser is a mobile device browser and redirect users to more simplified version of a site.</p>
<p>Here is how my user control code behind could look like:</p>
<pre>HttpRequest req = HttpContext.Current.Request;</pre>
<pre>string pageName = req.Url.Segments[req.Url.Segments.Length - 1];</pre>
<pre>string mobileUrl = MobileHelper.getMobilePage(pageName);</pre>
<pre>if (HttpContext.Current.Request.Browser.IsMobileDevice)</pre>
<pre>{   if (!string.IsNullOrEmpty(mobileUrl))</pre>
<pre>{        Response.Redirect("~/Mobile/Pages/" + mobileUrl);    }</pre>
<pre>else    {        Response.Redirect("~/Mobile/Pages/" +</pre>
<pre>MobileConstants.NotFoundPage);    }   }</pre>
<p>Good Luck!</p>

]]></content:encoded>
			<wfw:commentRss>http://www.sharemuch.com/2010/08/27/have-sharepoint-public-site-here-is-how-to-make-mobile-friendly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Demystifying: SharePoint site collection specific timer jobs</title>
		<link>http://www.sharemuch.com/2010/08/24/demystifying-sharepoint-site-collection-specific-timer-jobs/</link>
		<comments>http://www.sharemuch.com/2010/08/24/demystifying-sharepoint-site-collection-specific-timer-jobs/#comments</comments>
		<pubDate>Wed, 25 Aug 2010 02:10:17 +0000</pubDate>
		<dc:creator>Yaroslav Pentsarskyy</dc:creator>
				<category><![CDATA[MOSS]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[sharepoint 2010]]></category>
		<category><![CDATA[sharepoint timer job]]></category>

		<guid isPermaLink="false">http://www.sharemuch.com/?p=1366</guid>
		<description><![CDATA[If you worked with timer jobs in SharePoint (both MOSS and 2010) &#8211; you know that those execute on Web Application level. There in Central Administration you can see all of the definitions and statuses of running job. In SharePoint &#8230; <a href="http://www.sharemuch.com/2010/08/24/demystifying-sharepoint-site-collection-specific-timer-jobs/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fwww.sharemuch.com%252F2010%252F08%252F24%252Fdemystifying-sharepoint-site-collection-specific-timer-jobs%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Demystifying%3A%20SharePoint%20site%20collection%20specific%20timer%20jobs%22%20%7D);"></div>
<p>If you worked with timer jobs in SharePoint (both MOSS and 2010) &#8211; you know that those execute on Web Application level. There in Central Administration you can see all of the definitions and statuses of running job. In SharePoint 2010 you can even change the schedule of those definitions.</p>
<p>The most typical way to provision new timer job is to use Web Application scoped feature which will all the definition to SharePoint  - which basically is a record in SharePoint configuration DB.</p>
<p>If you open SharePoint central administration and take a look at the list of timer job definitions &#8211; you will see that some of them are scoped to various site collection. In fact there are duplicates of the same timer job definition running on several sites.</p>
<p>So how do you provision site collection specific timer job from Web Application scoped feature?</p>
<p>Here is one of the ways to do it. Assuming your site inherits from a custom site template, we can enumerate web application site collections that have that template and provision our time job as we normally would once we find our site template.</p>
<p>The code would look like this:</p>
<pre>public override void FeatureActivated(SPFeatureReceiverProperties</pre>
<pre>properties)</pre>
<pre>{</pre>
<pre>SPWebApplication webApp = properties.Feature.Parent</pre>
<pre>as SPWebApplication;</pre>
<pre>foreach (SPSite site in webApp.Sites)</pre>
<pre>{</pre>
<pre>string template = site.RootWeb.WebTemplate.ToString();</pre>
<pre>if (template == "MYTEMPLATE")</pre>
<pre>// code to execute for this site collection to provision a job</pre>
<pre>}</pre>
<pre>}</pre>
<p>One of the other ways to do it, is to accept feature parameters which will denote your Url in this case you would use:</p>
<pre>webApp.Sites[site].Url</pre>
<p>One of the things that becomes an issue though is when you use an automated tool to deploy your site &#8211; your web application gets created first &#8211; seemingly activating all the dependent features. In our case this means that actions will be taken on site collections that don&#8217;t yet exist.</p>
<p>In this case, you would need to activate your features manually once the structure has been provisioned using your automated tool.</p>
<p>Good Luck!</p>

]]></content:encoded>
			<wfw:commentRss>http://www.sharemuch.com/2010/08/24/demystifying-sharepoint-site-collection-specific-timer-jobs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programmatically accessing SharePoint 2010 Visual Upgrade options</title>
		<link>http://www.sharemuch.com/2010/08/20/programmatically-accessing-sharepoint-2010-visual-upgrade-options/</link>
		<comments>http://www.sharemuch.com/2010/08/20/programmatically-accessing-sharepoint-2010-visual-upgrade-options/#comments</comments>
		<pubDate>Sat, 21 Aug 2010 04:56:23 +0000</pubDate>
		<dc:creator>Yaroslav Pentsarskyy</dc:creator>
				<category><![CDATA[MOSS]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[sharepoint 2010]]></category>
		<category><![CDATA[moss to 2010 upgrade]]></category>
		<category><![CDATA[sharepoint 2010 upgrade]]></category>
		<category><![CDATA[sharepoint upgrade]]></category>

		<guid isPermaLink="false">http://www.sharemuch.com/?p=1357</guid>
		<description><![CDATA[One of the cool features in SharePoint 2010 is it&#8217;s ability to easily upgrade the site from MOSS. Just recently I have been upgrading a heavily customized site that had custom branding (and I&#8217;m talking custom-custom), JQuery calls to web &#8230; <a href="http://www.sharemuch.com/2010/08/20/programmatically-accessing-sharepoint-2010-visual-upgrade-options/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fwww.sharemuch.com%252F2010%252F08%252F20%252Fprogrammatically-accessing-sharepoint-2010-visual-upgrade-options%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Programmatically%20accessing%20SharePoint%202010%20Visual%20Upgrade%20options%22%20%7D);"></div>
<p>One of the cool features in SharePoint 2010 is it&#8217;s ability to easily upgrade the site from MOSS. Just recently I have been upgrading a heavily customized site that had custom branding (and I&#8217;m talking custom-custom), JQuery calls to web services, custom web parts targeted for SharePoint 2010, site definitions, page layouts and many more. The upgrade went seamlessly and I think I was asked less questions than when I installed MS Excel.</p>
<p>As soon as the site is upgraded you will see all of the 2010 features available and event some of the icons in system UI will look 2010-ish; your Central Administration will have 2010 UI. Your site however, will still be based of UI Version 3 (MOSS). You can upgrade it by using Visual Upgrade :</p>
<p><a href="http://www.sharemuch.com/wp-content/uploads/2010/08/visual-upgrade-option.png"><img class="alignnone size-full wp-image-1358" title="visual upgrade option" src="http://www.sharemuch.com/wp-content/uploads/2010/08/visual-upgrade-option.png" alt="" width="255" height="249" /></a></p>
<p>You will be given 3 options:</p>
<p>Use the previous user interface<br />
Preview the updated user interface<br />
Update the user interface</p>
<p>Usually when your site definitio(s) use custom master page, you will break your site when upgrading the UI to version 4. You will get an error message similar to this:</p>
<p><strong>&#8220;Cannot find ContentPlaceHolder &#8216;PlaceHolderCSSLayout&#8217; in the master page &#8216;/_catalogs/masterpage/v4.master&#8217;, verify content control&#8217;s ContentPlaceHolderID attribute in the content page.&#8221;</strong></p>
<p>In case your users broke the site this way &#8211; you can always restore it back to the previous version by either using an upgrade page on your site: <strong>_layouts/prjsetng.aspx</strong></p>
<p>or programmatically by updating the value of the <strong>SPWeb</strong> object of your root site collection site:</p>
<pre>SPWeb web = SPContext.Current.Web; // or web you want to access</pre>
<pre>web.UIVersion = 3; // 3/4 version
web.UIVersionConfigurationEnabled = true; // is upgrade option locked?</pre>
<p>here you can also toggle whether you want to see upgrade option in <strong>Site Actions </strong>menu event though the upgrade has been successful &#8211; in case you want to toggle between UI versions in your development environment.</p>
<p>Good Luck!</p>

]]></content:encoded>
			<wfw:commentRss>http://www.sharemuch.com/2010/08/20/programmatically-accessing-sharepoint-2010-visual-upgrade-options/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating custom list alert templates in SharePoint 2010</title>
		<link>http://www.sharemuch.com/2010/08/15/creating-custom-list-alert-templates-in-sharepoint-2010/</link>
		<comments>http://www.sharemuch.com/2010/08/15/creating-custom-list-alert-templates-in-sharepoint-2010/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 02:31:37 +0000</pubDate>
		<dc:creator>Yaroslav Pentsarskyy</dc:creator>
				<category><![CDATA[MOSS]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[sharepoint 2010]]></category>
		<category><![CDATA[alert]]></category>
		<category><![CDATA[custom list alerts]]></category>
		<category><![CDATA[sharepoint alert]]></category>

		<guid isPermaLink="false">http://www.sharemuch.com/?p=1345</guid>
		<description><![CDATA[SharePoint 2010 allows you to create custom alert templates per list, meaning you can customize what&#8217;s going to show up in your SPList alert body. In this example I won&#8217;t focus how you can actually edit the alert CAML &#8211; &#8230; <a href="http://www.sharemuch.com/2010/08/15/creating-custom-list-alert-templates-in-sharepoint-2010/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fwww.sharemuch.com%252F2010%252F08%252F15%252Fcreating-custom-list-alert-templates-in-sharepoint-2010%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Creating%20custom%20list%20alert%20templates%20in%20SharePoint%202010%22%20%7D);"></div>
<p>SharePoint 2010 allows you to create custom alert templates per list, meaning you can customize what&#8217;s going to show up in your SPList alert body.</p>
<p>In this example I won&#8217;t focus how you can actually edit the alert CAML &#8211; you can figure it out based on existing list of templates, let`s see what`s involved in creating a new alert template and assigning it to the list:</p>
<p>1. Create a new Visual Studio 2010 SharePoint solution.</p>
<p>2. Map a TEMPLATES folder in your solution directory and create a new folder underneath it called XML. This XML folder will contain an XML file that will define your alerts.</p>
<p>3. Create a new file in sub folder (project specific name) inside XML folder in your solution and add XML File into a sub folder.</p>
<p>4. Navigate to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML on your file system and open <strong>alerttemplates.xml</strong>this is out-of-the-box alert definition that you should not modify. Take a loot at the structure of the file and how each alert is defined.</p>
<p>5. Copy alert definition of the list type that closely resembles what you want your new alert to look like ad paste it into your solutions custom alert XML file. If we were to copy generic list template &#8211; everything including the XML below would have to be copied:</p>
<pre>&lt;AlertTemplate Type="List" </pre>
<pre>Name="SPAlertTemplateType.GenericList"&gt;
&lt;/AlertTemplate&gt;</pre>
<p>6. Make any adjustments to the custom alert CAML (this is something you will have to figure out based on your needs).</p>
<p>7. Create a new site scoped feature which will add our custom alert template to the list of your choice and not to any other list on the site.</p>
<p>8. Add a receiver to the feature and in FeatureActivated method place the following code:</p>
<pre>public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
    SPSite site = properties.Feature.Parent as SPSite;</pre>
<pre>    XmlDocument xmlDoc = new XmlDocument();</pre>
<pre>    // The path to your alert templates
    xmlDoc.Load(SPUtility.GetGenericSetupPath(@"XML\YourProject")</pre>
<pre>+ "YourAlertTemplates.xml");</pre>
<pre>    // The list you want to have custom alert template
    SPList list = site.RootWeb.Lists["YourList"];
    SPAlertTemplate template = new SPAlertTemplate();
    template.Xml = xmlDoc.InnerXml;
    template.Name = "YourAlertTemplate";</pre>
<pre>    list.AlertTemplate = template;
    list.ParentWeb.AllowUnsafeUpdates = true;
    list.Update();
}</pre>
<p>Above is going to take care of loading the template and assigning it to the list.</p>
<p>Now when this code is executed and template loaded to the list &#8211; new alert that are triggered with the template are going to come with the definition you have specified in your custom alert template file.</p>
<p>Good Luck!</p>

]]></content:encoded>
			<wfw:commentRss>http://www.sharemuch.com/2010/08/15/creating-custom-list-alert-templates-in-sharepoint-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programatically creating SharePoint site collection relative search scope</title>
		<link>http://www.sharemuch.com/2010/08/09/programatically-creating-sharepoint-site-collection-relative-search-scope/</link>
		<comments>http://www.sharemuch.com/2010/08/09/programatically-creating-sharepoint-site-collection-relative-search-scope/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 04:37:45 +0000</pubDate>
		<dc:creator>Yaroslav Pentsarskyy</dc:creator>
				<category><![CDATA[MOSS]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[create search scope]]></category>
		<category><![CDATA[search scope]]></category>

		<guid isPermaLink="false">http://www.sharemuch.com/?p=1335</guid>
		<description><![CDATA[Let&#8217;s say you have few site collections each representing separate department within organization; you want to enable your users to be able to search each department site separately to narrow down their results. In another scenario &#8211; you may have &#8230; <a href="http://www.sharemuch.com/2010/08/09/programatically-creating-sharepoint-site-collection-relative-search-scope/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fwww.sharemuch.com%252F2010%252F08%252F09%252Fprogramatically-creating-sharepoint-site-collection-relative-search-scope%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Programatically%20creating%20SharePoint%20site%20collection%20relative%20search%20scope%22%20%7D);"></div>
<p>Let&#8217;s say you have few site collections each representing separate department within organization; you want to enable your users to be able to search each department site separately to narrow down their results. In another scenario &#8211; you may have many site collections representing client site &#8211; where the structure of lists and libraries is still the same &#8211; yu may also want to help your users with searching those sites by creating a scope specific to the URL of the current site collection.</p>
<p>You can set up site collection scope using UI &#8211; but if you have many sites or you need to create scopes as a part of automated site provisioning &#8211; it&#8217;s much eaasier to create those programatically.</p>
<p>Assuming you are using SharePoint feature to do the job, here is how your <strong>feature.xml </strong>is going to look like:</p>
<pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;Feature xmlns="<a href="http://schemas.microsoft.com/sharepoint/">http://schemas.microsoft.com/sharepoint/</a>"
 Id="BBDCB6EC-833D-4b99-A93D-19E16B0B4ED0"
 Title="Set Search Scopes"
 Description="Set Search Scopes"
 Version="1.0.0.0"
 Scope="Web"
 Hidden="False"
 ActivateOnDefault="FALSE"
 AlwaysForceInstall="TRUE"
 ReceiverAssembly="MyAssembly, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=0bcd2fea03ff3d79"
 ReceiverClass="MySolution.SetSearchScopes"&gt;
  &lt;ElementManifests&gt;
  &lt;/ElementManifests&gt;
&lt;/Feature&gt;
</pre>
<p>And here is the feature receiver <strong>FeatureActivated </strong>method contents :</p>
<pre>using (SPWeb web = properties.Feature.Parent as SPWeb)
{
    SearchContext searchctx = null;</pre>
<pre>    searchctx = SearchContext.GetContext(web.Site);</pre>
<pre>    Scopes scopes = new Scopes(searchctx);</pre>
<pre>    Scope currentScope = scopes.AllScopes.Create(
        "CurrentScopeName", string.Empty, new Uri(web.Site.Url), true,
        string.Format("{0}/Search/Pages/Results.aspx", web.Site.Url),
        ScopeCompilationType.AlwaysCompile);</pre>
<pre>    currentScope.Update();</pre>
<pre>    currentScope.Rules.CreateUrlRule(ScopeRuleFilterBehavior.Include,
        UrlScopeRuleType.Domain, web.Site.Url);</pre>
<pre>    ScopeDisplayGroup group = scopes.GetDisplayGroup(new Uri(web.Url),
        "Search Dropdown");</pre>
<pre>    group.Add(currentScope);
    group.Update();</pre>
<pre>    scopes.StartCompilation();
    scopes.Update();
}</pre>
<p>As you can see our feature is activate on a root web level and passes on the context of the current site collection. This context is used to create a new scope and to create a rule which will filter out all of the results except the results coming from the existing site collection:</p>
<pre>currentScope.Rules.CreateUrlRule(ScopeRuleFilterBehavior.Include,
        UrlScopeRuleType.Domain, web.Site.Url);</pre>
<p>To try it out &#8211; install this feature in your farm and activate it &#8211; when you navigate to Search Settings of your site &#8211; you will notice a new scope created with a name specified under <strong>Search Dropdown</strong>  group.</p>
<p>Good Luck!</p>

]]></content:encoded>
			<wfw:commentRss>http://www.sharemuch.com/2010/08/09/programatically-creating-sharepoint-site-collection-relative-search-scope/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
