title: Using SFTP File Name in Logic Apps
body: <p>I have a simple Logic App that uses a SFTP connector, followed by a condition with an expression that states:</p>
  
  <pre><code>Object Name: File Name
  Relationship: starts with
  Value: '943'
  </code></pre>
  
  <p>The expression ends up being:</p>
  
  <pre><code>"@startsWith(triggerOutputs()['headers']['x-ms-file-name'], '''943''')"
  </code></pre>
  
  <p>But the condition always fails even when the file starts with 943.</p>
  
  <p>When trying to debug this I decided to write the "file name" property to the body of a Service Bus Queue and then read it from a simple Windows app. When getting the body as a string, it always threw an exception. I had to rewrite it to use a stream to read it.</p>
  
  <p>Failed Code:</p>
  
  <pre><code>Dim s as String = message.GetBody(of String)()
  </code></pre>
  
  <p>Working Code:</p>
  
  <pre><code> Dim stream As Stream = message.GetBody(Of Stream)()
   Dim reader As StreamReader = New StreamReader(stream)
   Dim s As String = reader.ReadToEnd
  </code></pre>
  
  <p>Does this mean "file name" is not a string but something else like a byte array?  How do I get my condition in my Logic App to work properly?</p>