Search code examples
azureazure-data-factorycustom-activity

Get the filename with complete path on Azure Data Factory


I'm implementing IDotNetActivity while working on CustomActivity.

I want to read a file name that exists on input dataset at folder path adftutorial/customactivityinput/abc.txt, update some text and finally copy the result at output dataset adftutorial/customactivityoutput/xyz.txt.

while reading file abc.txt I'm getting System.IO.FileNotFoundException occurred in MyDotNetActivity.dll.

I'm looking help on some method which could give me complete path like <AzureCloutDirectory> + filename.

Please advise what is the best approach or the way to load text file.

Thank you!


Solution

  • You should give some more information (code) how do you access to the blob/blob information you need.

    I can tell you that when you get blobs with BlobResultSegment blobList = inputClient.ListBlobsSegmented(...) method and iterate each one with:

            foreach (IListBlobItem listBlobItem in blobResult.Results)
            {
                var cloudBlockBlob = listBlobItem as CloudBlockBlob;
                ... // Your code here
            }
    

    you can access complete path + filename with

    cloudBlockBlob.Uri.AbsoluteUri property

    == "AzureCloudDirectory/ContainerName/yourFile.txt"

    Kind regards!