Let's take a look at the following steps to create the function code:
- In the project tree, browse to the ScoreDocument.cs file.
- Let's replace the generated code with the following code.
The following function code assumes that the uploaded file is a text file that can be processed using StreamReader. Upon execution, the file content will be stored in the blobContent variable, while the file name will be stored in the name parameter. (The code is kept short for clarity. In production code, we would also need to perform input validation).
The code is as follows:
public static class ScoreDocument { [FunctionName("ScoreDocument")] public static async Task Run( [BlobTrigger("documents/{name}", Connection = "blobStorageConnection")] ...