cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

How to delete a file from FileRepository in Java extension?

sclifford
1-Visitor

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

}

}


ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

3 REPLIES 3

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.

Hello Jakub,

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

Thanks,

Shane

Yes, tested and confirmed FileDelete method is present in the ThingWorx Extension SDK 7.2.3 version of FileRepository class. Marking your answer as correct Jakub, thank you.

Announcements


Top Tags