title: Why do i get E_ACCESSDENIED when reading public shortcuts through Shell32?
body: <p>I'm trying to read the targets of all desktop shortcuts in a C# 4 application. The shortcuts on a windows desktop can come from more that one location, depending on whether the shortcut is created for all users or just the current user. In this specific case I'm trying to read a shortcut from the public desktop, e.g. from C:\Users\Public\Desktop\shortcut.lnk.</p>
  
  <p>The code is like this (path is a string contaning the path to the lnk file):</p>
  
  <pre><code>var shell = new Shell32.ShellClass();
  var folder = shell.NameSpace(Path.GetDirectoryName(path));
  var folderItem = folder.ParseName(Path.GetFileName(path));
  if (folderItem != null)
  {
      var link = (Shell32.ShellLinkObject)folderItem.GetLink;
  </code></pre>
  
  <p>The last line throws an System.UnauthorizedAccessException, indicating that it's not allowed to read the shortcut file's contents. I have tried on shortcut files on the user's private desktop (c:\Users\username\Desktop) and that works fine.</p>
  
  <p>So, my questions are: </p>
  
  <p>(1) why is my application not allowed to /read/ the shortcut from code, when I can clearly read the contents as a user? </p>
  
  <p>(2) is there a way to get around this? Maybe using a special manifest file for the application? </p>
  
  <p>And, by the way, my OS is Windows 7, 64-bit.</p>
  
  <p>be well</p>
  
  <p>-h-</p>