Pin lnk file to win 7 Taskbar using C#
<p>Even the programmatic pinning of icons in Win7 seems it's not permitted (like it says here: <a href="http://msdn.microsoft.com/en-us/library/dd378460(v=VS.85).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/dd378460(v=VS.85).aspx</a>), there are some methods for doing this by some VB scripts. Someone found a way of doing this in C# like this:</p>

<pre><code>private static void PinUnpinTaskBar(string filePath, bool pin)
{
 if (!File.Exists(filePath)) throw new FileNotFoundException(filePath);

 // create the shell application object
 dynamic shellApplication = Activator.CreateInstance(Type.GetTypeFromProgID("Shell.Application"));

 string path = Path.GetDirectoryName(filePath);
 string fileName = Path.GetFileName(filePath);

 dynamic directory = shellApplication.NameSpace(path);
 dynamic link = directory.ParseName(fileName);

 dynamic verbs = link.Verbs();
 for (int i = 0; i &lt; verbs.Count(); i++)
    {
        dynamic verb = verbs.Item(i);
        string verbName = verb.Name.Replace(@"&amp;", string.Empty).ToLower();

        if ((pin &amp;&amp; verbName.Equals("pin to taskbar")) || (!pin &amp;&amp; verbName.Equals("unpin from taskbar")))
        {

            verb.DoIt();
        }
    }

    shellApplication = null;
}
</code></pre>

<p>As can be seen, the code makes use of .NET Framework 4.0 features. The question I want to ask is: can this function be transformed so it would make the same thing, but using just 3.5 Framework? Any ideas? 
Thank you!</p>
