Show / Hide Table of Contents

    How to do explicit document locks

    There is an extension method available to do explicit locking.
    Try to call the lock in a using to ensure the lock gets removed in any case.

    Note

    There is only an async lock method available

    public static async Task<Section> DoOperationWithDocumentUsingExplicitLock(Document document)
    {
        string clientIdentifier = "SampleDocumentLockApplication";
    
        DocumentLock customLock = await document.LockAsync((exception) =>
        {
            //Do more useful error handling in production!
            Console.WriteLine(exception.Message);
    
        }, clientIdentifier, 60);
    
        //during dispose the document lock will get freed
        using (customLock)
        {
            //Do something with your document, e.g. Add another page to it
            return await document.EasyUploadFileAsync(new FileInfo("Invoice2ndPage.pdf"));
        }
    }
    
    About Us Contact Imprint Terms Data privacy
    © 2024 DocuWare Corporation powered by DocFX Back to top