<?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"
	>

<channel>
	<title>Krompaco</title>
	<link>http://krompaco.nu</link>
	<description>A blog about computer stuff</description>
	<pubDate>Tue, 20 Jul 2010 13:49:38 +0000</pubDate>
	<language>en</language>
	<atom:link href="http://krompaco.nu/feed/" rel="self" type="application/rss+xml" />
			<item>
		<title>Retrieving an EPiServer 6 global setting value</title>
		<link>http://krompaco.nu/retrieving-an-episerver-6-global-setting-value/</link>
		<comments>http://krompaco.nu/retrieving-an-episerver-6-global-setting-value/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 08:03:16 +0000</pubDate>
		<dc:creator>JK</dc:creator>
		
		<category><![CDATA[EPiServer]]></category>

		<category><![CDATA[Development]]></category>
		<guid isPermaLink="false">http://krompaco.nu/retrieving-an-episerver-6-global-setting-value/</guid>
		<description><![CDATA[

<p class="start">
You added some property settings to your custom property and created a couple of global settings for the editor to choose from. Then you find out you want to get hold of the setting values in code. Here's how you fetch them.
</p>

<p>In my case it looks like this in the property global settings view in admin mode:</p>

<img src="http://krompaco.nu/wp-content/u/global-setting-example.png" alt="Screenshot of the settings" />

<p>
The one I want to get the values from has the display name <em>Avdelningar</em>. Here's what I ended up with:
</p>

<pre class="brush: csharp;">private PropertyFilteredRolesSettings GetPropertyFilteredRolesSettingsByName(string displayName)
{
    var p = new PropertySettingsRepository();
    var globals = p.GetGlobals(typeof(PropertyFilteredRolesSettings));

    foreach (var setting in globals)
    {
        if (setting.DisplayName.Equals(displayName, StringComparison.OrdinalIgnoreCase))
        {
            return ((PropertyFilteredRolesSettings) setting.PropertySettings);
        }
    }

    throw new Exception("Filtered Roles Settings Display Name Not Found");
}

// Usage example
var departmentSettings = GetPropertyFilteredRolesSettingsByName("Avdelningar");

if (Regex.Match("JustSomeRolename", departmentSettings.FilterRolesRegexPattern, RegexOptions.IgnoreCase).Success)
{
...
}</pre>]]></description>
		<wfw:commentRss>http://krompaco.nu/retrieving-an-episerver-6-global-setting-value/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Replacing the TinyMCE table plugin in EPiServer 6</title>
		<link>http://krompaco.nu/replacing-the-tinymce-table-plugin-in-episerver-6/</link>
		<comments>http://krompaco.nu/replacing-the-tinymce-table-plugin-in-episerver-6/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 22:10:23 +0000</pubDate>
		<dc:creator>JK</dc:creator>
		
		<category><![CDATA[TinyMCE]]></category>

		<category><![CDATA[EPiServer]]></category>

		<category><![CDATA[Development]]></category>
		<guid isPermaLink="false">http://krompaco.nu/replacing-the-tinymce-table-plugin-in-episerver-6/</guid>
		<description><![CDATA[

<p class="start">
I got the task to replace the TinyMCE table plugin with a stripped down version of the original optimized by a colleague.
</p>

<p>What I got to work with was a standard TinyMCE plugin-folder that works with any implementation. For EPiServer this folder needs to reside in <em>/Util/Editor/tinymce/plugins/</em>. I just put that folder structure in my project and kept the VPP for <em>Util</em>, the local plugin folders will mix with the standard folders in the VPP-linked <em>Program Files</em>-directory.</p>

<p>EPiServer has a hookup that overrides the regular TinyMCE language files and use their regular XML-setup instead. In my case I just copied the table stuff from the EPiServer lang-file and just changed the XML-nesting a little bit. Also remember to add some own text to the plugin name so that you can tell the difference in the XHTML string property type designer. For icons I use the original CSS class names.</p>

<p>Getting completely rid of the original table plugin was a bit tricky. You need to add your own version of all the table buttons since they group together and if just one original button is selected in the toolbar designer you get the complete original table plugin initialized. Here are the plugin classes you need to put in your project:</p>

<pre class="brush: csharp;">namespace Krompaco.Plugins.TinyMCE
{
    [TinyMCEPluginButton(LanguagePath = "/tinymce/krompacotable/cell_props", GroupName = "krompacotable", ButtonSortIndex = 30, ButtonName = "cell_props", PlugInName = "krompacotable", IconClass = "mce_cell_props")]
    public class Cell_Props
    {
    }

    [TinyMCEPluginButton(LanguagePath = "/tinymce/krompacotable/col_after", GroupName = "krompacotable", ButtonSortIndex = 60, ButtonName = "col_after", PlugInName = "krompacotable", IconClass = "mce_col_after")]
    public class Col_After
    {
    }

    [TinyMCEPluginButton(LanguagePath="/tinymce/krompacotable/col_before", GroupName="krompacotable", ButtonSortIndex=70, ButtonName="col_before", PlugInName="krompacotable", IconClass="mce_col_before")]
    public class Col_Before
    {
    }

    [TinyMCEPluginButton(LanguagePath="/tinymce/krompacotable/delete_col", GroupName="krompacotable", ButtonSortIndex=40, ButtonName="delete_col", PlugInName="krompacotable", IconClass="mce_delete_col")]
    public class Delete_Col
    {
    }

    [TinyMCEPluginButton(LanguagePath="/tinymce/krompacotable/delete_row", GroupName="krompacotable", ButtonSortIndex=50, ButtonName="delete_row", PlugInName="krompacotable", IconClass="mce_delete_row")]
    public class Delete_Row
    {
    }

    [TinyMCEPluginButton(LanguagePath="/tinymce/krompacotable/delete_table", GroupName="krompacotable", ButtonSortIndex=12, ButtonName="delete_table", PlugInName="krompacotable", IconClass="mce_delete_table")]
    public class Delete_Table
    {
    }

    [TinyMCEPluginButton(LanguagePath="/tinymce/krompacotable/merge_cells", GroupName="krompacotable", ButtonSortIndex=110, ButtonName="merge_cells", PlugInName="krompacotable", IconClass="mce_merge_cells")]
    public class Merge_Cells
    {
    }

    [TinyMCEPluginButton(LanguagePath="/tinymce/krompacotable/row_after", GroupName="krompacotable", ButtonSortIndex=80, ButtonName="row_after", PlugInName="krompacotable", IconClass="mce_row_after")]
    public class Row_After
    {
    }

    [TinyMCEPluginButton(LanguagePath="/tinymce/krompacotable/row_before", GroupName="krompacotable", ButtonSortIndex=90, ButtonName="row_before", PlugInName="krompacotable", IconClass="mce_row_before")]
    public class Row_Before
    {
    }

    [TinyMCEPluginButton(LanguagePath="/tinymce/krompacotable/row_props", GroupName="krompacotable", ButtonSortIndex=20, ButtonName="row_props", PlugInName="krompacotable", IconClass="mce_row_props")]
    public class Row_Props
    {
    }

    [TinyMCEPluginButton(LanguagePath="/tinymce/krompacotable/split_cells", GroupName="krompacotable", ButtonSortIndex=100, ButtonName="split_cells", PlugInName="krompacotable", IconClass="mce_split_cells")]
    public class Split_Cells
    {
    }

    [TinyMCEPluginButton(LanguagePath="/tinymce/krompacotable/table", GroupName="krompacotable", ButtonSortIndex=10, ButtonName="table", PlugInName="krompacotable", IconClass="mce_table")]
    public class Table
    {
    }

    [TinyMCEPluginButton(LanguagePath="/tinymce/krompacotable/tablecontrols", GroupName="krompacotable", ButtonSortIndex=0, ButtonName="tablecontrols", PlugInName="krompacotable", IconUrl="images/PluginIcons/AllTableTools.gif" )]
    public class TableControls
    {
    }
}</pre>

<p>When you have this in place you get a new button group in the XHTML property type designer. Just remove all the original table buttons and drag your new buttons to the toolbar. Now you're running your own - and hopefully much better - table plugin!</p>]]></description>
		<wfw:commentRss>http://krompaco.nu/replacing-the-tinymce-table-plugin-in-episerver-6/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using Dynamic Data Store related to an EPiServer 6 page</title>
		<link>http://krompaco.nu/using-dynamic-data-store-related-to-an-episerver-6-page/</link>
		<comments>http://krompaco.nu/using-dynamic-data-store-related-to-an-episerver-6-page/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 06:00:59 +0000</pubDate>
		<dc:creator>JK</dc:creator>
		
		<category><![CDATA[EPiServer]]></category>

		<category><![CDATA[Development]]></category>
		<guid isPermaLink="false">http://krompaco.nu/using-dynamic-data-store-related-to-an-episerver-6-page/</guid>
		<description><![CDATA[

<p class="start">
We decided to build a poll function using a Question page type and an Option page type to put below. For each option we thought the new Dynamic Data Store related to an EPiServer page - the Page Object Manager - would be a neat thing to use as storage for the votes.
</p>

<p>Here's the interesting code out of the rough first draft.</p>

<p>To be cool and to save some lines we added two generic extension methods for PageData:</p>

<pre class="brush: csharp;">public static void SavePageObject(this PageData pd, object obj, string key)
{
    PageObjectManager pageObjectManager = new PageObjectManager(pd);
    pageObjectManager.Save(key, obj);
}

public static T GetPageObject&lt;T&gt;(this PageData pd, string key)
{
    PageObjectManager pageObjectManager = new PageObjectManager(pd);

    try
    {
        return pageObjectManager.Load&lt;T&gt;(key);
    }
    catch
    {
        return default(T);
    }
}</pre>

<p>Then we created two simple classes implementing IDynamicData so that they would "borrow" the big table's primary key setup:</p>

<pre class="brush: csharp;">public class Vote : IDynamicData
{
    public DateTime CreatedOn { get; set; }
    public string Fingerprint { get; set; }

    #region IDynamicData Members
    public Identity Id
    {
        get;
        set;
    }
    #endregion
}

public class VoteOption : IDynamicData
{
    public IList&lt;Vote&gt; Votes { get; set; }

    public VoteOption()
    {
        this.Votes = new List&lt;Vote&gt;();
    }

    #region IDynamicData Members
    public Identity Id
    {
        get;
        set;
    }
    #endregion
}</pre>

<p>Looking in the database we found that most EPiServer DDS implementations using classes had IList for collections so we went with that.</p>

<p>We found that knowing the key you use for storing objects makes it all a lot easier to work with. In this case we create the key using a prefix and the PageGUID of the Option page so retrieving the data is done like this:</p>

<pre class="brush: csharp;">var allVotes = new List&lt;Vote&gt;();

foreach (PageData option in allChildren)
{
    var voteOptionObject = option.GetPageObject&lt;VoteOption&gt;(string.Format("vote-{0}", option.PageGuid));

    if (voteOptionObject != null)
    {
        allVotes.AddRange(voteOptionObject.Votes);
    }
}</pre>

<p>Saving a vote is done like this:</p>

<pre class="brush: csharp;">string key = string.Format("vote-{0}", voteOptionPage.PageGuid);
VoteOption voteOptionObject = voteOptionPage.GetPageObject&lt;VoteOption&gt;(key);

if (voteOptionObject == null)
{
    voteOptionObject = new VoteOption();
}

var vote = new Vote();
// Set props
voteOptionObject.Votes.Add(vote);
voteOptionPage.SavePageObject(voteOptionObject, key);</pre>

<p>Of course removing a Vote is done in a similiar way by just removing Vote objects from the Votes list before SavePageObject().</p>

<p>The nice thing about this class-with-a-collection-approach is that the first save with one item in the List results in three rows (one for the PageObjectManager referencing the page ID and your key, one VoteOption and one Vote linked to the VoteOption) but then every addition to the list is only one new Vote row.</p>

<p>If you were to save multiple objects right on top of the PageObjectManager using different keys you would have two rows for every vote and you would have to iterate all and sniff the type of the objects you got from the PageObjectManager.</p>]]></description>
		<wfw:commentRss>http://krompaco.nu/using-dynamic-data-store-related-to-an-episerver-6-page/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Alter default InitOptions for TinyMCE in EPiServer 6</title>
		<link>http://krompaco.nu/alter-default-initoptions-for-tinymce-in-episerver-6/</link>
		<comments>http://krompaco.nu/alter-default-initoptions-for-tinymce-in-episerver-6/#comments</comments>
		<pubDate>Thu, 20 May 2010 14:15:33 +0000</pubDate>
		<dc:creator>JK</dc:creator>
		
		<category><![CDATA[TinyMCE]]></category>

		<category><![CDATA[EPiServer]]></category>

		<category><![CDATA[Development]]></category>
		<guid isPermaLink="false">http://krompaco.nu/alter-default-initoptions-for-tinymce-in-episerver-6/</guid>
		<description><![CDATA[

<p class="start">
The default config options set by CreateDefaultInitOptions() aren't really what you need to help editors create correctly marked up content. Luckily the guys at EPiServer have a way to tweak 'em.
</p>

<p>You just need to add a class and decorate it with some plugin magic. Here's a proof of concept of how to go about it:</p>

<pre class="brush: csharp;">using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using EPiServer;
using EPiServer.Editor.TinyMCE;

namespace Krompaco.Plugins
{
  [TinyMCEPluginNonVisualAttribute(
      AlwaysEnabled = true,
      PlugInName = "OptimizedEditor",
      DisplayName = "Custom editor init options",
      Description = "Loads custom editor init options.",
      EditorInitConfigurationOptions = @"{
        paste_auto_cleanup_on_paste : true,
        valid_elements : ""a[href],strong/b,em/i,br,ul,ol,li,-h2,-h3,-h4,-h5,-h6,-p"",
        theme_advanced_blockformats : ""h2,h3,h4,h5,h6,p"",
        theme_advanced_resizing : false,
        body_class : ""module-text""
      }"
  )]
  public class OptimizedEditor
  {
  }
}</pre>]]></description>
		<wfw:commentRss>http://krompaco.nu/alter-default-initoptions-for-tinymce-in-episerver-6/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Brilliant graphic design in HP printer setup</title>
		<link>http://krompaco.nu/brilliant-graphic-design-in-hp-printer-setup/</link>
		<comments>http://krompaco.nu/brilliant-graphic-design-in-hp-printer-setup/#comments</comments>
		<pubDate>Thu, 08 Apr 2010 08:25:24 +0000</pubDate>
		<dc:creator>JK</dc:creator>
		
		<category><![CDATA[Amusement]]></category>

		<category><![CDATA[Windows]]></category>
		<guid isPermaLink="false">http://krompaco.nu/brilliant-graphic-design-in-hp-printer-setup/</guid>
		<description><![CDATA[

<p class="start">
Installed three HP printer drivers and got three different directories in Progam Files (HP, Hewlett_Packard and Hewlett-Packard). This was not the only ugly thing about it though.
</p>

<p class="cf"><a href="http://krompaco.nu/wp-content/u/hp-installer.png" title="View in original size"><img src="http://krompaco.nu/wp-content/u/hp-installer.thumbnail.png" alt="" class="iar" />Just check out this breathtaking image composition shown at driver step completed.</a></p>]]></description>
		<wfw:commentRss>http://krompaco.nu/brilliant-graphic-design-in-hp-printer-setup/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Install and run Google Chrome on Ubuntu 9.10 Karmic Koala</title>
		<link>http://krompaco.nu/install-and-run-google-chrome-on-ubuntu-910-karmic-koala/</link>
		<comments>http://krompaco.nu/install-and-run-google-chrome-on-ubuntu-910-karmic-koala/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 14:47:26 +0000</pubDate>
		<dc:creator>JK</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Ubuntu]]></category>
		<guid isPermaLink="false">http://krompaco.nu/install-and-run-google-chrome-on-ubuntu-910-karmic-koala/</guid>
		<description><![CDATA[

<p class="start">
Previously this has appeared to  be a more advanced operation but now it's really easy.
</p>

<p>
Just go to the <a href="http://www.google.com/chrome/">Google Chrome site</a> using Firefox on your Ubuntu machine and you will get a Get-button for the Chrome Linux Beta to the left. Choose your platform, download and save the package somewhere and then just install it.
</p>]]></description>
		<wfw:commentRss>http://krompaco.nu/install-and-run-google-chrome-on-ubuntu-910-karmic-koala/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Trouble installing EPiServer Mail</title>
		<link>http://krompaco.nu/trouble-installing-episerver-mail/</link>
		<comments>http://krompaco.nu/trouble-installing-episerver-mail/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 13:09:58 +0000</pubDate>
		<dc:creator>JK</dc:creator>
		
		<category><![CDATA[EPiServer]]></category>

		<category><![CDATA[Troubleshooting]]></category>
		<guid isPermaLink="false">http://krompaco.nu/trouble-installing-episerver-mail/</guid>
		<description><![CDATA[

<p class="start">
When installing EPiServer Mail 4.4 SP1 my Deployment Center gave the error message "Invalid character in the given encoding", stopped and rolled back.
</p>

<p>A colleague had noticed problems with ÅÄÖ-characters being messed up in his config after he had installed a previous EPiServer Mail version. After editing my web.config and also making sure to not type any ÅÄÖ's or other weird characters in the setup inputs installation completed successfully.</p>

<p>Bugs like this one would be less painful if the Deployment Center could remember the input values of a rolled back attempt.</p>

<p>To avoid another rollback if you're creating a new database, also make sure the user you type in the installer SQL user textboxes is powerful enough.</p>]]></description>
		<wfw:commentRss>http://krompaco.nu/trouble-installing-episerver-mail/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Vary EPiServer cache by all querystring parameters</title>
		<link>http://krompaco.nu/vary-episerver-cache-by-all-querystring-parameters/</link>
		<comments>http://krompaco.nu/vary-episerver-cache-by-all-querystring-parameters/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 10:34:27 +0000</pubDate>
		<dc:creator>JK</dc:creator>
		
		<category><![CDATA[EPiServer]]></category>

		<category><![CDATA[Dotnet]]></category>

		<category><![CDATA[Development]]></category>
		<guid isPermaLink="false">http://krompaco.nu/vary-episerver-cache-by-all-querystring-parameters/</guid>
		<description><![CDATA[

<p class="start">
I had a EPiServer CMS 5 R2 project where there was a lot of templates lifted in from an older solution. It was very querystring intensive so I needed to get away from specifying each  querystring-parameter in the httpCacheVaryByParams setting and still enjoy public caching.
</p>

<p>Here's how to do it:</p>

<p>While testing I noticed that httpCacheVaryByCustom need to have something different from the default value and httpCacheVaryByParams need to have a dummy value as well. So specifying the following in the siteSettings section of Web.config does the trick:</p>

<pre>httpCacheExpiration="0:1:0" 
httpCacheability="Public" 
httpCacheVaryByCustom="my-custom-string" 
httpCacheVaryByParams="needs-a-value-but-not-used"</pre>

<p>Then in Global.asax.cs, override GetVaryByCustomString and return RawUrl. This will make the caching routine treat for example <em>/my-list/?page=1</em> and <em>/my-list/?page=2</em> as two different documents.</p>

<pre class="brush: csharp;">public override string GetVaryByCustomString(HttpContext context, string custom)
{
    return context.Request.RawUrl;
}</pre>

<p>Be sure to be logged out and don't run site on a http://localhost URL when testing your implementation.</p>]]></description>
		<wfw:commentRss>http://krompaco.nu/vary-episerver-cache-by-all-querystring-parameters/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using XmlTextWriter to output RSS with MVC</title>
		<link>http://krompaco.nu/using-xmltextwriter-to-output-rss-with-mvc/</link>
		<comments>http://krompaco.nu/using-xmltextwriter-to-output-rss-with-mvc/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 10:37:13 +0000</pubDate>
		<dc:creator>JK</dc:creator>
		
		<category><![CDATA[ASP.NET MVC]]></category>

		<category><![CDATA[Dotnet]]></category>

		<category><![CDATA[Development]]></category>
		<guid isPermaLink="false">http://krompaco.nu/using-xmltextwriter-to-output-rss-with-mvc/</guid>
		<description><![CDATA[

<p class="start">
I like to use the XmlTextWriter class to generate RSS with complete control. Here's what I ended up with to get it working from a Controller in a ASP.NET MVC 1.0 project.
</p>

<p>Outside of MVC I've been used to putting the XmlTextWriter in the response like this:</p>

<pre class="brush: csharp;">Response.Clear();
Response.ContentType = "text/xml";
Response.Charset = "utf-8";
XmlTextWriter xtw = new XmlTextWriter(Response.OutputStream, Encoding.UTF8);
...
xtw.Flush();
xtw.Close();
Response.End();</pre>

<p>With MVC I thought it would be nicer to use use an ActionResult:</p>

<pre class="brush: csharp;">public ActionResult Index()
{
    StringWriterWithEncoding writer = new StringWriterWithEncoding(Encoding.UTF8);
    XmlTextWriter xtw = new XmlTextWriter(writer);
    xtw.Formatting = Formatting.Indented;
    xtw.WriteStartDocument();
    xtw.WriteStartElement("rss");
    xtw.WriteAttributeString("version", "2.0");
    xtw.WriteAttributeString("xmlns:atom", "http://www.w3.org/2005/Atom");
    xtw.WriteStartElement("channel");
    xtw.WriteElementString("title", "X");
    xtw.WriteElementString("link", "http://x.com/");
    xtw.WriteStartElement("atom:link");
    xtw.WriteAttributeString("href", "http://x.com/feed/");
    xtw.WriteAttributeString("rel", "self");
    xtw.WriteAttributeString("type", "application/rss+xml");
    xtw.WriteEndElement();
    xtw.WriteElementString("description", "The latest x.");
    xtw.WriteElementString("language", "en-US");
    xtw.WriteElementString("lastBuildDate", DateTime.Now.ToUniversalTime().ToString("r"));
    xtw.WriteElementString("pubDate", x.ToUniversalTime().ToString("r"));
    xtw.WriteElementString("copyright", "Johan Kronberg");
    xtw.WriteElementString("ttl", "5");
    
    // Loop something
        xtw.WriteStartElement("item");
        xtw.WriteElementString("title", "item-x");
        xtw.WriteStartElement("description");
        xtw.WriteCData("&lt;p&gt;x&lt;/p&gt;");
        xtw.WriteEndElement();
        string linkToItem = "http://x.com/x/";
        xtw.WriteElementString("link", linkToItem);
        xtw.WriteElementString("guid", linkToItem);
        xtw.WriteElementString("pubDate", loopItem.CreatedOn.ToUniversalTime().ToString("r"));
        xtw.WriteEndElement();

    xtw.WriteEndElement();
    xtw.WriteEndElement();
    xtw.WriteEndDocument();
    xtw.Flush();
    xtw.Close();

    return Content(writer.ToString(), "text/xml", Encoding.UTF8);
}</pre>

<p>To avoid getting the UTF-16 encoding in the document specification I followed <a href="http://weblogs.asp.net/rmclaws/archive/2003/07/31/22080.aspx">this post and comments at Robert McLaws'</a> and ended up with the following copied class:</p>

<pre class="brush: csharp;">namespace Krompaco
{
    using System;
    using System.IO;
    using System.Text;

    public class StringWriterWithEncoding : StringWriter
    {
        private Encoding _enc;

        public StringWriterWithEncoding(Encoding NewEncoding) : base()
        {
            _enc = NewEncoding;
        }

        public override System.Text.Encoding Encoding
        {
            get
            {
                return _enc;
            }
        }
    }
}</pre>

<p>Not perfect but good enough I hope. Please share your ideas!</p>]]></description>
		<wfw:commentRss>http://krompaco.nu/using-xmltextwriter-to-output-rss-with-mvc/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to create a role task by code in EPiServer</title>
		<link>http://krompaco.nu/episerver-task-by-code/</link>
		<comments>http://krompaco.nu/episerver-task-by-code/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 14:41:28 +0000</pubDate>
		<dc:creator>JK</dc:creator>
		
		<category><![CDATA[EPiServer]]></category>

		<category><![CDATA[Dotnet]]></category>

		<category><![CDATA[Development]]></category>
		<guid isPermaLink="false">http://krompaco.nu/create-a-episerver-task-by-code/</guid>
		<description><![CDATA[

<p class="start">
After failing duplicating the <em>ParallelApproval</em> Workflow I looked into creating a task by code in the project instead. Didn't find much documentation online so here's my initial Proof of Concept to fill the gap.
</p>

<p>This will create a task from the current user and assign it to all users with the <em>WebAdmins</em> role. An e-mail will go out to all users in the role and when one of them change the status an e-mail will go back to the creator.</p>

<pre class="brush: csharp;">using EPiServer.Personalization;
..
Task currentTask = new Task();
currentTask.Subject = "Test";
currentTask.Description = "Some more text";
currentTask.AssignedTo = "WebAdmins";
currentTask.AssignedIsRole = true;
currentTask.DueDate = DateTime.Now.AddDays(1);
// Would be better to somehow fetch PlugInID
// by it's name "EPiServer.UI.Util.PlugIns.ViewTask"
// instead of this:
currentTask.PlugInID = 144;
currentTask.Save();</pre>

<p>Tested using EPiServer CMS 5 R2 SP2.</p>]]></description>
		<wfw:commentRss>http://krompaco.nu/episerver-task-by-code/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
