title: Create a filter query for Microsoft Graph that works equivalent to "contains"
body: <p>I need to create a <code>$filter</code> query for the <em>Microsoft Graph API</em> that searches for a specific word in a string (the display name of users).</p>
  
  <p>For example I'd want to be able to find all users that have <em>"Esteban"</em> in their names:</p>
  
  <blockquote>
    <p>Luis Esteban<br>
    Alphonse Esteban<br>
    Esteban Luis<br>
    Alphonse Esteban Luis<br></p>
  </blockquote>
  
  <p>The following query works, but only returns users that start with <em>"Esteban"</em> in their names, not users that contain <em>"Esteban"</em>:</p>
  
  <pre><code>https://graph.microsoft.com/v1.0/users?$filter=startswith(displayName,'Esteban')
  </code></pre>
  
  <p>I also tried using <code>contains</code> instead of <code>startswith</code>, but it gives an error response:</p>
  
  <blockquote>
    <p>{ "error": { "code": "Request_BadRequest", "message": "An unknown function with name 'contains' was found. This may also be a key lookup on a navigation property, which is not allowed.", "innerError": { "request-id": "e5ed5c30-4e62-4497-8976-1d38167e759d", "date": "2018-09-13T23:17:17" } } }</p>
  </blockquote>
  
  <p>And even though the <a href="https://developer.microsoft.com/en-us/graph/docs/concepts/query_parameters" rel="noreferrer">Microsoft Graph docs</a> say they support <em>OData 4.0</em>, they also say this:</p>
  
  <blockquote>
    <p>"The contains string operator is currently not supported on any Microsoft Graph resources." </p>
  </blockquote>
  
  <p>I also tried other commands given by the <a href="http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part2-url-conventions/odata-v4.0-errata03-os-part2-url-conventions-complete.html#_Toc453752358" rel="noreferrer">OData documentation</a> and the <a href="http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/abnf/odata-abnf-construction-rules.txt" rel="noreferrer">construction rules</a> that are supposed to be supported by <code>filter</code> and other query parameters.</p>
  
  <p>In particular I tried combinations of these commands:</p>
  
  <blockquote>
    <p>startswith<br>
    endswith<br>
    indexof<br>
    substring<br></p>
  </blockquote>
  
  <p>but to no success. It seems the <em>MS Graph API</em> has no support for anything except <code>startswith</code> whatsoever.</p>
  
  <p>I tried both v1.0 and the beta endpoints of the API.</p>
  
  <p><strong>Is there any other way, some smart combination of <em>OData 4.0</em> commands and/or query parameters supported by the <em>MS Graph API</em>, that allows a search equivalent to <code>contains</code>?</strong></p>
  
  <p><em>PS: You can try out queries with the Graph Explorer <a href="https://developer.microsoft.com/en-us/graph/graph-explorer?request=users?$filter=startswith(givenName,%27J%27)&amp;method=GET&amp;version=v1.0" rel="noreferrer">here</a>.</em></p>