title: Detect file delete changes with TFS API (automated, without VS interaction)
body: <p>I have a local folder within the tfs workspace and use the TFS-API.</p>
  
  <p>Every night i do delete this folder and and after that script a database as .sql files.
  If now something was added or edited, the changes will be found and get into the pending changes to checkin.</p>
  
  <p>The question is how i can detect with the TFS-API that a file is missing (intentionally, because no longer in database and becaus of that no longer scripted).
  The first step is obvious, delete all files and script all in the empty folder.</p>
  
  <p>I use workspace.PendEdit at the beginning which makes me able to override the files from external.
  After the scripting of database is done, i will do a workspace.PendEdit and workspace.PendAdd.</p>
  
  <p>This works as expected. But workspace.PendDelete does not find deleted files, and therefore cannot adding theses as deleted to the pending changes.</p>
  
  <p>There is a commeandline tool from power tools for tfs which has a online flag which should do that, what i wan.</p>
  
  <p>My Question: is it possible to do, what i described with the tfs-api?
  If this wont working, has anybody expierence with this online-flag?</p>
  
  <hr>
  
  <h2>Simple Example</h2>
  
  <p>I have two files in a local folder: 1.sql and 2.sql
  These two files are checked in initially.</p>
  
  <p>I delete 2.sql local (without knowledge of tfs)
  I add one file: 3.sql
  I edit 1. sql</p>
  
  <p>Now, i use workspace.PendEdit and workspace PendAdd to detect edited and added files. These files will be detected just fine.</p>
  
  <p>And here is the problem: the deletion oder the missing of 2.sql will not be detected and therefore cannot be deleted on the server.</p>
  
  <p>So: how to detect missing files / locally deleted files without knowledge of tfs?</p>
  
  <p>I hope this clarifies my question.</p>
  
  <p>Pseudo code example:</p>
  
  <pre><code>DeleteWorkspaceFolderContent(); // Because i do not delete but regenerate my Sql scripts.
  GenerateSqlScriptsToWorkspaceFolder(); // .sql files are generated to the same folder, they were deleted before
  </code></pre>
  
  <p>// Now at this point, i did <code>workspace.PendAdd(localPath, true);</code> and <code>workspace.PendEdit(localPath, RecursionType.Full);</code> which worked like a sharm, so new .sql files will be pended for adding and edited (real changed scripts) pended for "change-Checkin".</p>
  
  <p>// At this point i tought <code>workspace.PendDelete(new [] { localPath }, RecurstionType.Fulll);</code> does the same: Seeing that a file is locally missing and then pend this files for deletion on the server. But this does not happen. No pending changes are added.</p>
  
  <pre><code>var pendingChanges = workspace.GetPendingChanges(localPath, RecursionType.Full);
  
  workspace.CheckIn(pendingChanges, "Per TFS-API, " + DateTime.Now.ToString());
  </code></pre>