simple-odata-client / Simple.OData.Client

MIT License
330 stars 196 forks source link

Calling multiple functions/actions chained #718

Open saarivirtajCGI opened 4 years ago

saarivirtajCGI commented 4 years ago

Is this kind of syntax supported? I couldn't really figure out how to write this out in code.

The URL I'm looking for:

POST
https://localhost/sites/mysite/_api/Web/GetFileByServerRelativeUrl('/sites/mysite/Jaetut%20asiakirjat/10/file.zip')/MoveTo(newUrl='/sites/mysite/Jaetut%20asiakirjat/10/archived/file.zip',flags=1)

The REST call works just fine, but I have no idea how to turn this into code that produces the same call.

The GetFileByServerRelativeUrl and MoveTo are FunctionImports:

<FunctionImport Name="GetFileByServerRelativeUrl" ReturnType="SP.File" IsBindable="true" EntitySet="Files12">
   <Parameter Name="this" Type="SP.RemoteWeb" />
   <Parameter Name="serverRelativeFileUrl" Type="Edm.String" />
</FunctionImport>

<FunctionImport Name="MoveTo" IsBindable="true">
   <Parameter Name="this" Type="SP.File" />
   <Parameter Name="newUrl" Type="Edm.String" />
   <Parameter Name="flags" Type="Edm.Int32" Nullable="false" />
</FunctionImport>

Is this kind of chaining of functions/actions supported?

lscorcia commented 3 years ago

Were you able to invoke chained functions? I'm trying to work with Sharepoint data model too and I'm facing the same issue with a call to _api/Lists/getbytitle('list title')/fields/getbytitle('field internal name')?$select=SspId,TermSetId.