title: TFS PendEdit results in TF14098 : Access Denied
body: <p>I like to checkout a file trough C# code, but I always get a TF14098 Acess Denied Exception. The TFS Administrator reassures, that I have checkout/edit permissions and in VisualStudio and with tf.exe I do not have any problems to checkout the file.</p>
  
  <p>This is my current C# code:</p>
  
  <pre><code>            const string tfsServer = @"http://MyServer:8080/tfs";
          const string fileName = @"$/MyFile.xaml";
          const string workspaceName = "MyWorkspace";
  
          using (TfsTeamProjectCollection tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(tfsServer)))        
          {               
              if (tfs != null)
              {
                  WorkspaceInfo workspaceInfo = Workstation.Current.GetLocalWorkspaceInfo(fileName);
                  if (null != workspaceInfo)
                  {
                      var vcs = tfs.GetService&lt;VersionControlServer&gt;();   
                      Workspace workspace = workspaceInfo.GetWorkspace(tfs);                                  
                      if(workspace == null){
  
                          workspace = vcs.GetWorkspace(workspaceName, vcs.AuthorizedUser);
                      }                   
  
                      vcs.NonFatalError +=    VersionControlOnNonFatalError;
                      vcs.Getting += OnGetting;
                      vcs.BeforeCheckinPendingChange += OnBeforeCheckinPendingChange;
                      vcs.NewPendingChange += OnNewPendingChange;
  
                      if (workspace != null)
                      {
                          workspace.PendEdit(fileName);
                      }                       
                  }
              }
          }
  </code></pre>
  
  <p>It results always with:</p>
  
  <blockquote>
    <p>Non-fatal failure: TF14098: Access Denied: User Me needs PendChange permission(s) for $/MyFile.xaml.</p>
  </blockquote>
  
  <p>After a lot of research for this error I tryed to check the permissions trough Dos-Box and I did the following commandline:</p>
  
  <pre><code>tf checkout $/MyFile.xaml
  </code></pre>
  
  <p>it results in a Checkout of the file without any problem! (If I am in the directory where the file resists)</p>
  
  <p>Has anyone a Idea what the problem may be? What's the difference between my code (my Application written and executed with VisualStudio2012) and the commandline tf checkout?</p>
  
  <p>Thanks for tips and hints!
  Patrik</p>