There is a flues in EPiServer Form which all uploaded file can be indexed. To exclude uploaded file using EPiServer Form -> FileUploadElementBlock from EPiServer Find indexer you can go:

    [ModuleDependency(typeof(InitializationModule))]
    public class EPiServerFindInitialization : IInitializableModule
    {
        public void Initialize(InitializationEngine context)
        {
            ContentIndexer.Instance.Conventions.ForInstancesOf().ShouldIndex(ShouldIndexDocument);
        }

        public void Uninitialize(InitializationEngine context)
        {
        }

        bool ShouldIndexDocument(DocumentFileBase documentFileBase)
        {
            if (contentAssetHelper.Service.GetAssetOwner(documentFileBase.ContentLink) is FileUploadElementBlock)
            {
                IEnumerable result;
                ContentIndexer.Instance.TryDelete(documentFileBase, out result);

                return false;
            }

            return true;
        }

        readonly Injected contentAssetHelper;
    }

2 thoughts on “To exclude uploaded EPiServer Form file uploaded (FileUploadElementBlock) from EPiServer Find Index

  1. Hi Aria, we are trying to exclude form documents from Find as you have shown. We just do not understand where can we find declaration for DocumentFileBase. Can you kindly help us?

    1. Hi jorma.. I will look for sample code as this is for long time ago .. bare with me ..

Leave a Reply

Your email address will not be published. Required fields are marked *