Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • SteveV 56 posts 242 karma points
    Nov 17, 2022 @ 13:51
    SteveV
    0

    How to add and use another AzureBlobFileSystem?

    I'm creating a custom Workflow in Umbraco Forms 10 where I create a PDF file and send it via email. I would also like to keep a backup in our Azure Blob storage account in a private container (outside of Umbraco media).

    In Umbraco 7 I could easily add a new filesystem in FilesystemsProvider.config but I have some trouble with Umbraco 10.

    I found a function AddAzureBlobFileSystem(string name) in https://github.com/umbraco/Umbraco.StorageProviders#usage-2 that might be useful:

    Here's my Startup.cs:

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddUmbraco(_env, _config)
            .AddBackOffice()
            .AddWebsite()
            .AddComposers()
            .AddAzureBlobMediaFileSystem()
            .AddAzureBlobFileSystem("Enrollments") // <------
            .Build();
    }
    

    How do I retrieve this new filesystem in my workflow? I tried using IAzureBlobFileSystemProvider in the constructor, but it contains only the Media filesystem.

    public class PdfWorkflow : WorkflowType
    {
        private readonly IAzureBlobFileSystem _blobFileSystem;
    
        public PdfWorkflow(IAzureBlobFileSystemProvider provider)
        {
            _blobFileSystem = provider.GetFileSystem("Enrollments");
        }
    }
    

    Only 1 provider

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies