ConnectorTriggerPayload.ReadBinaryContentAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Reads a binary-content trigger callback (for example OneDrive OnNewFileV2) from a stream,
whose wire shape is {"body":"<base64>"}, into the decoded file bytes.
public static System.Threading.Tasks.ValueTask<byte[]?> ReadBinaryContentAsync(System.IO.Stream body, long maxBodySizeBytes = 104857600, System.Threading.CancellationToken cancellationToken = default);
static member ReadBinaryContentAsync : System.IO.Stream * int64 * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<byte[]>
Public Shared Function ReadBinaryContentAsync (body As Stream, Optional maxBodySizeBytes As Long = 104857600, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Byte())
Parameters
- body
- Stream
The callback body stream (for example HttpRequestData.Body). The stream is read but not disposed; the caller retains ownership.
- maxBodySizeBytes
- Int64
The maximum number of bytes to read from body before failing.
Defaults to DefaultMaxBodySizeBytes.
- cancellationToken
- CancellationToken
The cancellation token.
Returns
The decoded file bytes, or null when the body was not a JSON string body
(for example a metadata callback) or was not valid base64.
Exceptions
body is null.
maxBodySizeBytes is not greater than zero, or exceeds MaxLength.
Because the decoded bytes are buffered into a single array, the limit cannot exceed the maximum array length.
body exceeded maxBodySizeBytes.