Skip to main content
1-Visitor
January 30, 2017
Solved

How to delete a file from FileRepository in Java extension?

  • January 30, 2017
  • 1 reply
  • 3257 views

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 "";

}

}


Best answer by jkaczynski

Hello Shane Clifford​,

Please let us know, what version of Thingworx Extension SDK do you use? I've just tested it on 7.0 and it's working fine.

Regards,

J.

1 reply

1-Visitor
January 30, 2017

Hello Shane Clifford​,

Please let us know, what version of Thingworx Extension SDK do you use? I've just tested it on 7.0 and it's working fine.

Regards,

J.

sclifford1-VisitorAuthor
1-Visitor
January 30, 2017

Hello Jakub,

I'm developing for 6.6.0 instances, so using 6.6.0 Thingworx Extension SDK.

Thanks,

Shane