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

How to delete a file from FileRepository in Java extension?

SOLVED
Highlighted
Newbie

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

}

}


Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: How to delete a file from FileRepository in Java extension?

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
Highlighted

Re: How to delete a file from FileRepository in Java extension?

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

Highlighted

Re: How to delete a file from FileRepository in Java extension?

Hello Jakub,

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

Thanks,

Shane

Highlighted

Re: How to delete a file from FileRepository in Java extension?

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

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum!