<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Yaroslav Pentsarskyy's SharePoint and .NET adventures</title>
	
	<link>http://www.sharemuch.com</link>
	<description>Innovative SharePoint solutions and training</description>
	<lastBuildDate>Wed, 10 Mar 2010 01:17:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/YaroslavPentsarskyysDevelopmentBlog" /><feedburner:info uri="yaroslavpentsarskyysdevelopmentblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Interview: Sing Chan on branding for SharePoint 2010</title>
		<link>http://feedproxy.google.com/~r/YaroslavPentsarskyysDevelopmentBlog/~3/NAGHILrEIdI/</link>
		<comments>http://www.sharemuch.com/2010/03/09/interview-sing-chan-on-branding-for-sharepoint-2010/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 01:17:46 +0000</pubDate>
		<dc:creator>Yaroslav Pentsarskyy</dc:creator>
				<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[sharepoint 2010]]></category>
		<category><![CDATA[sharepoint branding]]></category>

		<guid isPermaLink="false">http://www.sharemuch.com/?p=1071</guid>
		<description><![CDATA[You know that feeling when you finish your next public website that will be visited by hundreds and thousands of people each day, well, neither do I but I can imagine; that&#8217;s why I decided to talk to Sing today (his blog http://www.singchan.com) and figure out his process and what tools he&#8217;s using. We focused on [...]]]></description>
			<content:encoded><![CDATA[<p>You know that feeling when you finish your next public website that will be visited by hundreds and thousands of people each day, well, neither do I but I can imagine; that&#8217;s why I decided to talk to Sing today (his blog <a href="http://www.singchan.com">http://www.singchan.com</a>) and figure out his process and what tools he&#8217;s using. We focused on SharePoint 2010 but there are general guidances too that you can use in any website production process. Check it out &#8211; 12 min!</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="601" height="338" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=10049204&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="601" height="338" src="http://vimeo.com/moogaloop.swf?clip_id=10049204&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" allowfullscreen="true" allowscriptaccess="always"></embed></object></p>
<p><a href="http://vimeo.com/10049204">Sing Chan on general and SharePoint 2010 branding</a> from <a href="http://vimeo.com/user1796695">Yaroslav Pentsarskyy</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<img src="http://feeds.feedburner.com/~r/YaroslavPentsarskyysDevelopmentBlog/~4/NAGHILrEIdI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.sharemuch.com/2010/03/09/interview-sing-chan-on-branding-for-sharepoint-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.sharemuch.com/2010/03/09/interview-sing-chan-on-branding-for-sharepoint-2010/</feedburner:origLink></item>
		<item>
		<title>Removing metadata from SharePoint 2010 search results</title>
		<link>http://feedproxy.google.com/~r/YaroslavPentsarskyysDevelopmentBlog/~3/YmK7GxbtpEI/</link>
		<comments>http://www.sharemuch.com/2010/03/08/removing-metadata-from-sharepoint-2010-search-results/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 06:45:14 +0000</pubDate>
		<dc:creator>Yaroslav Pentsarskyy</dc:creator>
				<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[sharepoint 2010]]></category>
		<category><![CDATA[search core result]]></category>
		<category><![CDATA[sharepoint 2010 search]]></category>
		<category><![CDATA[sharepoint search metadata]]></category>
		<category><![CDATA[sharepoint search xsl]]></category>

		<guid isPermaLink="false">http://www.sharemuch.com/?p=1066</guid>
		<description><![CDATA[Recently I have been involved in a solution where I needed to customize my Search Core Results webpart. In short; I had to remove Created By and replace it with a piece of metadata called alias.
Seems like a trivial task &#8211; all you need to do is to adjust XSL of the Search Core Results [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I have been involved in a solution where I needed to customize my Search Core Results webpart. In short; I had to remove <strong>Created By</strong> and replace it with a piece of metadata called <strong>alias.</strong></p>
<p>Seems like a trivial task &#8211; all you need to do is to adjust XSL of the <strong>Search Core Results </strong>and remove or replace Author field, but there is a catch.</p>
<p>First, open your Search Core Results XSL:</p>
<p><a href="http://www.sharemuch.com/wp-content/uploads/2010/03/xsl-editor.JPG"><img class="alignnone size-full wp-image-1067" title="xsl editor" src="http://www.sharemuch.com/wp-content/uploads/2010/03/xsl-editor.JPG" alt="xsl editor" width="214" height="197" /></a></p>
<p>I recomment you copy and paste the contents of the XSL editor into notepad (at least) and find the following section:</p>
<p><em>&lt;!&#8211; Main body template. Sets the Results view (Relevance or date) options &#8211;&gt;</em></p>
<p>this section denotes a start of the XSL responsible for rendering the body of the results. In here you will find all of the components that put together a search result. In my case I found and replaced the document author retrieval  implementation with the following:</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 261px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">&lt;xsl:call-template name=&#8221;DisplayAuthors&#8221;&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 261px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">&lt;xsl:with-param name=&#8221;alias&#8221; select=&#8221;alias&#8221; /&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 261px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">&lt;/xsl:call-template&gt;</div>
<blockquote><p>&lt;xsl:call-template name=&#8221;DisplayAuthors&#8221;&gt;</p>
<p>&lt;xsl:with-param name=&#8221;alias&#8221; select=&#8221;alias&#8221; /&gt;</p>
<p>&lt;/xsl:call-template&gt;</p></blockquote>
<p>After the XSL was saved, this worked well but I was still getting the actual <strong><em>CreatedBy </em><span style="font-weight: normal;"> in my search results. The created by information turned out to be coming from  the property called </span><em>hithighlightedsummary</em></strong></p>
<p>If you take a look at the definition of this property in your search service application: <em>http://[central admin url]/_admin/search/listmanagedproperties.aspx</em></p>
<p>you will notice that <strong><em>hithighlightedsummary </em><span style="font-weight: normal;"> doesn`t have any of the crawled properties defined explicitly. In fact, this property is a dynamic summary that has a collection of highlighted word pieces that best describe the result and give user the text around the keywords they were searching. Among those calculated pieces of metadata we have </span><em>CreatedBy </em><span style="font-weight: normal;">and any other relevant metadata. </span></strong></p>
<p><strong><span style="font-weight: normal;">This means that no matter how much you customize your XSL &#8211; you will still receive some parts of the metadata as part of the <strong><em>hithighlightedsummary </em><em>. <span style="font-weight: normal;"><span style="font-style: normal;">One compromise is to remove this property from your XSL and replace it with a item description, body, or any other metadata that is relevant in your case.</span></span></em></strong></span></strong></p>
<p><strong><span style="font-weight: normal;"><strong><em><span style="font-weight: normal;"><span style="font-style: normal;">Here is the template and selector that call <strong><span style="font-weight: normal;"><strong><em>hithighlightedsummary  <span style="font-style: normal; font-weight: normal;"><strong><span style="font-weight: normal;"><strong><em><span style="font-weight: normal;"><span style="font-style: normal;"><strong><span style="font-weight: normal;"><strong><em><span style="font-weight: normal;"><span style="font-style: normal;">from the XSL:</span></span></em></strong></span></strong></span></span></em></strong></span></strong></span></em></strong></span></strong></span></span></em></strong></span></strong></p>
<p><strong><span style="font-weight: normal;"><strong><em><span style="font-weight: normal;"><span style="font-style: normal;"> </span></span></em></strong></span></strong></p>
<p><strong><strong><em></p>
<blockquote><p><span style="font-weight: normal;"><span style="font-style: normal;">&lt;xsl:when test=&#8221;hithighlightedsummary[. != '']&#8220;&gt;</span></span></p>
<p><span style="font-weight: normal;"><span style="font-style: normal;">&lt;xsl:call-template name=&#8221;HitHighlighting&#8221;&gt;</span></span></p>
<p><span style="font-weight: normal;"><span style="font-style: normal;">&lt;xsl:with-param name=&#8221;hh&#8221; select=&#8221;hithighlightedsummary&#8221; /&gt; </span></span></p>
<p><span style="font-weight: normal;"><span style="font-style: normal;">&lt;/xsl:call-template&gt; </span></span></p>
<p><span style="font-weight: normal;"><span style="font-style: normal;">&lt;/xsl:when&gt;</span></span></p></blockquote>
<p><span style="font-weight: normal;"><span style="font-style: normal;">To create your new custom summary field you would define the managed property that will incorporate relevant crawled properties in here:</span></span> <strong><span style="font-weight: normal;"><strong><em><span style="font-weight: normal;">http://[central admin url]/_admin/search/listmanagedproperties.aspx<span style="font-style: normal;"> and then reference it in the template as shown above.</span></span></em></strong></span></strong></p>
<p><strong><span style="font-weight: normal;"><strong><em><span style="font-weight: normal;"><span style="font-style: normal;">Don`t forget to include your newly created managed property in a list of fetched columns  within your Search Core Results:</span></span></em></strong></span></strong></p>
<p><strong><span style="font-weight: normal;"><strong><em><span style="font-weight: normal;"><span style="font-style: normal;"><a href="http://www.sharemuch.com/wp-content/uploads/2010/03/fetched-columns.JPG"><img class="alignnone size-full wp-image-1068" title="fetched columns" src="http://www.sharemuch.com/wp-content/uploads/2010/03/fetched-columns.JPG" alt="fetched columns" width="194" height="99" /></a></span></span></em></strong></span></strong></p>
<p><strong><span style="font-weight: normal;"><strong><em><span style="font-weight: normal;"><span style="font-style: normal;">Good luck!</span></span></em></strong></span></strong></p>
<p></em></strong></strong></p>
<img src="http://feeds.feedburner.com/~r/YaroslavPentsarskyysDevelopmentBlog/~4/YmK7GxbtpEI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.sharemuch.com/2010/03/08/removing-metadata-from-sharepoint-2010-search-results/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.sharemuch.com/2010/03/08/removing-metadata-from-sharepoint-2010-search-results/</feedburner:origLink></item>
		<item>
		<title>Dynamically changing SharePoint 2010 list form rendering templates</title>
		<link>http://feedproxy.google.com/~r/YaroslavPentsarskyysDevelopmentBlog/~3/JGZTIQ9-ZwA/</link>
		<comments>http://www.sharemuch.com/2010/03/06/dynamically-changing-sharepoint-2010-list-form-rendering-templates/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 03:56:08 +0000</pubDate>
		<dc:creator>Yaroslav Pentsarskyy</dc:creator>
				<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[sharepoint 2010]]></category>
		<category><![CDATA[dynamically changing rendering template]]></category>
		<category><![CDATA[Rendering template]]></category>

		<guid isPermaLink="false">http://www.sharemuch.com/?p=1059</guid>
		<description><![CDATA[Here is the scenario: you have few lists in your portal that`s already deployed in production environment and contain data. Here you realize that you need to adjust one of the lists` rendering template to remove some information on a Displayor Edit form.  You can`t change the schema.xml of the list because you will have [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Here is the scenario: </strong>you have few lists in your portal that`s already deployed in production environment and contain data. Here you realize that you need to adjust one of the lists` rendering template to remove some information on a Displayor Edit form.  You can`t change the <strong><em>schema.xml</em></strong> of the list because you will have to recreate the it and your customer will loose all the data.</p>
<p>Assuming you already have a rendering template ready or have just deplo0yed it &#8211; <strong>here is one quick way</strong> to rescue the day:</p>
<p>1. Open site in SharePoint Designer.</p>
<p>2. Click Lists and Libraries.</p>
<p>3. Click on the list you`d like to change the template on (Comments in my example)</p>
<p><a href="http://www.sharemuch.com/wp-content/uploads/2010/03/attachment.ashx.png"><img class="alignnone size-full wp-image-1064" title="attachment.ashx" src="http://www.sharemuch.com/wp-content/uploads/2010/03/attachment.ashx.png" alt="attachment.ashx" width="379" height="271" /></a></p>
<p>4. Select the View of your interest, in my case I`ll be changing Display Form (ViewComments.aspx in case of Comments list)</p>
<p><a href="http://www.sharemuch.com/wp-content/uploads/2010/03/attachment.ashx-1.png"><img style="border: 0px initial initial;" title="attachment.ashx (1)" src="http://www.sharemuch.com/wp-content/uploads/2010/03/attachment.ashx-1.png" alt="attachment.ashx (1)" width="646" height="143" /></a></p>
<p>5. The designer will load the view. Make sure you pick a split view to see visual and code of the form.</p>
<p><a href="http://www.sharemuch.com/wp-content/uploads/2010/03/attachment.ashx-2.png"><img style="border: 0px initial initial;" title="attachment.ashx (2)" src="http://www.sharemuch.com/wp-content/uploads/2010/03/attachment.ashx-2.png" alt="attachment.ashx (2)" width="458" height="54" /></a></p>
<p>6. Click on the form as shown below, that way SharePoint Designer will show the piece of code representing the display form webpart.</p>
<p><a href="http://www.sharemuch.com/wp-content/uploads/2010/03/attachment.ashx-3.png"><img style="border: 0px initial initial;" title="attachment.ashx (3)" src="http://www.sharemuch.com/wp-content/uploads/2010/03/attachment.ashx-3.png" alt="attachment.ashx (3)" width="622" height="151" /></a></p>
<p>7. In the “code” window find <strong>TemplateName </strong>in the highlighted section and find the “ListForm” property in that section and replace it with the rendering template that you have provisioned to the site.</p>
<p>That`s it, when done, just save the form and refresh the actual form page in your browser &#8211; the new form will be picked up right away.</p>
<p><a href="http://www.sharemuch.com/wp-content/uploads/2010/03/attachment.ashx-4.png"><img class="alignnone size-full wp-image-1063" title="attachment.ashx (4)" src="http://www.sharemuch.com/wp-content/uploads/2010/03/attachment.ashx-4.png" alt="attachment.ashx (4)" width="211" height="68" /></a></p>
<p>Good luck!</p>
<img src="http://feeds.feedburner.com/~r/YaroslavPentsarskyysDevelopmentBlog/~4/JGZTIQ9-ZwA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.sharemuch.com/2010/03/06/dynamically-changing-sharepoint-2010-list-form-rendering-templates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.sharemuch.com/2010/03/06/dynamically-changing-sharepoint-2010-list-form-rendering-templates/</feedburner:origLink></item>
		<item>
		<title>Interview: SharePoint 2010 from Visual Design standpoint</title>
		<link>http://feedproxy.google.com/~r/YaroslavPentsarskyysDevelopmentBlog/~3/FnmKsojUq7c/</link>
		<comments>http://www.sharemuch.com/2010/03/04/interview-sharepoint-2010-from-visual-design-standpoint/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 02:36:51 +0000</pubDate>
		<dc:creator>Yaroslav Pentsarskyy</dc:creator>
				<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[sharepoint 2010]]></category>
		<category><![CDATA[sharepoint visual design]]></category>

		<guid isPermaLink="false">http://www.sharemuch.com/?p=1056</guid>
		<description><![CDATA[Today I had short but very interesting interview with Kurtis Beard, from Habanero Consulting. Kurtis is an Interaction Designer and stands behind some of the most stunning site designs. Kurtis has been involved in creating design for few SharePoint 2010 projects and has some valuable insights on what to look out for as well as [...]]]></description>
			<content:encoded><![CDATA[<p>Today I had short but very interesting interview with Kurtis Beard, from <a href="http://www.habaneros.com" target="_self">Habanero Consulting</a>. Kurtis is an Interaction Designer and stands behind some of the most stunning site designs. Kurtis has been involved in creating design for few SharePoint 2010 projects and has some valuable insights on what to look out for as well as some general strategies when designing for SharePoint 2010. The interview is about 13 min and you`ll find it very informative. Enjoy!</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="601" height="481" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=9921406&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="601" height="481" src="http://vimeo.com/moogaloop.swf?clip_id=9921406&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><a href="http://vimeo.com/9921406">Interview with Kurtis: SharePoint 2010 Insights from Visual Designer</a> from <a href="http://vimeo.com/user1796695">Yaroslav Pentsarskyy</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<img src="http://feeds.feedburner.com/~r/YaroslavPentsarskyysDevelopmentBlog/~4/FnmKsojUq7c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.sharemuch.com/2010/03/04/interview-sharepoint-2010-from-visual-design-standpoint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.sharemuch.com/2010/03/04/interview-sharepoint-2010-from-visual-design-standpoint/</feedburner:origLink></item>
		<item>
		<title>Creating custom SharePoint 2010 Service Jobs</title>
		<link>http://feedproxy.google.com/~r/YaroslavPentsarskyysDevelopmentBlog/~3/daceh1laGIU/</link>
		<comments>http://www.sharemuch.com/2010/03/03/creating-custom-sharepoint-2010-service-jobs/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 04:26:45 +0000</pubDate>
		<dc:creator>Yaroslav Pentsarskyy</dc:creator>
				<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[sharepoint 2010]]></category>
		<category><![CDATA[sharepoint service job]]></category>
		<category><![CDATA[sharepoint time job]]></category>
		<category><![CDATA[SPJobDefinition]]></category>

		<guid isPermaLink="false">http://www.sharemuch.com/?p=1054</guid>
		<description><![CDATA[As in MOSS, SharePoint 2010 has a notion of Service Jobs, running on a defined schedule.
Usually you&#8217;d use service job to create scheduled tasks within your portal such as batch business rules validation or alerts processing or really just about anything.
When you create your own Service Job it will be added to this list: http://[central [...]]]></description>
			<content:encoded><![CDATA[<p>As in MOSS, SharePoint 2010 has a notion of Service Jobs, running on a defined schedule.</p>
<p>Usually you&#8217;d use service job to create scheduled tasks within your portal such as batch business rules validation or alerts processing or really just about anything.</p>
<p>When you create your own Service Job it will be added to this list: http://[central admin url]/_admin/ServiceJobDefinitions.aspx</p>
<p>All Service Jobs have to be provisioned under web application. The best approach is to use SharePoint 2010 feature scoped to a Web Application and create an event receiver for the feature that will create an instance of a job based on the definition.</p>
<p>Here is how you&#8217;d go about creating a service job:</p>
<p>1. In your SharePoint solution create a new feature and scope it to the web application.</p>
<p>2. In the Template tree create a new folder where you will define any helpers that will be used to define your Service Job.</p>
<p>3. Create new feature receiver in the feature created in istep 1 and populate the following code in <strong><em>feature activated</em></strong></p>
<blockquote><p>SPWebApplication webApplication = (SPWebApplication)properties.Feature.Parent;<br />
// remove any existing job definitions</p>
<p>foreach (SPJobDefinition jobDefinition in jobs)<br />
            {<br />
                if (jobDefinition.Name.StartsWith(&#8221;<strong>My Service Job Name</strong>&#8220;, StringComparison.InvariantCultureIgnoreCase))<br />
                {<br />
                    jobDefinition.Delete();<br />
                }<br />
            } </p>
<p>            try<br />
            {<br />
                <strong>MyJobDefinition</strong> myJobDefinition = new <strong>MyJobDefinition</strong>(&#8221;"<strong>MyServiceJobId</strong>&#8220;&#8221;, webApplication);</p>
<p>            SPMinuteSchedule minuteSchedule = new SPMinuteSchedule();<br />
            minuteSchedule.BeginSecond = 1;<br />
            minuteSchedule.EndSecond = 59;<br />
            minuteSchedule.Interval = 1000;<br />
            myJobDefinition.Schedule = minuteSchedule;<br />
            myJobDefinition.Update();<br />
            }<br />
            catch (Exception ex)<br />
            {<br />
                Microsoft.Office.Server.Diagnostics.PortalLog.DebugLogString(<br />
                    Microsoft.Office.Server.Diagnostics.PortalLogLevel.Unexpected,<br />
                    &#8220;Exception in Feature Activated occurred: {0} || {1}&#8221;,<br />
                    ex.Message, ex.StackTrace);<br />
                throw;<br />
            }</p></blockquote>
<p>4. Your feature deactivating method will have Service Job cleanup that will look something like this:</p>
<blockquote><p>SPWebApplication webApplication = (SPWebApplication)properties.Feature.Parent;<br />
// remove any existing job definitions</p>
<p>foreach (SPJobDefinition jobDefinition in jobs)<br />
            {<br />
                if (jobDefinition.Name.StartsWith(&#8221;<strong>My Service Job Name</strong>&#8220;, StringComparison.InvariantCultureIgnoreCase))<br />
                {<br />
                    jobDefinition.Delete();<br />
                }<br />
            } </p></blockquote>
<p>5.  Now you noticed we have <strong>MyJobDefinition</strong>  class from which we create a new job. This class will define what your job is actually doing. It has one method called <strong>Execute</strong> that will execute the job, you can either call another class that performs your operations if those are complex or you can define operations right in the <strong>Execute</strong>, here is how something like this will look like:</p>
<blockquote><p>public class MyJobDefinition : SPJobDefinition<br />
    {<br />
        #region Constructors<br />
        /// &lt;summary&gt;<br />
        /// Default constructor is needed.<br />
        /// &lt;/summary&gt;<br />
        public MyJobDefinition()<br />
            : base()<br />
        {<br />
        }<br />
        /// &lt;param name=&#8221;jobName&#8221;&gt;&lt;/param&gt;<br />
        /// &lt;param name=&#8221;webApplication&#8221;&gt;&lt;/param&gt;<br />
        public MyJobDefinition(string jobName, SPWebApplication webApplication)<br />
            : base(jobName, webApplication, null, SPJobLockType.Job)<br />
        {<br />
            this.Title = &#8220;<strong>My Service Job Name</strong>&#8220;; //this will appear in Service Jobs list inside central admin<br />
        }<br />
        #endregion</p>
<p>        #region Methods</p>
<p>        /// &lt;param name=&#8221;targetInstanceId&#8221;&gt;ID of the content db that is processed by this job.&lt;/param&gt;<br />
        public override void Execute(Guid targetInstanceId)<br />
        {<br />
            try<br />
            {</p>
<p>                SPWebApplication webApplication = this.Parent as SPWebApplication;<br />
                // TODO: your scheduled code is here<br />
            }<br />
            catch (Exception ex)<br />
            {<br />
                Microsoft.Office.Server.Diagnostics.PortalLog.DebugLogString(<br />
                    Microsoft.Office.Server.Diagnostics.PortalLogLevel.Unexpected,<br />
                    &#8220;Exception in MyJobDefinition occurred: {0} || {1}&#8221;,<br />
                    ex.Message, ex.StackTrace);<br />
                throw;<br />
            }<br />
        }<br />
        #endregion<br />
    }</p></blockquote>
<p>That&#8217;s it. Now this is basic implementation and you can improve various parts of your job such as pulling the schedule from configuration file rather than hardcoding it in the code etc. Good luck with your scheduled tasks!</p>
<img src="http://feeds.feedburner.com/~r/YaroslavPentsarskyysDevelopmentBlog/~4/daceh1laGIU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.sharemuch.com/2010/03/03/creating-custom-sharepoint-2010-service-jobs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.sharemuch.com/2010/03/03/creating-custom-sharepoint-2010-service-jobs/</feedburner:origLink></item>
	</channel>
</rss>
