<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-3789506896506356310</atom:id><lastBuildDate>Sat, 21 Jun 2025 04:49:22 +0000</lastBuildDate><category>K2</category><category>TFS</category><category>Setup</category><category>Sharepoint Workflow Integration</category><category>TFS2008</category><category>Virtual Machine Additions</category><category>VirtualPC</category><category>Windows 2008</category><category>Blackpearl</category><category>Could not deserialize object</category><category>Error</category><category>Error 1714</category><category>Kerberos</category><category>MOSS 2007</category><category>MSTest</category><category>Office Automation</category><category>Permissions</category><category>SharePoint</category><category>Sql Server 2008</category><category>TF31002</category><category>Task ID</category><category>VS2008</category><category>VSTS2008</category><category>WF</category><category>Watermarking</category><category>Windows Service</category><category>declarative workflow</category><category>iTextSharp</category><category>pdf</category><category>time bomb</category><category>time sync</category><category>vm</category><title>Hot Malva tech blog</title><description>Technical experiments and advices on Microsoft technology, Web Application and SharePoint platform in particular.</description><link>http://emalvass.blogspot.com/</link><managingEditor>noreply@blogger.com (Anonymous)</managingEditor><generator>Blogger</generator><openSearch:totalResults>14</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3789506896506356310.post-5811729480316019067</guid><pubDate>Thu, 08 Jul 2010 08:38:00 +0000</pubDate><atom:updated>2010-07-19T20:53:04.328+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">MOSS 2007</category><category domain="http://www.blogger.com/atom/ns#">SharePoint</category><title>MOSS 2007: Get Shared Services User Profile without “Manage User Profile” permission</title><description>&lt;p&gt;&lt;/p&gt; &lt;p align=&quot;justify&quot;&gt;For a custom functionality I’m developing for my customer I needed to retrieve the user profile logged on the application. To accomplish this task SharePoint object model provides the class &lt;em&gt;UserProfileManager &lt;/em&gt;which allows you to query user profile properties.&lt;/p&gt; &lt;p align=&quot;justify&quot;&gt;There is only a tip when you write your code to access the user profile properties, in fact you can use two different piece of code to accomplish that:&lt;/p&gt; &lt;ol&gt; &lt;li&gt; &lt;div align=&quot;justify&quot;&gt;if you instance a new UserProfileManager (see the commented code below on 7th row) you could have problem and receive the following error:&lt;br&gt;&lt;br&gt;&lt;em&gt;&lt;strong&gt;“You must have manage user profiles administrator rights to use administrator mode.”&lt;br&gt;&lt;br&gt;&lt;/strong&gt;&lt;/em&gt;This is due to the fact that to instance a UserProfileManager you need administration right on SharePoint Shared Service.&lt;/div&gt; &lt;li&gt; &lt;div align=&quot;justify&quot;&gt;Instead of the creation of a new instance of UserProfileManager class, you can get an already present instance using ProfileLoader class (see row 8, 9 and 10 below). In this way you can access to a read-only version of UserProfileManager class which permits you to query every properties of the user profile you have requested (see all the example below).&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt; &lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   1:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; UserProfile GetUserProfile(&lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; loginName)&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   3:  &lt;/span&gt;    UserProfile userProfile;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   4:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; (var Site = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; SPSite(SiteId))&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   5:  &lt;/span&gt;    {&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   6:  &lt;/span&gt;        var ctx = ServerContext.GetContext(Site);&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   7:  &lt;/span&gt;        &lt;span class=&quot;rem&quot;&gt;//var upm = new UserProfileManager(ctx, true);&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   8:  &lt;/span&gt;        var profile = ProfileLoader.GetProfileLoader(ctx);&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   9:  &lt;/span&gt;        var upm = profile.GetUserProfileManager();&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  10:  &lt;/span&gt;        var spUserProfile = upm.GetUserProfile(loginName);&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  11:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  12:  &lt;/span&gt;        userProfile = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; UserProfile(spUserProfile.ID)&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  13:  &lt;/span&gt;          {&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  14:  &lt;/span&gt;              Login = loginName,&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  15:  &lt;/span&gt;              PreferredName = spUserProfile[&lt;span class=&quot;str&quot;&gt;&quot;PreferredName&quot;&lt;/span&gt;] != &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt; ? &lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  16:  &lt;/span&gt;                spUserProfile[&lt;span class=&quot;str&quot;&gt;&quot;PreferredName&quot;&lt;/span&gt;].Value &lt;span class=&quot;kwrd&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; : &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;.Empty,&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  17:  &lt;/span&gt;                &lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  18:  &lt;/span&gt;              Manager = spUserProfile[&lt;span class=&quot;str&quot;&gt;&quot;Manager&quot;&lt;/span&gt;] != &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt; ? &lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  19:  &lt;/span&gt;                spUserProfile[&lt;span class=&quot;str&quot;&gt;&quot;Manager&quot;&lt;/span&gt;].Value &lt;span class=&quot;kwrd&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; : &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;.Empty,&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  20:  &lt;/span&gt;                &lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  21:  &lt;/span&gt;              Name = spUserProfile[&lt;span class=&quot;str&quot;&gt;&quot;FirstName&quot;&lt;/span&gt;] != &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt; ? &lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  22:  &lt;/span&gt;                spUserProfile[&lt;span class=&quot;str&quot;&gt;&quot;FirstName&quot;&lt;/span&gt;].Value &lt;span class=&quot;kwrd&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; : &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;.Empty,&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  23:  &lt;/span&gt;                &lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  24:  &lt;/span&gt;              Surname = spUserProfile[&lt;span class=&quot;str&quot;&gt;&quot;LastName&quot;&lt;/span&gt;] != &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt; ? &lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  25:  &lt;/span&gt;                spUserProfile[&lt;span class=&quot;str&quot;&gt;&quot;LastName&quot;&lt;/span&gt;].Value &lt;span class=&quot;kwrd&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; : &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;.Empty&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  26:  &lt;/span&gt;          };&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  27:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  28:  &lt;/span&gt;    }&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  29:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  30:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; userProfile;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  31:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, &quot;Courier New&quot;, courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align=&quot;justify&quot;&gt;Particular thanks to my friend &lt;a href=&quot;http://www.michelebartolucci.it/&quot; target=&quot;_blank&quot;&gt;Michele&lt;/a&gt; who supported and suggested me on how to resolve this problem.&lt;/p&gt;  </description><link>http://emalvass.blogspot.com/2010/07/moss-2007-get-shared-services-user.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3789506896506356310.post-2395030396362890908</guid><pubDate>Thu, 08 Jul 2010 07:16:00 +0000</pubDate><atom:updated>2010-07-19T20:29:21.469+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">MSTest</category><category domain="http://www.blogger.com/atom/ns#">TFS</category><category domain="http://www.blogger.com/atom/ns#">VS2008</category><title>TFS 2010: TF270015: &amp;#39;MSTest.exe&amp;#39; returned an unexpected exit code. Expected &amp;#39;0&amp;#39;; actual &amp;#39;1&amp;#39;.</title><description>&lt;p align=&quot;justify&quot;&gt;If you try to build an “old” Visual Studio 2008 solution with the new Team Foundation Server 2010 and after the build you try to execute automatic unit test project inserting the following directive inside your build project:&lt;/p&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;MetaDataFile&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;Include&lt;/span&gt;=&quot;$(&lt;span class=&quot;attr&quot;&gt;BuildProjectFolderPath&lt;/span&gt;)/&amp;amp;&lt;span class=&quot;attr&quot;&gt;lt&lt;/span&gt;;&lt;span class=&quot;attr&quot;&gt;your&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;vsmdi&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;.vsmdi&quot;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;TestList&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;yourtestproject.UnitTest&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;TestList&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;MetaDataFile&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, &quot;Courier New&quot;, courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;your build probably will fail with the following nice error:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;TF270015: &#39;MSTest.exe&#39; returned an unexpected exit code. Expected &#39;0&#39;; actual &#39;1&#39;.&lt;/em&gt;&lt;/p&gt;
&lt;p align=&quot;justify&quot;&gt;After a Google search (see references below) I’ve found that the problem could be due to the fact that TFS 2010 can only build test project written in .NET 4.0. &lt;/p&gt;
&lt;p align=&quot;justify&quot;&gt;For now there’s no fix available to resolve this problem (as you can see &lt;a href=&quot;https://connect.microsoft.com/VisualStudio/feedback/details/563602/tf270015-mstest-exe-returned-an-unexpected-exit-code-expected-0-actual-1&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;) and there’s no timing about a Microsoft hotfix (QFE) release.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;u&gt;References:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://social.msdn.microsoft.com/Forums/en-US/tfsbuild/thread/1c67aa6b-b628-42d6-bd7a-9e42f2e4afad&quot;&gt;http://social.msdn.microsoft.com/Forums/en-US/tfsbuild/thread/1c67aa6b-b628-42d6-bd7a-9e42f2e4afad&lt;/a&gt; 
&lt;li&gt;&lt;a href=&quot;http://stackoverflow.com/questions/2476200/tfs-2010-rc-does-not-run-visual-studio-2008-mstest-unit-tests&quot;&gt;http://stackoverflow.com/questions/2476200/tfs-2010-rc-does-not-run-visual-studio-2008-mstest-unit-tests&lt;/a&gt; 
&lt;li&gt;&lt;a href=&quot;http://matthewrowan.spaces.live.com/Blog/cns!CCB05A30BCA0FF01!4952.entry&quot;&gt;http://matthewrowan.spaces.live.com/Blog/cns!CCB05A30BCA0FF01!4952.entry&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;  </description><link>http://emalvass.blogspot.com/2010/07/tfs-2010-tf270015-returned-unexpected.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3789506896506356310.post-8355135737751096468</guid><pubDate>Wed, 07 Jul 2010 17:31:00 +0000</pubDate><atom:updated>2010-07-07T19:34:35.013+02:00</atom:updated><title>MOSS 2007: “The evaluation version of Microsoft Office SharePoint Server 2007 for this server has expired”</title><description>&lt;p&gt;&lt;a name=&quot;mainContent&quot;&gt;&lt;/a&gt; &lt;p align=&quot;justify&quot;&gt;If you receive this error when you try to access to SharePoint Shared Service on your machine, don&#39;t panic. It&#39;s a problem due to SP2 installation. You can find more detail and hotfix about this problem &lt;a href=&quot;http://support.microsoft.com/kb/971620&quot;&gt;here&lt;/a&gt;.  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOfm5OTiZkGXosCNmM-DLp_xnPnK5FCG867JKuZ5B2vBiyDlzTEQdM6pI5ZE3Jz_CFzOkDg1pcIo110jy9q_nEXCBuWTmH3G3RY-JOy5m_J2XGKq4FAA31Ku3rjqKEbUt_SwekihYM3Y0/s1600-h/SP_false_expired_Message4.jpg&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;SP_false_expired_Message&quot; border=&quot;0&quot; alt=&quot;SP_false_expired_Message&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsW7GscIZvvzg6BYKACdjWb3w0THzDsEJn-F3boIObMCV2U5oZYq3P01lYbQQBCuC3BCA3LTN90wkYUW_DtT36rGpdwR2-GuhCKvtZx22KBXQ846pe2K-OVCJcLzX97ybyd15V5vDLazU/?imgmax=800&quot; width=&quot;607&quot; height=&quot;206&quot;&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Reference: &lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a title=&quot;http://support.microsoft.com/kb/971620&quot; href=&quot;http://support.microsoft.com/kb/971620&quot;&gt;http://support.microsoft.com/kb/971620&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;  </description><link>http://emalvass.blogspot.com/2010/07/moss-2007-evaluation-version-of.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsW7GscIZvvzg6BYKACdjWb3w0THzDsEJn-F3boIObMCV2U5oZYq3P01lYbQQBCuC3BCA3LTN90wkYUW_DtT36rGpdwR2-GuhCKvtZx22KBXQ846pe2K-OVCJcLzX97ybyd15V5vDLazU/s72-c?imgmax=800" height="72" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3789506896506356310.post-1393574228120125304</guid><pubDate>Mon, 19 Apr 2010 21:08:00 +0000</pubDate><atom:updated>2010-04-19T23:41:58.556+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">iTextSharp</category><category domain="http://www.blogger.com/atom/ns#">pdf</category><category domain="http://www.blogger.com/atom/ns#">Watermarking</category><title>Insert a Watermark with iTextSharp</title><description>&lt;p align=&quot;justify&quot;&gt;&lt;a href=&quot;http://sourceforge.net/projects/itextsharp/&quot; target=&quot;_blank&quot;&gt;iTextSharp&lt;/a&gt; is a very good open source library to manage file in pdf format. You can find many examples on how you can use this powerful library inside your application in this &lt;a href=&quot;http://itextsharp.sourceforge.net/tutorial/index.html&quot; target=&quot;_blank&quot;&gt;tutorial&lt;/a&gt;, but in this post I want to focus on a way to create a watermark and insert it inside in an existing pdf document.&lt;/p&gt; &lt;p align=&quot;justify&quot;&gt;This need come up from a project for my current customer who need to create a pdf document from a office file (Word, Excel and PowerPoint format) with a watermark reporting user name (user claiming the copy of the document). So, the approach I used to accomplish the requirement foresee the following steps:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;First, I create a bitmap with the text I want to render in the watermark;  &lt;li&gt;then, I insert the bitmap created inside my pdf document using iTextSharp library.&lt;/li&gt;&lt;/ol&gt; &lt;p align=&quot;justify&quot;&gt;Bitmap creation is very easy using dot Net Framework classes. So, I developed the &lt;em&gt;&lt;strong&gt;Watermark&lt;/strong&gt;&lt;/em&gt; class with default constructor requiring the text to render:&lt;/p&gt; &lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   1:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; Watermark(&lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; watermarkText)&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   2:  &lt;/span&gt;        {            &lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   3:  &lt;/span&gt;            Text = watermarkText;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   4:  &lt;/span&gt;            TextFont = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; Font(&lt;span class=&quot;str&quot;&gt;&quot;Arial&quot;&lt;/span&gt;, 25, FontStyle.Bold);&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   5:  &lt;/span&gt;            Inizialize();&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   6:  &lt;/span&gt;        }&lt;/pre&gt;&lt;/div&gt;
&lt;p align=&quot;justify&quot;&gt;
&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, &quot;Courier New&quot;, courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;em&gt;TextFont&lt;/em&gt; is an auto property that consumer can modify to change watermark font. In the constructor I also initialize the Watermark instance setting the resolution DPI, the scale factor and I calculate the bitmap size (width and height in pixel) using the following method:&lt;/p&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   1:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; DEFAULT_SCALE_RATIO = 24;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   2:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   3:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; Inizialize()&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   4:  &lt;/span&gt;{&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   5:  &lt;/span&gt;    ScaleFactor = DEFAULT_SCALE_RATIO;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   6:  &lt;/span&gt;    Position = WatermarkPosition.Central;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   7:  &lt;/span&gt;    BackGroundColor = Color.Transparent;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   8:  &lt;/span&gt;    BrushColor = Color.LightGray;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   9:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  10:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; (var bitmap = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; Bitmap(1, 1))&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  11:  &lt;/span&gt;    {&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  12:  &lt;/span&gt;        bitmap.SetResolution(DPI, DPI);&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  13:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt;(var g = Graphics.FromImage(bitmap))&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  14:  &lt;/span&gt;        {&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  15:  &lt;/span&gt;            Height = Convert.ToInt32(g.MeasureString(Text, TextFont).Height);&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  16:  &lt;/span&gt;            Width = Convert.ToInt32(g.MeasureString(Text, TextFont).Width);&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  17:  &lt;/span&gt;        }&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  18:  &lt;/span&gt;    }&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  19:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, &quot;Courier New&quot;, courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, &quot;Courier New&quot;, courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p align=&quot;justify&quot;&gt;It is necessary to scale the bitmap because you could have resolution problems when you use it with iTextSharp library (see paragraph &lt;a href=&quot;http://itextsharp.sourceforge.net/tutorial/ch06.html&quot; target=&quot;_blank&quot;&gt;Impact on the resolution&lt;/a&gt; in iTextSharp tutorial).&lt;/p&gt;
&lt;p&gt;To get the desired bitmap I created the following public methods:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;one to get the image with original size 
&lt;li&gt;one to get scaled image&lt;/li&gt;&lt;/ul&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   1:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; Image GetImage()&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   2:  &lt;/span&gt;{    &lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   3:  &lt;/span&gt;    var bitmap = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; Bitmap(Width, Height);&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   4:  &lt;/span&gt;    var image = CreateImage(bitmap, TextFont);&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   5:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; image;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   6:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   7:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   8:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   9:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; Image GetScaledImage()&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  10:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  11:  &lt;/span&gt;    var bitmap = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; Bitmap(ScaledWidth, ScaledHeight);&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  12:  &lt;/span&gt;    var image = CreateImage(bitmap, ScaledTextFont);&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  13:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; image;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  14:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, &quot;Courier New&quot;, courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
where &lt;em&gt;ScaledWidth&lt;/em&gt; and &lt;em&gt;ScaledHeight&lt;/em&gt; are:&lt;/p&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   1:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; ScaledWidth&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   3:  &lt;/span&gt;    get { &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; Width *100 / ScaleFactor; }&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   4:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   5:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   6:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; ScaledHeight&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   7:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   8:  &lt;/span&gt;    get { &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; Height *100 / ScaleFactor; }&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   9:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, &quot;Courier New&quot;, courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;The last thing is the &lt;em&gt;CreateImage&lt;/em&gt; method which really makes the work:&lt;/p&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   1:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;float&lt;/span&gt; DEFAULT_IMAGE_DPI = 72f;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   2:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   3:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;private&lt;/span&gt; Image CreateImage(Bitmap bitmap, Font font)&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   4:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   5:  &lt;/span&gt;    bitmap.SetResolution(DEFAULT_IMAGE_DPI, DEFAULT_IMAGE_DPI);&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   6:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt;(var g = Graphics.FromImage(bitmap))&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   7:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   8:  &lt;/span&gt;        SetGraphicsProperty(g);&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   9:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  10:  &lt;/span&gt;        var sizef = g.MeasureString(Text, font);&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  11:  &lt;/span&gt;        g.Clear(BackGroundColor);&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  12:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  13:  &lt;/span&gt;        var text = Text;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  14:  &lt;/span&gt;        var width = bitmap.Width;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  15:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  16:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (Repeater)&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  17:  &lt;/span&gt;        {&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  18:  &lt;/span&gt;            &lt;span class=&quot;kwrd&quot;&gt;while&lt;/span&gt; (width%sizef.Width &amp;gt; 0)&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  19:  &lt;/span&gt;            {&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  20:  &lt;/span&gt;                text += &lt;span class=&quot;str&quot;&gt;&quot; - &quot;&lt;/span&gt; + Text;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  21:  &lt;/span&gt;                width -= Convert.ToInt32(sizef.Width);&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  22:  &lt;/span&gt;            }&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  23:  &lt;/span&gt;        }&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  24:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  25:  &lt;/span&gt;        g.DrawString(text, font, &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; SolidBrush(BrushColor), 0, 0,&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  26:  &lt;/span&gt;                     &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; StringFormat(StringFormatFlags.FitBlackBox));&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  27:  &lt;/span&gt;        g.Flush();&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  28:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  29:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; bitmap;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  30:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;p align=&quot;justify&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;&lt;em&gt;Repeater&lt;/em&gt; is an auto-property to create a bitmap with text repeated many times necessary to fill all the bitmap width.This is required, for example, when I want a watermark positioned along all document margins.&lt;/font&gt;&lt;/p&gt;
&lt;p align=&quot;justify&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;&lt;em&gt;BackgroundColor &lt;/em&gt;and&lt;em&gt; BrushColor&lt;/em&gt; are two auto-property which permit to customize watermark look &amp;amp; feel.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color=&quot;#000000&quot;&gt;&lt;em&gt;SetGraphicsProperty&lt;/em&gt; method just initializes some image properties (see &lt;font color=&quot;#ff0000&quot;&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/71961/Creating-a-Simple-Sheet-Designer-in-Csharp.aspx&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;&lt;/font&gt; for more details):&lt;/font&gt;&lt;/p&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; SetGraphicsProperty(Graphics g)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;    &lt;span class=&quot;rem&quot;&gt;// Set the System.Drawing.Graphics object property SmoothingMode to HighQuality &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    g.SmoothingMode = SmoothingMode.AntiAlias;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;    &lt;span class=&quot;rem&quot;&gt;// Set the System.Drawing.Graphics object property CompositingQuality to HighQuality&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    g.CompositingQuality = CompositingQuality.HighQuality;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;    &lt;span class=&quot;rem&quot;&gt;// Set the System.Drawing.Graphics object property InterpolationMode to High&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    g.InterpolationMode = InterpolationMode.High;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;    g.PixelOffsetMode = PixelOffsetMode.HighQuality;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;    g.TextRenderingHint = TextRenderingHint.AntiAlias;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, &quot;Courier New&quot;, courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;font color=&quot;#000000&quot;&gt;&lt;/font&gt;
&lt;p align=&quot;justify&quot;&gt;Now that we have our watermark, we can work on PDF document where we want insert it. To accomplish this I create the &lt;em&gt;&lt;strong&gt;PDFDocument&lt;/strong&gt;&lt;/em&gt; class:&lt;/p&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   1:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; iTextSharp.text;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   2:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; iTextSharp.text.pdf;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   3:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   4:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;class&lt;/span&gt; PDFDocument&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   5:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   6:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   7:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;private&lt;/span&gt; PDFDocument(Guid Id)&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   8:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   9:  &lt;/span&gt;        ID = Id;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  10:  &lt;/span&gt;        Watermarks = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; List&amp;lt;IWatermark&amp;gt;();&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  11:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  12:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  13:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; PDFDocument(Guid id, &lt;span class=&quot;kwrd&quot;&gt;byte&lt;/span&gt;[] binaryFile, &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; fileName) : &lt;span class=&quot;kwrd&quot;&gt;this&lt;/span&gt;(id)&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  14:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  15:  &lt;/span&gt;        binary = binaryFile;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  16:  &lt;/span&gt;        var pdfReader = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; PdfReader(binaryFile);&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  17:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt;(pdfReader.NumberOfPages == 0 ) &lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  18:  &lt;/span&gt;            &lt;span class=&quot;kwrd&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; Exception(&lt;span class=&quot;str&quot;&gt;&quot;Document does not contain any page!&quot;&lt;/span&gt;);&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  19:  &lt;/span&gt;        var pageSize = pdfReader.GetPageSizeWithRotation(1);&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  20:  &lt;/span&gt;        PageWidth = Convert.ToInt32(pageSize.Width);&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  21:  &lt;/span&gt;        PageHeight = Convert.ToInt32(pageSize.Height);&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  22:  &lt;/span&gt;        PageRotationInDegree = pageSize.Rotation;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  23:  &lt;/span&gt;        FileName = fileName;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  24:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  25:  &lt;/span&gt;    &lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  26:  &lt;/span&gt;...&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  27:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  28:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;p align=&quot;justify&quot;&gt;The constructor of my entity require the id, the binary data and the file name.&lt;br&gt;Note that here I’m using iTextSharp library and, in particular, the &lt;em&gt;&lt;strong&gt;PDFReader&lt;/strong&gt;&lt;/em&gt; class in &lt;em&gt;iTextSharp.text.pdf&lt;/em&gt; namespace; in this way I can set some useful properties about document in question, such as page width, height and rotation. I also define an auto property to add desired watermarks to my pdf document:&lt;/p&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; IList&amp;lt;Watermark&amp;gt; Watermarks&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;    {&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;        get;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;        set;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;    }&lt;/pre&gt;&lt;/div&gt;
&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, &quot;Courier New&quot;, courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;And now the main point of the class. With &lt;em&gt;GetDocumentWithWatermark&lt;/em&gt; method, I process the pdf document to insert the real watermark picture:&lt;/p&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   1:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;byte&lt;/span&gt;[] GetDocumentWithWatermark(&lt;span class=&quot;kwrd&quot;&gt;bool&lt;/span&gt; protect)&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   3:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; (var outputStream = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; MemoryStream())&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   4:  &lt;/span&gt;    {&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   5:  &lt;/span&gt;    var pdfReader = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; PdfReader(binary);&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   6:  &lt;/span&gt;    var pdfStamper = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; PdfStamper(pdfReader, outputStream);&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   7:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   8:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;foreach&lt;/span&gt; (var watermark &lt;span class=&quot;kwrd&quot;&gt;in&lt;/span&gt; Watermarks)&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   9:  &lt;/span&gt;    {&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  10:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; (var bitmap = watermark.GetScaledImage())&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  11:  &lt;/span&gt;        {&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  12:  &lt;/span&gt;        var image = Image.GetInstance(bitmap, BaseColor.WHITE );&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  13:  &lt;/span&gt;        &lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  14:  &lt;/span&gt;        var numberOfPages = pdfStamper.Reader.NumberOfPages;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  15:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  16:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;for&lt;/span&gt; (var i = 1; i &amp;lt;= numberOfPages; i++)&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  17:  &lt;/span&gt;        {&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  18:  &lt;/span&gt;            var pageSize = pdfStamper.Reader.GetPageSizeWithRotation(i);&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  19:  &lt;/span&gt;            PdfContentByte waterMarkContent = &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt;;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  20:  &lt;/span&gt;            &lt;span class=&quot;kwrd&quot;&gt;switch&lt;/span&gt; (watermark.Position)&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  21:  &lt;/span&gt;            {&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  22:  &lt;/span&gt;                &lt;span class=&quot;kwrd&quot;&gt;case&lt;/span&gt; WatermarkPosition.Right:&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  23:  &lt;/span&gt;                    image.RotationDegrees = 90;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  24:  &lt;/span&gt;                    image.Rotate();&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  25:  &lt;/span&gt;                    image.ScalePercent(watermark.ScaleFactor);&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  26:  &lt;/span&gt;                    image.SetAbsolutePosition(pageSize.Width - &lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  27:  &lt;/span&gt;                                                image.ScaledWidth, 0);&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  28:  &lt;/span&gt;                    waterMarkContent = pdfStamper.GetOverContent(i);&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  29:  &lt;/span&gt;                    &lt;span class=&quot;kwrd&quot;&gt;break&lt;/span&gt;;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  30:  &lt;/span&gt;                &lt;span class=&quot;kwrd&quot;&gt;case&lt;/span&gt; WatermarkPosition.Central:&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  31:  &lt;/span&gt;                    image.RotationDegrees = WATERMARK_ANGLE;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  32:  &lt;/span&gt;                    image.Rotate();&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  33:  &lt;/span&gt;                    image.ScalePercent(watermark.ScaleFactor);&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  34:  &lt;/span&gt;                    image.SetAbsolutePosition(pageSize.Width/2 - &lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  35:  &lt;/span&gt;                                                image.ScaledWidth/2,&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  36:  &lt;/span&gt;                                              pageSize.Height/2 - &lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  37:  &lt;/span&gt;                                                image.ScaledHeight/2);&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  38:  &lt;/span&gt;                    waterMarkContent = pdfStamper.GetUnderContent(i);&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  39:  &lt;/span&gt;                    &lt;span class=&quot;kwrd&quot;&gt;break&lt;/span&gt;;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  40:  &lt;/span&gt;                &lt;span class=&quot;kwrd&quot;&gt;case&lt;/span&gt; WatermarkPosition.Left:&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  41:  &lt;/span&gt;                    image.RotationDegrees = 90;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  42:  &lt;/span&gt;                    image.Rotate();&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  43:  &lt;/span&gt;                    image.ScalePercent(watermark.ScaleFactor);&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  44:  &lt;/span&gt;                    image.SetAbsolutePosition(0, 0);&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  45:  &lt;/span&gt;                    waterMarkContent = pdfStamper.GetOverContent(i);&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  46:  &lt;/span&gt;                    &lt;span class=&quot;kwrd&quot;&gt;break&lt;/span&gt;;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  47:  &lt;/span&gt;            }&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  48:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  49:  &lt;/span&gt;            &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (waterMarkContent != &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt;) &lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  50:  &lt;/span&gt;                waterMarkContent.AddImage(image, &lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;);&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  51:  &lt;/span&gt;        }&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  52:  &lt;/span&gt;        }&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  53:  &lt;/span&gt;    }&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  54:  &lt;/span&gt;    pdfStamper.Close();&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  55:  &lt;/span&gt;    pdfReader.Close();&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  56:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; outputStream.ToArray();&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  57:  &lt;/span&gt;    }&lt;/pre&gt;&lt;/div&gt;
&lt;p class=&quot;csharpcode&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, &quot;Courier New&quot;, courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;as you can see I use iTextSharp class such as PdfReader and PdfStamper to manipulate the document and then, in the switch code segment, I create and position the image according to I want a central, left or right watermark. Note that I call two different method of pdfStamper instance:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;GetUnderContent&lt;/em&gt; method: allow to put my watermark a level lower the current document layout. This is the best solution when I set central watermark and I want that document text and image are over the watermark 
&lt;li&gt;
&lt;div align=&quot;justify&quot;&gt;&lt;em&gt;GetOverContent&lt;/em&gt; method: allow to set watermark upper all document content. Because left and right watermark stay on document margin, could be very useful put it over all content especially when you are manipulating pdf file coming from a PowerPoint document conversion which can have non-transparent background image.&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p align=&quot;justify&quot;&gt;Note that I have repeated the operation for all the page inside the pdf document because page layout could be change (horizontal or vertical page layout). &lt;/p&gt;
&lt;p&gt;References:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://sourceforge.net/projects/itextsharp/&quot; target=&quot;_blank&quot;&gt;iTextSharp library&lt;/a&gt; 
&lt;li&gt;&lt;a href=&quot;http://itextsharp.sourceforge.net/tutorial/index.html&quot; target=&quot;_blank&quot;&gt;iTextSharp tutorial&lt;/a&gt; 
&lt;li&gt;&lt;a title=&quot;http://www.codeproject.com/Articles/71961/Creating-a-Simple-Sheet-Designer-in-Csharp.aspx&quot; href=&quot;http://www.codeproject.com/Articles/71961/Creating-a-Simple-Sheet-Designer-in-Csharp.aspx&quot;&gt;http://www.codeproject.com/Articles/71961/Creating-a-Simple-Sheet-Designer-in-Csharp.aspx&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;  </description><link>http://emalvass.blogspot.com/2010/04/insert-watermark-with-itextsharp.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3789506896506356310.post-2973018015134972648</guid><pubDate>Mon, 01 Mar 2010 16:17:00 +0000</pubDate><atom:updated>2010-03-04T00:07:37.094+01:00</atom:updated><title>VirtualBox: Shrink guest volume</title><description>&lt;p&gt;Today, I tried to increase space on my working notebook. I usually work in virtual environment and in the last period I’ve found very cool &lt;a href=&quot;http://www.virtualbox.org/&quot; target=&quot;_blank&quot;&gt;VirtualBox&lt;/a&gt; virtualization product.&lt;/p&gt; &lt;p align=&quot;justify&quot;&gt;From a first analysis, I found that the logical space occupied by guest disk was less than the physical space on my hard disk (32 GB versus 37 GB). Unfortunately VirtualBox UI don’t provide any tools to shrink volume such as in MS Virtual PC. So, I had a short search on Google and I found out a couple of very interesting posts to&amp;nbsp; accomplish the task.&lt;/p&gt; &lt;p&gt;Here, summarized the steps:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Defrag your guest disk using windows defrag,  &lt;li&gt;Download the following tool (&lt;a href=&quot;http://technet.microsoft.com/en-us/sysinternals/bb897443.aspx&quot; target=&quot;_blank&quot;&gt;SDelete&lt;/a&gt;) and copy and extract it in your virtual environment,  &lt;li&gt;Open a console in guest system, go to SDelete directory and type the following command:&lt;br&gt;&lt;br&gt;&lt;em&gt;sdelete -c c:\&lt;br&gt;&lt;br&gt;&lt;/em&gt;where C:\ is the volume to shrink.  &lt;li&gt;Shutdown the virtual machine.  &lt;li&gt;In the host environment open a console, go to VirtualBox directory (in my case was: “C:\Program Files\Sun\VirtualBox”)  &lt;li&gt;Type the following command:&lt;br&gt;&lt;br&gt;&lt;em&gt;VBoxManage.exe modifyvdi &amp;lt;your path to vdi file&amp;gt;\file.vdi compact&lt;/em&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p align=&quot;justify&quot;&gt;The last operation is the slowest and requires about 20 minutes (probably depends on machine and file size).&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;u&gt;Assumptions:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;VirtualBox version: 3.1.4&lt;/p&gt; &lt;p&gt;Host O.S.: Windows 7 x64&lt;/p&gt; &lt;p&gt;Guest O.S.: Windows 2008 x86&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;u&gt;References:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href=&quot;http://my.opera.com/locksley90/blog/2008/06/01/how-to-compact-a-virtualbox-virtual-disk-image-vdi&quot; target=&quot;_blank&quot;&gt;How to compact a VirtualBox virtual disk image (VDI)&lt;/a&gt;  &lt;li&gt;&lt;a href=&quot;http://maketecheasier.com/shrink-your-virtualbox-vm/2009/04/06&quot; target=&quot;_blank&quot;&gt;How To Shrink Your Virtualbox VM And Free Up Space For Your Hard Disk&lt;/a&gt;  &lt;li&gt;&lt;a href=&quot;http://technet.microsoft.com/en-us/sysinternals/bb897443.aspx&quot; target=&quot;_blank&quot;&gt;SDelete v1.51&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;  </description><link>http://emalvass.blogspot.com/2010/03/virtualbox-shrink-guest-volume.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3789506896506356310.post-3767608346910183248</guid><pubDate>Sun, 17 Jan 2010 09:59:00 +0000</pubDate><atom:updated>2010-02-20T14:13:35.540+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Office Automation</category><category domain="http://www.blogger.com/atom/ns#">Windows 2008</category><category domain="http://www.blogger.com/atom/ns#">Windows Service</category><title>How to use Office 2007 Automation in Windows 2008 service</title><description>&lt;p&gt;I’ve lost approximately 3 days about this topic. I read tens of posts by finally I’ve understood…&lt;/p&gt; &lt;p align=&quot;justify&quot;&gt;I’m working on a solution including a file conversion from a document in MS Office 2003 format (doc, xls, ppt) to PDF.&lt;/p&gt; &lt;p align=&quot;justify&quot;&gt;To do this I’ve seen several products base on a windows service which utilize MS Office 2007 or Open Office capabilities to export your documents in PDF format.&lt;/p&gt; &lt;p align=&quot;justify&quot;&gt;I’m not very satisfy to accomplish the requirements with a product, so I started to investigate different examples to create my custom solution.&lt;/p&gt; &lt;p align=&quot;justify&quot;&gt;I started with the following projects hosted on “&lt;a href=&quot;http://www.codeproject.com/&quot; target=&quot;_blank&quot;&gt;The Code Project&lt;/a&gt;” portal.&lt;/p&gt; &lt;ul&gt; &lt;li&gt; &lt;p&gt;&lt;a href=&quot;http://www.codeproject.com/KB/files/generatepdf.aspx&quot; target=&quot;_blank&quot;&gt;Generate PDF Using C#&lt;/a&gt;&lt;/p&gt; &lt;li&gt; &lt;div align=&quot;justify&quot;&gt;&lt;a href=&quot;http://www.codeproject.com/KB/aspnet/word2pdf_serverconvert.aspx&quot; target=&quot;_blank&quot;&gt;Convert Word-Documents to PDF on an ASP.NET Server&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p align=&quot;justify&quot;&gt;While the first example is pretty easy to try (the only trouble is to find the correct version of Open Office to install :-)), the second hides unpredictable scenarios. In fact, after the test of the Office automation using the simple application form in the example, I try to export the code in a windows service process. The code is the same you can find in this &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb412305.aspx&quot; target=&quot;_blank&quot;&gt;MSDN article&lt;/a&gt;: &lt;/p&gt; &lt;div id=&quot;codeSnippetWrapper&quot;&gt; &lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot; id=&quot;codeSnippet&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum1&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum2&quot;&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum3&quot;&gt;   3:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,128,0)&quot;&gt;// Open the source document.&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum4&quot;&gt;   4:&lt;/span&gt;     wordDocument = wordApplication.Documents.Open(&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum5&quot;&gt;   5:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ref&lt;/span&gt; paramSourceDocPath, &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ref&lt;/span&gt; paramMissing, &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ref&lt;/span&gt; paramMissing,&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum6&quot;&gt;   6:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ref&lt;/span&gt; paramMissing, &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ref&lt;/span&gt; paramMissing, &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ref&lt;/span&gt; paramMissing,&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum7&quot;&gt;   7:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ref&lt;/span&gt; paramMissing, &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ref&lt;/span&gt; paramMissing, &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ref&lt;/span&gt; paramMissing,&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum8&quot;&gt;   8:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ref&lt;/span&gt; paramMissing, &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ref&lt;/span&gt; paramMissing, &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ref&lt;/span&gt; paramMissing,&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum9&quot;&gt;   9:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ref&lt;/span&gt; paramMissing, &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ref&lt;/span&gt; paramMissing, &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ref&lt;/span&gt; paramMissing,&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum10&quot;&gt;  10:&lt;/span&gt;         &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ref&lt;/span&gt; paramMissing);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum11&quot;&gt;  11:&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum12&quot;&gt;  12:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,128,0)&quot;&gt;// Export it in the specified format.&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum13&quot;&gt;  13:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;if&lt;/span&gt; (wordDocument != &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum14&quot;&gt;  14:&lt;/span&gt;         wordDocument.ExportAsFixedFormat(paramExportFilePath,&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum15&quot;&gt;  15:&lt;/span&gt;             paramExportFormat, paramOpenAfterExport, &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum16&quot;&gt;  16:&lt;/span&gt;             paramExportOptimizeFor, paramExportRange, paramStartPage,&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum17&quot;&gt;  17:&lt;/span&gt;             paramEndPage, paramExportItem, paramIncludeDocProps, &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum18&quot;&gt;  18:&lt;/span&gt;             paramKeepIRM, paramCreateBookmarks, paramDocStructureTags, &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum19&quot;&gt;  19:&lt;/span&gt;             paramBitmapMissingFonts, paramUseISO19005_1,&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum20&quot;&gt;  20:&lt;/span&gt;             &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ref&lt;/span&gt; paramMissing);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum21&quot;&gt;  21:&lt;/span&gt; }&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum22&quot;&gt;  22:&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;catch&lt;/span&gt; (Exception ex)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum23&quot;&gt;  23:&lt;/span&gt; {&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum24&quot;&gt;  24:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,128,0)&quot;&gt;// Respond to the error&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum25&quot;&gt;  25:&lt;/span&gt; }&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum26&quot;&gt;  26:&lt;/span&gt; &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;finally&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum27&quot;&gt;  27:&lt;/span&gt; {&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum28&quot;&gt;  28:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,128,0)&quot;&gt;// Close and release the Document object.&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum29&quot;&gt;  29:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;if&lt;/span&gt; (wordDocument != &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum30&quot;&gt;  30:&lt;/span&gt;     {&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum31&quot;&gt;  31:&lt;/span&gt;         wordDocument.Close(&lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ref&lt;/span&gt; paramMissing, &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ref&lt;/span&gt; paramMissing,&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum32&quot;&gt;  32:&lt;/span&gt;             &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ref&lt;/span&gt; paramMissing);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum33&quot;&gt;  33:&lt;/span&gt;         wordDocument = &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;null&lt;/span&gt;;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum34&quot;&gt;  34:&lt;/span&gt;     }&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum35&quot;&gt;  35:&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum36&quot;&gt;  36:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,128,0)&quot;&gt;// Quit Word and release the ApplicationClass object.&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum37&quot;&gt;  37:&lt;/span&gt;     &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;if&lt;/span&gt; (wordApplication != &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum38&quot;&gt;  38:&lt;/span&gt;     {&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum39&quot;&gt;  39:&lt;/span&gt;         wordApplication.Quit(&lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ref&lt;/span&gt; paramMissing, &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ref&lt;/span&gt; paramMissing,&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum40&quot;&gt;  40:&lt;/span&gt;             &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;ref&lt;/span&gt; paramMissing);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum41&quot;&gt;  41:&lt;/span&gt;         wordApplication = &lt;span style=&quot;color: rgb(0,0,255)&quot;&gt;null&lt;/span&gt;;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum42&quot;&gt;  42:&lt;/span&gt;     }&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum43&quot;&gt;  43:&lt;/span&gt;     &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum44&quot;&gt;  44:&lt;/span&gt;     GC.Collect();&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum45&quot;&gt;  45:&lt;/span&gt;     GC.WaitForPendingFinalizers();&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum46&quot;&gt;  46:&lt;/span&gt;     GC.Collect();&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum47&quot;&gt;  47:&lt;/span&gt;     GC.WaitForPendingFinalizers();&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; direction: ltr; border-top-style: none; color: black; border-left-style: none&quot;&gt;&lt;span style=&quot;color: rgb(96,96,96)&quot; id=&quot;lnum48&quot;&gt;  48:&lt;/span&gt; }&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br&gt;
&lt;div style=&quot;text-align: justify&quot;&gt;I need to tell you that my dev environment is based on Windows Server 2008 (x86) with the latest SP. When I tried to convert the first doc file using the service, I receive the bitter newness. Despite the code were the same, convert process failed. Debugging,&lt;strong&gt; I found out that Word could not open the file and returned a null object&lt;/strong&gt; (see row 13 in above code block).&lt;br&gt;Google searching response, further the “&lt;em&gt;Microsoft does not support Office server side automation (for version till 2007 – &lt;a href=&quot;http://support.microsoft.com/kb/257757/en-us&quot; target=&quot;_blank&quot;&gt;see here&lt;/a&gt;)&lt;/em&gt;” notice, says that other guys experienced in same problem using Windows 2008 services (&lt;a href=&quot;http://social.msdn.microsoft.com/Forums/en/netfx64bit/thread/545dd81f-e80a-48b0-89a1-dafcd72e269d&quot; target=&quot;_blank&quot;&gt;see this post&lt;/a&gt;). So, I tried the same custom service in a virtual machine with Windows Server 2003 and all went well. With an in deep search I’ve found other very usefully posts regarding Windows 2008 Server family lack about a particular folders. In detail:&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;for x64 system is necessary to create the following folder:&lt;br&gt;&lt;strong&gt;C:\Windows\SysWOW64\config\systemprofile\Desktop&lt;/strong&gt; 
&lt;li&gt;for x86 system: &lt;br&gt;&lt;strong&gt;C:\Windows\System32\config\systemprofile\Desktop&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;After this little tip, also Windows Server 2008 service resumed to work well providing the Office automation desired.&lt;/p&gt;&lt;u&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;/u&gt; 
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.codeproject.com/KB/files/generatepdf.aspx&quot; target=&quot;_blank&quot;&gt;Generate PDF Using C#&lt;/a&gt; 
&lt;li&gt;&lt;a href=&quot;http://www.codeproject.com/KB/aspnet/word2pdf_serverconvert.aspx&quot; target=&quot;_blank&quot;&gt;Convert Word-Documents to PDF on an ASP.NET Server&lt;/a&gt; 
&lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb412305.aspx&quot; target=&quot;_blank&quot;&gt;Saving Word 2007 Documents to PDF and XPS Formats&lt;/a&gt; 
&lt;li&gt;&lt;a href=&quot;http://support.microsoft.com/kb/257757/en-us&quot; target=&quot;_blank&quot;&gt;Considerations for server-side Automation of Office&lt;/a&gt; 
&lt;li&gt;&lt;a href=&quot;http://social.msdn.microsoft.com/Forums/en/netfx64bit/thread/545dd81f-e80a-48b0-89a1-dafcd72e269d&quot; target=&quot;_blank&quot;&gt;Word Automation through Windows service (Windows Server 2008) - Problem&lt;/a&gt; 
&lt;li&gt;&lt;a href=&quot;http://social.msdn.microsoft.com/Forums/en/innovateonoffice/thread/b81a3c4e-62db-488b-af06-44421818ef91&quot; target=&quot;_blank&quot;&gt;Excel 2007 automation on top of a Windows Server 2008 x64&lt;/a&gt; 
&lt;li&gt;&lt;a href=&quot;http://stackoverflow.com/questions/1177974/word-interop-not-working-in-a-scheduled-task&quot; target=&quot;_blank&quot;&gt;Word Interop Not Working In A Scheduled Task&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;div style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px&quot; id=&quot;scid:C16BAC14-9A3D-4c50-9394-FBFEF7A93539:88724336-9dd4-4f19-8c06-6e0765cddd51&quot; class=&quot;wlWriterEditableSmartContent&quot;&gt;&lt;!--dotnetkickit--&gt;&lt;/div&gt;  </description><link>http://emalvass.blogspot.com/2010/01/how-to-use-office-2007-automation-in.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>7</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3789506896506356310.post-707944752090669552</guid><pubDate>Fri, 29 May 2009 07:43:00 +0000</pubDate><atom:updated>2009-05-29T09:59:44.374+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Blackpearl</category><category domain="http://www.blogger.com/atom/ns#">K2</category><category domain="http://www.blogger.com/atom/ns#">Kerberos</category><title>K2 Blackpearl: Useful posts to configure ditribuited environment</title><description>This week I have been involved in the K2 Blackpearl environment setup. When you install it on a single machine the setup is very easy and fluent thanks to the installer provided by SourceCode. The activity began more difficult when you have to install various components on different machine in a distributed environment. In fact to allow multiple components communication it&#39;s required Kerberos Delegation. Here I posts some very handy reference to accomplish this tricky activity:
&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.k2distillery.com/2009/04/k2-blackpearl-kerberos-configuration.html&quot;&gt;http://www.k2distillery.com/2009/04/k2-blackpearl-kerberos-configuration.html&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://blog.myitechnology.com/2008/09/troubleshooting-kerberos-issues.html&quot;&gt;http://blog.myitechnology.com/2008/09/troubleshooting-kerberos-issues.html&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;</description><link>http://emalvass.blogspot.com/2009/05/k2-blackpearl-useful-post-to-configure.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3789506896506356310.post-820133203599345586</guid><pubDate>Wed, 13 May 2009 14:38:00 +0000</pubDate><atom:updated>2009-05-18T15:08:24.953+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">K2</category><category domain="http://www.blogger.com/atom/ns#">Permissions</category><category domain="http://www.blogger.com/atom/ns#">Sharepoint Workflow Integration</category><title>K2 Blackpearl: Set Sharepoint Task List Item Permission by code</title><description>Again on Sharepoint Workflow Integration Process...
In the same process used in this &lt;a href=&quot;http://emalvass.blogspot.com/2009/05/k2-blackpearl-get-task-list-item-in.html&quot;&gt;post&lt;/a&gt;, I had to set particultar permissions to two custom sharepoint groups on the Tasks item created in Sharepoint Workflow Integration Client [SWIC]. In particular my goal was to set &lt;em&gt;&quot;View Only&quot;&lt;/em&gt; permission to the following groups:
&lt;ul&gt;&lt;li&gt;Approvator Box Push
&lt;/li&gt;&lt;li&gt;Collaborator Box Push&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;where Box Push is my Sharepoint List with my K2 integrated workflow.
Because I want to set this permissions when the task item is generated, in this case I cannot use &quot;Sharepoint User Management&quot; [SUM] event because I have the task item ID only when the item is created (see again this &lt;a href=&quot;http://emalvass.blogspot.com/2009/05/k2-blackpearl-get-task-list-item-in.html&quot;&gt;post&lt;/a&gt;). If you think to use SUM after the SWIC event, you haven&#39;t the desired behavior because process instance waits a user action to go on and permissions are set too late.

&lt;strong&gt;So, to achieve my purpose I needed to write custom code in SWIC event after I get task item ID.
&lt;/strong&gt;
In &lt;em&gt;&quot;ExecuteForUser&quot;&lt;/em&gt; method body I call a K2 sharepoint web service (installed by K2 on MOSS) used to set permission on generic item (site, list or item list) hosted on MOSS solution.
The code to call this service is the follow: &lt;/p&gt;&lt;pre class=&quot;csharpcode&quot;&gt;SourceCode.SharePoint.WebServices.K2SPPermissions K2SPPermissionsPRx =
  &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; SourceCode.SharePoint.WebServices.K2SPPermissions();
K2SPPermissionsPRx.Url = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; K2Uri(MyUrl).FormatURI(&lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;) +
     &lt;span class=&quot;str&quot;&gt;&quot;_vti_bin/K2SPPermissions.ASMX&quot;&lt;/span&gt;;

ADCredentials directoryCredential = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; ADCredentials();

K2SPPermissionsPRx.Credentials =
  directoryCredential.GetCredentials(K2SPPermissionsPRx.Url);

K2SPPermissionsPRx.SetSiteWidePermissionsFromXml(XML_FOR_PERMISSION);&lt;/pre&gt;where MyUrl is the Sharepoint site url.

This service gets in input a xml string describing the permissions to assign. An example could be this:
&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Group&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Filter&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; YOUR MOSS SITE &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Filter&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointPeopleAndGroupsItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Url&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointSite&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt; YOUR MOSS SITE &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointSite&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointList&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Tasks&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointList&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointFolder&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointFolder&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt; YOUR ITEM ID &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointGroup&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointGroup&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Url&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointItemType&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;SHAREPOINTLISTITEM&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointItemType&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;UserOrGroupCollection&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;UserOrGroup&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;LoginName&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Approvers Box Push&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;LoginName&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Group&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;UserOrGroup&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;UserOrGroupCollection&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;K2SharePointItemCollection&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;K2SharePointItemCollection&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;K2UserOrGroupCollection&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;K2UserOrGroupCollection&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;BreakRoleInheritance&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;True&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;BreakRoleInheritance&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;CopyRoleAssignments&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;False&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;CopyRoleAssignments&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;RevokeDefinitions&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;False&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;RevokeDefinitions&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;AssignSiteMemberPermission&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;False&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;AssignSiteMemberPermission&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointPermissionCollection&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointPermission&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Full Control&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;REVOKE&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointPermission&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointPermission&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Design&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;REVOKE&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointPermission&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointPermission&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Manage Hierarchy&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;REVOKE&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointPermission&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointPermission&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Approve&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;REVOKE&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointPermission&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointPermission&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Contribute&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;REVOKE&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointPermission&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointPermission&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Read&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;REVOKE&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointPermission&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointPermission&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Restricted Read&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;REVOKE&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointPermission&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointPermission&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;View Only&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;ASSIGN&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointPermission&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointPermissionCollection&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SharePointPeopleAndGroupsItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Group&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;in my particular case I set &lt;em&gt;&quot;View Only&quot;&lt;/em&gt; to &lt;em&gt;&quot;Approvers Box Push&quot;&lt;/em&gt; group but you can set your desire permissions substituting ASSIGN to REVOKE label.
In this way I achieve my purpose, in fact when a user member of Approvers Box Push open a task Item he or she could only view it (see the picture below).


&lt;img id=&quot;BLOGGER_PHOTO_ID_5337146402550394882&quot; style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 320px; CURSOR: hand; HEIGHT: 272px; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpFLkAap4I1ATLb6lcfZGnjCPvRfP6E7TPjF_KEBKXS_-Ak4WyjpnAwA7l-XioYj3zEZys7PeoYNLXCdzHdkmcjWgTmW3vgTVZM0IBdeGPRG61ETUe8Tuh_gw4MIl5IOcd0ui_X5YD-Dc/s320/2009-05-18_145333.png&quot; border=&quot;0&quot; /&gt;
These permissions are set only to the item; on the Tasks list, users can add new task item as they want (as showed in the follow picture):


&lt;img id=&quot;BLOGGER_PHOTO_ID_5337146847163222722&quot; style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 320px; CURSOR: hand; HEIGHT: 144px; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvA_5VGQoQ6lAckbNWa77Ni9OG71Vc6AVYqMVFwZqy7dh2cTJXSgDs95LaO3UplboGR2VWg_Dw6-qqok2PSdksWD1TPyCwZCYUaoB5-ZtawZR1_v0abMVYWYz6Xjgkls1TPrAzJu7u4-4/s320/2009-05-18_145520.png&quot; border=&quot;0&quot; /&gt;</description><link>http://emalvass.blogspot.com/2009/05/k2-blackpearl-set-sharepoint-task-list.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpFLkAap4I1ATLb6lcfZGnjCPvRfP6E7TPjF_KEBKXS_-Ak4WyjpnAwA7l-XioYj3zEZys7PeoYNLXCdzHdkmcjWgTmW3vgTVZM0IBdeGPRG61ETUe8Tuh_gw4MIl5IOcd0ui_X5YD-Dc/s72-c/2009-05-18_145333.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3789506896506356310.post-7515148693969321489</guid><pubDate>Wed, 13 May 2009 13:43:00 +0000</pubDate><atom:updated>2009-05-18T15:08:52.612+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">K2</category><category domain="http://www.blogger.com/atom/ns#">Sharepoint Workflow Integration</category><category domain="http://www.blogger.com/atom/ns#">Task ID</category><title>K2 Blackpearl - Get Task List Item in Sharepoint Workflow Integration</title><description>Using K2 Blackpearl features like Sharepoint events can be very usefull and easy to develop a workflow in few minutes. Althought, sometimes there are pitfalls that frustrate your initial purpose.

For example, one of this day, I run against Sharepoint Workflow Integration features. I create my simple approval process in figure but, initially, I can&#39;t to get the task item ID created during Sharepoint Workflow Integration Client [SWIC].



&lt;img id=&quot;BLOGGER_PHOTO_ID_5335311301102485602&quot; style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 320px; CURSOR: hand; HEIGHT: 296px; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhN1Yi8IMJR_pm1hwr03IyMisbACfCksJLcfkmE26INTq00bw6Q6ZzqYrD_gW3iJfbHEblNgnnTyOq9Hal5IqU0mhM4Z2noFfOF2681DEStGiwNdm7ZRVf2QDGcnV_7cHE3X7J7yiNc-tI/s320/2009-05-13_161219.png&quot; border=&quot;0&quot; /&gt;
I needed this ID because in my final activity I set a Sharepoint List Items event to delete the Task List Item created during the previous activity (SWIC, see Delete Task Activity in the figure above).

To accomplish to this necessity, I had to create a new process DataField which I called &quot;TaskId&quot;

&lt;img id=&quot;BLOGGER_PHOTO_ID_5335310740886115522&quot; style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 320px; CURSOR: hand; HEIGHT: 244px; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_qPrbRHjZ272rR27iNugFpkKv6EG-kl2V0Fs2Ff3MZ0MouNMs-rak0oBTIqcH2XAmlY_okHpeQ01n3Va7v4PWzEbUb_5wVvYo1i8dBq1_2mtpAGeBz5VJdXJJv9SI32-sORsh7g1cUfk/s320/2009-05-13_160918.png&quot; border=&quot;0&quot; /&gt; Then I had to go inside the code generated by SWIC event and I modified the ExecuteForUser method body in the follow manner:

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; taskIDstring = service.ModifyWorkflowAndGetTaskID(listId, listItemId,

                          workflowInstanceId, modificationID, contextData, &lt;span class=&quot;str&quot;&gt;&quot;&quot;&lt;/span&gt;);



&lt;span class=&quot;rem&quot;&gt;// Put task item id into process data field &quot;TaskID&quot;&lt;/span&gt;

&lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; taskID = taskIDstring.Split(&lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;[] { &lt;span class=&quot;str&quot;&gt;&quot;?ID=&quot;&lt;/span&gt; },

                        StringSplitOptions.None)[1];

K2.ProcessInstance.DataFields[&lt;span class=&quot;str&quot;&gt;&quot;TaskID&quot;&lt;/span&gt;].Value = taskID;&lt;/pre&gt;

&lt;div&gt;&quot;service.ModifyWorkflowAndGetTaskID&quot; calls a K2 web service who return a string contain the url of the task. A string like this: http://your MOSS server&lt;your&gt;&lt;your&gt;/Lists/Tasks/DispForm.aspx?ID=3.&lt;/div&gt;
&lt;div&gt;Thank to this code I&#39;m been able to delete Task List Item at the end of my process:&lt;/div&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5335316220073706946&quot; style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 320px; CURSOR: hand; HEIGHT: 298px; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCOQo8uZDq_5cKoJ3OQBl3m8FKmKQorY_ftPM17rR8f1Ur1DNGdWxEzE-THZocBH3qbJONAHZkN630dEE3y5H3n9b9MU8q3baJ-zPwPMOIM21OoOQwRfKdI2piNNk0LjNX9DGovfxSV8s/s320/2009-05-13_163130.png&quot; border=&quot;0&quot; /&gt;</description><link>http://emalvass.blogspot.com/2009/05/k2-blackpearl-get-task-list-item-in.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhN1Yi8IMJR_pm1hwr03IyMisbACfCksJLcfkmE26INTq00bw6Q6ZzqYrD_gW3iJfbHEblNgnnTyOq9Hal5IqU0mhM4Z2noFfOF2681DEStGiwNdm7ZRVf2QDGcnV_7cHE3X7J7yiNc-tI/s72-c/2009-05-13_161219.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3789506896506356310.post-2737051458942565741</guid><pubDate>Fri, 03 Apr 2009 08:16:00 +0000</pubDate><atom:updated>2009-04-03T10:42:10.323+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">time bomb</category><category domain="http://www.blogger.com/atom/ns#">time sync</category><category domain="http://www.blogger.com/atom/ns#">Virtual Machine Additions</category><category domain="http://www.blogger.com/atom/ns#">VirtualPC</category><category domain="http://www.blogger.com/atom/ns#">vm</category><title>Disable Virtual Machine Time Bomb</title><description>&lt;span lang=&quot;EN-US&quot;&gt;Deactivate virtual PC time bomb
If you have whatever needs to deactivate your virtual machine time synchronization (e.g. if there are software installed in your vm expiring), you could cut and paste the following XML code snippet in vmc file:
&lt;integration&gt;&lt;microsoft&gt;&lt;components&gt;&lt;/components&gt;&lt;/microsoft&gt;&lt;/integration&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;integration&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;microsoft&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
       &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;components&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
           &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;host_time_sync&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
               &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;enabled&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;boolean&quot;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;false&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;enabled&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
           &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;host_time_sync&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
       &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;components&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;microsoft&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;integration&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;Obviously, you should open vmc file with editor like notepade...&lt;/span&gt;</description><link>http://emalvass.blogspot.com/2009/04/disable-virtual-machine-time-bomb.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3789506896506356310.post-7352262389035073585</guid><pubDate>Mon, 02 Mar 2009 11:27:00 +0000</pubDate><atom:updated>2009-03-02T12:51:24.600+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Error 1714</category><category domain="http://www.blogger.com/atom/ns#">Virtual Machine Additions</category><category domain="http://www.blogger.com/atom/ns#">VirtualPC</category><title>Update Vitual Machine Additions issue</title><description>Last week I try to attach an old virtual machine (realized in Virtual PC 2004) to my Virtual PC 2007 sp1.
When I try ti update the Virtual Machine Additions to the new release I recevice the following error:

&quot;&lt;span style=&quot;background-color: rgb(255, 255, 0);&quot;&gt;Error 1714: the older version of Virtual Machine Additions cannot be removed. Contact your support group&lt;/span&gt;&quot;

The same error is raised up if you try to uninstall the component from &quot;Add or Remove Program&quot; (Panel Control -&gt; Add or Remove Program).

So, after a long &lt;span style=&quot;font-style: italic;&quot;&gt;googling&lt;/span&gt;, I succeeded in my purpose following this steps:
&lt;ul&gt;&lt;li&gt;Download &lt;a href=&quot;http://support.microsoft.com/default.aspx?scid=kb;en-us;290301&quot;&gt;Windows Installer CleanUp Utility&lt;/a&gt;  from Microsoft site,
&lt;/li&gt;&lt;li&gt;Install the utility,
&lt;/li&gt;&lt;li&gt;Launch &quot;Windows Installer CleanUp Utility&quot; (Start -&gt; All program -&gt; Windows Installer CleanUp Utility),&lt;/li&gt;&lt;li&gt;&quot;Windows Installer...&quot; shows a list of all your programs installed on your virtual system,
&lt;/li&gt;&lt;li&gt;Select item &quot;(All user) Virtual Machine Additions [&lt;span style=&quot;font-style: italic;&quot;&gt;&lt;your&gt;&lt;/your&gt;&lt;/span&gt;&lt;current version=&quot;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;your version&lt;/span&gt;]&quot; like in the figure,&lt;/current&gt;&lt;/li&gt;&lt;/ul&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRAt2gLLw8a9LRZfXdmXt_j-IjeVBa33q1U84OsjGO3H5TKj6WJi-wjdKgFsWVcZs8GWj9MmE0Pg0SgXPM8l8j7AjZa9aVK63pvHyTMxCmMVfnDooY165-R2ScQNJX3HirshEmcy8-LCk/s1600-h/2009-02-25_105551.png&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 319px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRAt2gLLw8a9LRZfXdmXt_j-IjeVBa33q1U84OsjGO3H5TKj6WJi-wjdKgFsWVcZs8GWj9MmE0Pg0SgXPM8l8j7AjZa9aVK63pvHyTMxCmMVfnDooY165-R2ScQNJX3HirshEmcy8-LCk/s320/2009-02-25_105551.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5308554315067324498&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;ul&gt;&lt;li&gt;Click  &quot;Remove&quot;,&lt;/li&gt;&lt;li&gt;Click  &quot;Ok&quot;,&lt;/li&gt;&lt;li&gt;Re-run Virtual Machine Additions program installation
&lt;/li&gt;&lt;/ul&gt;Now, you are able to complete successfully the setup.

Note: If you install VMA from last version of Virtual PC (VirtualPC 2007 sp1), you should have  this version number: 13.820.

Reference:
&lt;a href=&quot;http://support.microsoft.com/default.aspx?scid=kb;en-us;290301&quot;&gt;Windows Installer CleanUp Utility&lt;/a&gt;</description><link>http://emalvass.blogspot.com/2009/03/update-vitual-machine-additions-issue.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRAt2gLLw8a9LRZfXdmXt_j-IjeVBa33q1U84OsjGO3H5TKj6WJi-wjdKgFsWVcZs8GWj9MmE0Pg0SgXPM8l8j7AjZa9aVK63pvHyTMxCmMVfnDooY165-R2ScQNJX3HirshEmcy8-LCk/s72-c/2009-02-25_105551.png" height="72" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3789506896506356310.post-2669968897624716053</guid><pubDate>Mon, 09 Feb 2009 10:05:00 +0000</pubDate><atom:updated>2009-02-11T10:12:15.730+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Could not deserialize object</category><category domain="http://www.blogger.com/atom/ns#">declarative workflow</category><category domain="http://www.blogger.com/atom/ns#">WF</category><title>Declarative Workflow</title><description>Today, I began to experiment on MS WF.
I find very useful the possibility to load at runtime a xaml file of my personal workflow.
To reach my goal I create two project with VS 2008 to test my solution:
&lt;ul&gt;&lt;li&gt;A console project which is the entry point of my application;&lt;/li&gt;&lt;li&gt;A workflow library where put my custom activity and sequence workflow.&lt;/li&gt;&lt;/ul&gt;In my workflow library I add a xaml file where I put only my custom simple sequence with only one custom activity that print a &quot;Hello world&quot; (see the figure below).
Remember that the custom activity must be tagged as [Serializable].

&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaAJQ8KLUpKyL9xq_7eZdpsPg4gW9Fq5hm6Lr9X4dShhBjyRVU-ibweZSx5_Z8xzmh9ko20GnJgTTuvjFKgyU6Wu6ovevAaxniI3RAi9_hpur65Kp-PaCDQdHr4rycR2sWlp0Ck8XWFaY/s1600-h/VSScreenshot.png&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 235px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaAJQ8KLUpKyL9xq_7eZdpsPg4gW9Fq5hm6Lr9X4dShhBjyRVU-ibweZSx5_Z8xzmh9ko20GnJgTTuvjFKgyU6Wu6ovevAaxniI3RAi9_hpur65Kp-PaCDQdHr4rycR2sWlp0Ck8XWFaY/s320/VSScreenshot.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5301095329666818418&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;My xaml file hasn&#39;t the code behind because I built my workflow in declarative manner. If you take look at xml you could see:

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SequentialWorkflowActivity&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;x:Name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;Workflow1&quot;&lt;/span&gt;
&lt;span class=&quot;attr&quot;&gt;     xmlns:ns0&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;clr-namespace:MyWorkflowLibrary.Task;
Assembly=MyWorkflowLibrary, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null&quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;
xmlns:x&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;&lt;/span&gt;
&lt;span class=&quot;attr&quot;&gt;xmlns&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;http://schemas.microsoft.com/winfx/2006/xaml/workflow&quot;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;ns0:HelloWorldTask&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;x:Name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;helloWorldTask1&quot;&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SequentialWorkflowActivity&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

Note that I remove the x:Class attribute in SequentialWorkflowActivity. I do that because I haven&#39;t the compiled class in the code behind. In namespace attribute I add the reference to the assembly container of my activity, because this will be resolved at runtime.
The console application &quot;Main&quot; looks something like this:

&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;pre class=&quot;csharpcode&quot;&gt; &lt;span class=&quot;kwrd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; Main(&lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;[] args)
{
&lt;span class=&quot;rem&quot;&gt;// Here, I read my xaml file containing my declarative workflow&lt;/span&gt;
var xmlReader =
    &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; XmlTextReader(
        &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; StringReader(
            File.ReadAllText(
                &lt;span class=&quot;str&quot;&gt;@&quot;C:\Users\simonem\Documents\Visual Studio 2008\Projects\
                  TestWorkflow\MyWorkflowLibrary\HelloWorld.xoml&quot;&lt;/span&gt;)));

var runtime = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; WorkflowRuntime();

runtime.StartRuntime();
runtime.WorkflowCompleted += &lt;span class=&quot;kwrd&quot;&gt;delegate&lt;/span&gt;
                                 {
                                     Console.WriteLine(&lt;span class=&quot;str&quot;&gt;&quot;WorkFlow completed&quot;&lt;/span&gt;);
                                     Console.Read();
                                 };
&lt;span class=&quot;kwrd&quot;&gt;try&lt;/span&gt;
{
    var instance = runtime.CreateWorkflow(xmlReader);
    instance.Start();

}
&lt;span class=&quot;rem&quot;&gt;// Here I manage potential workflow validation exceptions&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;catch&lt;/span&gt;(WorkflowValidationFailedException wfve)
{
    var errorValidation = &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;.Empty;
    &lt;span class=&quot;kwrd&quot;&gt;foreach&lt;/span&gt; (var error &lt;span class=&quot;kwrd&quot;&gt;in&lt;/span&gt; wfve.Errors)
    {
        &lt;span class=&quot;rem&quot;&gt;// StringBuilder is better...&lt;/span&gt;
        errorValidation += Environment.NewLine + error.ErrorText;
    }
    Console.WriteLine(errorValidation);
}
&lt;span class=&quot;rem&quot;&gt;// General exceptions&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;catch&lt;/span&gt; (Exception ex)
{
    Console.WriteLine(ex.Message);
}
Console.Read();

}&lt;/pre&gt;Troubleshooting:
&lt;ul&gt;&lt;li&gt;If during the program execution you receive an error such as &lt;span style=&quot;font-weight: bold;&quot;&gt;&quot;Could not deserialize object. The type &#39;clr-namespace:MyWorkflowLibrary.Task;.HelloWorldTask&#39; could not be resolved. startIndex cannot be larger than length of string.Parameter name: startIndex&quot;&lt;/span&gt; remember to specify the assembly reference in workflow xml code (see below):&lt;/li&gt;&lt;/ul&gt; &lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;     &amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;SequentialWorkflowActivity&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;x:Name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;Workflow1&quot;&lt;/span&gt;
&lt;span class=&quot;attr&quot;&gt;     xmlns:ns0&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;clr-namespace:MyWorkflowLibrary.Task;
Assembly=MyWorkflowLibrary, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null&quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;
xmlns:x&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;
xmlns&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;http://schemas.microsoft.com/winfx/2006/xaml/workflow&quot;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;If you couldn&#39;t compile your solution and you receive the following error &lt;span style=&quot;font-weight: bold;&quot;&gt;&quot;Cannot compile a markup file which does not contain declaration of the new workflow type.&quot;&lt;/span&gt; you must change the build action on your xaml file from &quot;Content&quot; to &quot;None&quot;.
&lt;/li&gt;&lt;/ul&gt;
References:
&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://itsacodething.blogspot.com/2008/07/declarative-workflows-could-not.html&quot; target=&quot;_new&quot;&gt;Declarative workflows: Could not deserialize object. The type &#39;&#39; could not be resolved.&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.microsoft.com/uk/msdn/screencasts/screencast/40/Windows-Workflow-Foundation-Declarative-Workflows.aspx&quot; target=&quot;_new&quot;&gt;WF Video Series on MSDN Nuggets&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;</description><link>http://emalvass.blogspot.com/2009/02/declarative-workflow.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaAJQ8KLUpKyL9xq_7eZdpsPg4gW9Fq5hm6Lr9X4dShhBjyRVU-ibweZSx5_Z8xzmh9ko20GnJgTTuvjFKgyU6Wu6ovevAaxniI3RAi9_hpur65Kp-PaCDQdHr4rycR2sWlp0Ck8XWFaY/s72-c/VSScreenshot.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3789506896506356310.post-8823108844884824523</guid><pubDate>Wed, 04 Feb 2009 10:42:00 +0000</pubDate><atom:updated>2009-02-04T20:54:09.168+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Error</category><category domain="http://www.blogger.com/atom/ns#">Setup</category><category domain="http://www.blogger.com/atom/ns#">TF31002</category><category domain="http://www.blogger.com/atom/ns#">TFS</category><category domain="http://www.blogger.com/atom/ns#">TFS2008</category><category domain="http://www.blogger.com/atom/ns#">VSTS2008</category><title>TFS 2008: TF31002 error workaround...</title><description>After the setup of my new TFS server (see&lt;a href=&quot;http://emalvass.blogspot.com/2009/02/install-tfs-2008-final-attempt.html&quot;&gt; Install TFS 2008. The final attempt!!!&lt;/a&gt;), I start using TFS to share my project with other colleagues. So I follow Microsoft directives &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms404880.aspx&quot;&gt;here&lt;/a&gt; To accomplish this goal, but when my friend trys to connect to my TFS server receive the &lt;span class=&quot;clickable&quot; style=&quot;cursor: pointer;&quot; onclick=&quot;&#39;dr4sdgryt(event,&quot;&gt;&lt;span class=&quot;hg&quot;&gt;&lt;span class=&quot;hw&quot;&gt;infamous windows below:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYnNa_1VY1r4EJ2SpKdgWivQCjl6Q5CDcjVkIqJhefRCLn9JIY5N7QJ46AdISNoeRncldbMPSenjHS_uWmVuWZp9LWUDMm-WhLOk4r_Kktbou1A5tHUYNedSE5hSYiIwMbQt4u9rheWBI/s1600-h/TFS_TF31002ErrorWindow.png&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 239px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYnNa_1VY1r4EJ2SpKdgWivQCjl6Q5CDcjVkIqJhefRCLn9JIY5N7QJ46AdISNoeRncldbMPSenjHS_uWmVuWZp9LWUDMm-WhLOk4r_Kktbou1A5tHUYNedSE5hSYiIwMbQt4u9rheWBI/s320/TFS_TF31002ErrorWindow.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5298896884047394866&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;img style=&quot;width: 0px; height: 0px;&quot; src=&quot;file:///C:/Users/simonem/Pictures/TFS_TF31002ErrorWindow.png&quot; alt=&quot;&quot; /&gt;After a long and &lt;img style=&quot;width: 0px; height: 0px;&quot; src=&quot;file:///C:/Users/simonem/Pictures/TFS_TF31002ErrorWindow.png&quot; alt=&quot;&quot; /&gt;&lt;img style=&quot;width: 0px; height: 0px;&quot; src=&quot;file:///C:/Users/simonem/Pictures/TFS_TF31002ErrorWindow.png&quot; alt=&quot;&quot; /&gt;exhausting research on Google (I see that many other guys &lt;span onclick=&quot;dr4sdgryt(event)&quot;&gt;run against the same problem) I find the follow workaround:
&lt;/span&gt; &lt;ul&gt;&lt;li&gt;&lt;span onclick=&quot;dr4sdgryt(event)&quot;&gt;Open IIS console,&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span onclick=&quot;dr4sdgryt(event)&quot;&gt;Go to &quot;Team Foundation Server&quot; site, and open Authentication feature&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSp9cb6uk8-R_kLHNjjd5dl9gXbyGELdjnWpNyR9EkZFBAUH7bs_ku_MSuXioEH0HdpGVXz_j0yNmd671KijSD6QqpY22mpGtPejeN5RlEVIX5GfK7ATUqgRxrL-4ncWYN_J8lbIRuyxc/s1600-h/TFS_TF31002Error_IIS.png&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 280px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSp9cb6uk8-R_kLHNjjd5dl9gXbyGELdjnWpNyR9EkZFBAUH7bs_ku_MSuXioEH0HdpGVXz_j0yNmd671KijSD6QqpY22mpGtPejeN5RlEVIX5GfK7ATUqgRxrL-4ncWYN_J8lbIRuyxc/s320/TFS_TF31002Error_IIS.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5298897210652794130&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;Open context menu from ASP.NET Impersonation:&lt;/li&gt;&lt;/ul&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0xRWgnA4jHMzNhZkB-X1_FJHIRBtpfsDSCg5Fy8dkyxZMJRbtimy2tNEr4mxv3mhyphenhyphenApWEIpYeOglt_rSHncdk5nKMbw5hsgK5DOEOMEV3kSldLJH5C5JsmTNorKFgpm8gMCfyJY9Nn_k/s1600-h/TFS_TF31002Error_IIS2.png&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 280px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0xRWgnA4jHMzNhZkB-X1_FJHIRBtpfsDSCg5Fy8dkyxZMJRbtimy2tNEr4mxv3mhyphenhyphenApWEIpYeOglt_rSHncdk5nKMbw5hsgK5DOEOMEV3kSldLJH5C5JsmTNorKFgpm8gMCfyJY9Nn_k/s320/TFS_TF31002Error_IIS2.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5298897343321406914&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;ul&gt;&lt;li&gt;Set &quot;Specific user&quot; property to the account used to install your TFS server (in many other post is named TFSSetup)&lt;/li&gt;&lt;/ul&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieOOoLjSj4D7VpvtJ4DRIbEeQpizQil82DlKCfP37Mka_qmxsj227zSVH1kuVvyD_UpqhmgMsEi7fsiqjdL6oO61eqS73iLI-3pr4OgR6xfIo7nd9tbvz3xt177d9NIUScA6whj6U4wwA/s1600-h/TFS_TF31002Error_IIS3.png&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 280px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieOOoLjSj4D7VpvtJ4DRIbEeQpizQil82DlKCfP37Mka_qmxsj227zSVH1kuVvyD_UpqhmgMsEi7fsiqjdL6oO61eqS73iLI-3pr4OgR6xfIo7nd9tbvz3xt177d9NIUScA6whj6U4wwA/s320/TFS_TF31002Error_IIS3.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5298897438147644258&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;Repeate the steps above also for the WSS site (in my case is the &quot;Default Web Sites&quot;).
Remember that new TFS users must have also the permission in WSS site and in Reporting Service. To accomplish this requirement take a look to the screenshot below (IMHO is very usefull create a users group in your machine named TFS_Users and use it...):

&lt;div style=&quot;text-align: left;&quot;&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaWuh3SN72n3ELOc69-JE-1waOOkGvtNir_-oJt0f2YBo2Zm60Mmi0jNIRyXd96ZGHC8gz9FTwokT26h2eZRGE3aADsFgZwG7fFxP2YyPu6-4igpfdaa3XhklizYR49aG6wBTf1ILkS4w/s1600-h/TFS_TF31002Error_WSS.png&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 250px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaWuh3SN72n3ELOc69-JE-1waOOkGvtNir_-oJt0f2YBo2Zm60Mmi0jNIRyXd96ZGHC8gz9FTwokT26h2eZRGE3aADsFgZwG7fFxP2YyPu6-4igpfdaa3XhklizYR49aG6wBTf1ILkS4w/s320/TFS_TF31002Error_WSS.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5298897560663178194&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-BQpAWudkdJ-BhhZbsp7tsm9gDu4Mxvn41Qopmf-XQ4Qey8i6ShjEalKo8wcygFRlSrUlXpeRncCvAWpXwGSGFefm2TF5wU1z_qDWXKCsTx-Qs0e7qQgojr7LTYdaLKXoo8ye4eSiixM/s1600-h/TFS_TF31002Error_Reports.png&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 250px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-BQpAWudkdJ-BhhZbsp7tsm9gDu4Mxvn41Qopmf-XQ4Qey8i6ShjEalKo8wcygFRlSrUlXpeRncCvAWpXwGSGFefm2TF5wU1z_qDWXKCsTx-Qs0e7qQgojr7LTYdaLKXoo8ye4eSiixM/s320/TFS_TF31002Error_Reports.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5298897706716771154&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Have a nice TFS experience ;-)</description><link>http://emalvass.blogspot.com/2009/02/tfs-2008-tf31002-error-workaround.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYnNa_1VY1r4EJ2SpKdgWivQCjl6Q5CDcjVkIqJhefRCLn9JIY5N7QJ46AdISNoeRncldbMPSenjHS_uWmVuWZp9LWUDMm-WhLOk4r_Kktbou1A5tHUYNedSE5hSYiIwMbQt4u9rheWBI/s72-c/TFS_TF31002ErrorWindow.png" height="72" width="72"/><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3789506896506356310.post-2073192324323743402</guid><pubDate>Sun, 01 Feb 2009 11:24:00 +0000</pubDate><atom:updated>2009-02-05T12:37:03.638+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Setup</category><category domain="http://www.blogger.com/atom/ns#">Sql Server 2008</category><category domain="http://www.blogger.com/atom/ns#">TFS</category><category domain="http://www.blogger.com/atom/ns#">TFS2008</category><category domain="http://www.blogger.com/atom/ns#">Windows 2008</category><title>Installing TFS 2008. The final attempt!!!</title><description>&lt;span class=&quot;Apple-style-span&quot; style=&quot;;font-family:arial;font-size:13;&quot;  &gt;&lt;ul style=&quot;font-weight: bold;&quot;&gt;&lt;li&gt;Goal:&lt;/li&gt;&lt;/ul&gt;&lt;blockquote&gt;Scope of this post is the installation of TFS 2008 on Windows Server 2008 and SQL Server 2008. To accomplish this target, I explored varied posts in other blog. Here I put together all the know how as result of my personal experience...&lt;/blockquote&gt;&lt;ul&gt;&lt;li&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Before you begin, create your custom TFS iso:&lt;/span&gt;
&lt;/li&gt;&lt;/ul&gt;&lt;blockquote style=&quot;border-style: none; margin: 0px 0px 0px 40px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;&quot;&gt;From &lt;a href=&quot;http://geekswithblogs.net/etiennetremblay/archive/2008/08/11/sql-2008--tfs-2008-sp1-the-lowdownhellip.aspx&quot;&gt;http://geekswithblogs.net/etiennetremblay/archive/2008/08/11/sql-2008--tfs-2008-sp1-the-lowdownhellip.aspx&lt;/a&gt;
&lt;/blockquote&gt;&lt;p style=&quot;margin-left: 40px;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;[...I used Windows 2008 because this is going to be the prevalent OS to install on when people are going to start fresh or it most likely will.  There was a little issue with that install when Windows 2008 RTM’ed back in February and I talked about it in &lt;/span&gt;&lt;a href=&quot;http://geekswithblogs.net/etiennetremblay/archive/2008/02/05/windows-2008--tfs-2008-it-works-but.aspx&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;this post&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;.  I wanted to see if the WSS issue was resolved in SP1.  Well the good news is yes.  When installing TFS, the experience is now the same for Windows 2003 and Windows 2008 and to boot, the SP1 now updates the WSS bits on the RTM DVD to WSS 3.0 SP1.  Cool.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 40px;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;The problem is SQL 2008 now.  You can’t use TFS 2008 RTM to install with SQL 2008.  You need to slipstream (or Integrate) the SP on top of the RTM bits.  The new install instruction covers this but here is a step by step.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 40px;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;a) Copy the original Media to a folder on any machine say d:\tfs\RTM&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 40px;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;b) Extract the SP to a folder say d:\tfs\SPExtract&lt;/span&gt;&lt;/p&gt;&lt;blockquote style=&quot;margin-left: 40px;&quot;&gt;&lt;p&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;C:\SP1Download\TFS90SP1-KB949786-ENU /extract:d:\tfs\SP1Extract&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p style=&quot;margin-left: 40px;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;c) Create a directory to put the result of the integration in say d:\tfs\ATIntegrated&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 40px;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;d) Integrate (slipstream) the SP to the AT install by using this command line (note if you are in Windows 2008 make sure you start you console window as an Administrator or you’ll get prompted by UAC when executing the command).&lt;/span&gt;&lt;/p&gt;&lt;blockquote style=&quot;margin-left: 40px;&quot;&gt;&lt;p&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;msiexec /a C:\TFS\RTM\AT\vs_setup.msi /p C:\TFS\SP1Extract\TFS90sp1-KB949786.msp TARGETDIR=C:\TFS\ATIntegrated&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote style=&quot;margin-left: 40px;&quot;&gt;&lt;/blockquote&gt;&lt;p style=&quot;margin-left: 40px;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;e) Once you have done this make sure you copy back the ATIntegrated content to the original AT in the d:\TFS\RTM\AT overriding the original content. &lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 40px;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;Now you might be tempted to do the same integration with the Build and Proxy directory since they both have a vs_setup.msi file I know I was and actually did.  You can’t.  I works (well it looks like it does) but when you run the setup, it fails miserably.  This is documented by Microsoft to NOT do that for Build and Proxy.  You need to install the RTM version and then run the SP on top of it.  It would have been nice to have a new DVD with all component SP’ed but it’s not to be.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 40px;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;f) After you have copied back the content to the original RTM directory, just burn a new ISO or DVD and you’re ready to install it.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 40px;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;NOT QUITE…&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 40px;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;If you want to have Team Explorer (TE) on your server to create new project like I do, you need to install it BEFORE you install SQL 2008 and apply the TE SP1 also before IF you want to install the client tools as part of the SQL 2008 install which you most likely will to manage backups and verify tables, etc.  This problem is fully explained in this KB, &lt;/span&gt;&lt;a href=&quot;http://support.microsoft.com/kb/956139&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;Visual Studio 2008 SP1 may be required for SQL Server 2008 installations&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;. If you want to create an all in one server with Studio and Build for example you need to follow the same procedure. ...]
&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 40px;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 238); text-decoration: underline;&quot;&gt;
&lt;/span&gt;&lt;/p&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;ul&gt;&lt;li&gt;Account for the Setup:&lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;&lt;blockquote style=&quot;border-style: none; margin: 0px 0px 0px 40px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;From&lt;/span&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://blogs.devleap.com/rob/archive/2006/03/29/7048.aspx&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;http://blogs.devleap.com/rob/archive/2006/03/29/7048.aspx&lt;/span&gt;&lt;/a&gt;&lt;/span&gt; [Sorry, in Italian]

&lt;/blockquote&gt;&lt;div style=&quot;margin-left: 40px;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;[...Create 3 account&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; (the account name can be as you prefer...). If the installation server is in a domain the account must be domain account and obviously of the same domain:&lt;/span&gt;&lt;/div&gt;&lt;p style=&quot;margin-left: 40px;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;TFSSetup - used to do the TFS setup
Administrators Group
TFSService - used by the services (code coverage, TFSScheduler, SharePoint Timer), and by application pool
Lon On Locally - da Local Security Settings - Local Policies - User Rights Assignment -&gt; Allow log on locally
Not in Administrators group for security reason
If you are creating a domain account enable &quot;Account is sensitive and cannot be delegated&quot; for security reason
TFSReports - used by Reporting Services
Lon On Locally - da Local Security Settings - Local Policies - User Rights Assignment -&gt; Allow log on locally
Not in Administrators group for security reason

By default the created users are in Users group, so they have &quot;Log On Locally&quot; property set. ...]&lt;/span&gt;&lt;/p&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;ul&gt;&lt;li&gt;Be a man, now you are ready to start
&lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;&lt;blockquote style=&quot;border-style: none; margin: 0px 0px 0px 40px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;&quot;&gt;Always from &lt;a href=&quot;http://geekswithblogs.net/etiennetremblay/archive/2008/08/11/sql-2008--tfs-2008-sp1-the-lowdownhellip.aspx&quot;&gt;http://geekswithblogs.net/etiennetremblay/archive/2008/08/11/sql-2008--tfs-2008-sp1-the-lowdownhellip.aspx&lt;/a&gt; proceed as follows:
&lt;/blockquote&gt;&lt;p style=&quot;margin-left: 40px;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;[...&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 40px;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;i) Windows (2003/2008) + IIS&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 40px;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;ii) VSTS and/or TE 2008&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 40px;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;iii) SP1 of VSTS and/or TE (it’s the same one that installs for all version of VS/VS Core, you need to run it once for anything component you have installed)&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 40px;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;iv) SQL 2008 + Component like DB, RS, AS, Client Tools, etc (follow the install guide instructions, i&#39;ll try to post an unattended install file when I have one)&lt;/span&gt;&lt;/p&gt;&lt;blockquote style=&quot;border-style: none; margin: 0px 0px 0px 40px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;&quot;&gt;&lt;blockquote style=&quot;border-style: none; margin: 0px 0px 0px 40px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Integration: Set automatic startup ed start SQL Server Agent and SQL Server Browser&lt;/span&gt;
&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;p style=&quot;margin-left: 40px;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;v) TFS SP1 (integrated), this will now install WSS properly for both Windows 2003 and Windows 2008 so no need to install it before.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 40px;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;vi) TFS Build + TFS SP1 (which is a different SP then the VS one)
&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 40px;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;vii) TFS Proxy + TFS SP1  ...]&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 40px;&quot;&gt;viii) From &lt;a href=&quot;http://blogs.msdn.com/dstfs/archive/2008/10/23/my-experience-setting-up-tfs-windows-sever-sql-server-2008.aspx&quot;&gt;http://blogs.msdn.com/dstfs/archive/2008/10/23/my-experience-setting-up-tfs-windows-sever-sql-server-2008.aspx&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 40px;&quot;&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;[...&lt;/span&gt;&lt;span style=&quot;color: rgb(51, 51, 51); line-height: 15px;font-family:Verdana;font-size:12;&quot;  &gt;&lt;span style=&quot;font-style: italic;&quot;&gt;Add NT AUTHORITY\NETWORK SERVICE as a user to the TfsWarehouse database in the SQL Data Engine, and add it to the TfsWarehouseDataReader database role. You can do that manually, or through a SQL script like this (run it from a SQL Management Studio query when connected to the SQL Data Engine):&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;blockquote style=&quot;border-style: none; margin: 0px 0px 0px 40px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;&quot;&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-style: italic; line-height: 15px;font-family:Verdana;font-size:12;&quot;  &gt;USE TfsWarehouse &lt;/span&gt;
&lt;span style=&quot;color: rgb(51, 51, 51); font-style: italic; line-height: 15px;font-family:Verdana;font-size:12;&quot;  &gt;CREATE USER [NT AUTHORITY\NETWORK SERVICE] FOR LOGIN [NT AUTHORITY\NETWORK SERVICE] &lt;/span&gt;
&lt;span style=&quot;color: rgb(51, 51, 51); font-style: italic; line-height: 15px;font-family:Verdana;font-size:12;&quot;  &gt;EXEC sp_addrolemember N&#39;TfsWarehouseDataReader&#39;, N&#39;NT AUTHORITY\NETWORK SERVICE&#39; ...]

&lt;/span&gt;ix) Reinstall the VSTS2008 SP1 again...&lt;/blockquote&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;ul&gt;&lt;li&gt;Troubleshotting
&lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;&lt;blockquote style=&quot;border-style: none; margin: 0px 0px 0px 40px; padding: 0px;&quot;&gt;If during the TFS Setup you have problem with reporting service, check in Reporting Service Configuration that https mode is not set (Web Service URL and Report Manager URL sections).
&lt;/blockquote&gt;&lt;div&gt;&lt;p style=&quot;margin-left: 40px;&quot;&gt;In my experience I have setup problem with &quot;&lt;span style=&quot;font-weight: bold;&quot;&gt;28805 error&lt;/span&gt;&quot;. I hope you&#39;re more lucky, but in any case I found very useful the following links:&lt;/p&gt;&lt;ul style=&quot;margin-left: 40px;&quot;&gt;&lt;li&gt;&lt;a href=&quot;http://ozgrant.com/2007/05/13/tfs-installation-error-28805/&quot;&gt;TFS Installation Error 28805&lt;/a&gt; (&lt;a href=&quot;http://ozgrant.com/2007/05/13/tfs-installation-error-28805/&quot;&gt;http://ozgrant.com/2007/05/13/tfs-installation-error-28805/&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.jroller.com/page/wasp/?anchor=tfs_2008_and_event_log&quot; rel=&quot;bookmark&quot;&gt;TFS 2008 and Event Log error 28805 (&lt;/a&gt;&lt;a href=&quot;http://www.jroller.com/wasp/entry/tfs_2008_and_event_log&quot;&gt;http://www.jroller.com/wasp/entry/tfs_2008_and_event_log&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;a href=&quot;http://www.schnieds.com/2008/10/team-foundation-server-tfs-installation.html&quot;&gt;Team Foundation Server (TFS) Installation Errors &amp;amp; Fixes (&lt;/a&gt;&lt;a href=&quot;http://www.schnieds.com/2008/10/team-foundation-server-tfs-installation.html&quot;&gt;http://www.schnieds.com/2008/10/team-foundation-server-tfs-installation.html&lt;/a&gt;)&lt;/span&gt;&lt;/li&gt;&lt;div&gt;
&lt;/div&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/span&gt;</description><link>http://emalvass.blogspot.com/2009/02/install-tfs-2008-final-attempt.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item></channel></rss>