3 Replies Latest reply on Feb 16, 2017 5:58 AM by sclifford RSS
    sclifford Explorer

    How to delete a file from FileRepository in Java extension?

    I have a Java extension where I need to write a service that deletes a specified file from MyCustomFileRepository.

    But the DeleteFile method isn't available as part of the FileRepositoryThing class!

     

    @ThingworxServiceDefinition(name = "DeleteFile", description = "Deletes the specified file from the Healthband FileRepository entity.", category = "", isAllowOverride = false, aspects = {"isAsync:false" })
    @ThingworxServiceResult(name = "Result", description = "", baseType = "STRING", aspects = {})
    public String DeleteFile(
            @ThingworxServiceParameter(name = "filePath", description = "", baseType = "STRING", aspects = {"isRequired:true" }) String filePath) {
        final FileRepositoryThing repo = (FileRepositoryThing) ThingUtilities.findThing("MyCustomFileRepository");
    
        repo.DeleteFile(filePath);
    
        return "";
    }
    
    }