title: Azure Functions : how to watch a Dropbox or OneDrive folder and sync a ftp location
body: <p>I need to get a Dropbox folder / one drive watch , and any file update or change gets FTP'd to output. To get familiar with I tried C# code shared by </p>
  
  <p>but I get the following error message :- <a href="https://stackoverflow.com/questions/38363965/process-a-file-using-azure-function">Process a file using Azure Function</a>
  ======Update C# code that I have used ======</p>
  
  <p>My run.csx is as below:
  using System;</p>
  
  <pre><code>public static void Run(string input, out string output, TraceWriter log)
  {
      log.Info($"C# SaaS trigger function processed a file!!");
  
  output = input;
  }
  </code></pre>
  
  <p>==========================</p>
  
  <p>My function.json is as below :</p>
  
  <pre><code>{
    "bindings": [
  {
    "type": "apiHubFileTrigger",
    "name": "input",
    "direction": "in",
    "path": "/Docs/{name}",
    "connection": "dropbox_DROPBOX"
  },
  {
    "type": "apiHubFile",
    "name": "output",
    "direction": "out",
    "path": "{name}",
    "connection": "googledrive_GOOGLEDRIVE"
  }
    ],
  "disabled": false
      }
  </code></pre>
  
  <p>where paths are modified because I was getting the below error:</p>
  
  <blockquote>
    <p>Host Error: Microsoft.Azure.WebJobs.Extensions.ApiHub: Path 'input-cs' is invalid. IFolderItem.RootPath must be set to a valid directory location.</p>
  </blockquote>
  
  <p>I played around, and removed the 'input-cs' and 'output-cs' in my function.json above,the above error goes away and compilation is succeeding but again in logs I dont find it proper. Log is as below:</p>
  
  <blockquote>
    <p>2016-07-25T12:52:07.957 Script for function 'SaasFileTriggerCSharp1' changed. Reloading.</p>
    
    <p>2016-07-25T12:52:07.957 Compiling function script.</p>
    
    <p>2016-07-25T12:52:08.020 Compilation succeeded.</p>
    
    <p>2016-07-25T12:52:29.137 Exception while executing function: Functions.SaasFileTriggerCSharp1. Microsoft.Azure.WebJobs.Host: One or more errors occurred. Exception binding parameter 'input'. Microsoft.Azure.ApiHub.Sdk: /apim/dropbox/8b82684e13e44f499752a742adc4d30d/datasets/default/GetFileContentByPath?path=%7B%0A%20%20%20%20%22name%22:%20%22IMG-20140517-WA0001.jpg%22%0A%7D.</p>
  </blockquote>
  
  <p>Tried with C# and Node.js Saasfiletriggers and same exception. Below are the invocation log:</p>
  
  <p>====================================================================
  <strong>Failure: Exception binding parameter 'input'</strong></p>
  
  <p><strong>input : /apim/dropbox/8b82684e13e44f499752a742adc4d30d/datasets/default/GetFileContentByPath?path=%7B%0A%20%22name%22%20:%20%22%22%0A%7D</strong></p>
  
  <blockquote>
    <p>ilerServices.TaskAwaiter.ValidateEnd(Task task)
       at Microsoft.Azure.WebJobs.Extensions.ApiHub.Common.GenericFileBinding<code>2.&lt;BindAsync&gt;d__11.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.Azure.WebJobs.Extensions.ApiHub.Common.GenericFileTriggerBindingProvider</code>2.GenericTriggerbinding.d__9.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.Azure.WebJobs.Host.Triggers.TriggeredFunctionBinding`1.d__7.MoveNext()
       --- End of inner exception stack trace ---
       at Microsoft.Azure.WebJobs.Host.Executors.DelayedException.Throw()
       at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__33.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__2e.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
       at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__15.MoveNext()
       --- End of inner exception stack trace ---</p>
  </blockquote>
  
  <p>====================================================================</p>
  
  <p>Would there be any samples I could read or refer to adapt for my needs. Request suggestions and help.</p>