How to create IVersionablehandle in server side
Accepted answer
Hello
To get a handle for an
IFileItem
from its
fileName
, you can use the repository to find the
IFileItem
and then convert it to an
IFileItemHandle
. Here's an example:
IFileItem fileItem = getFileItemByName(fileName); if (fileItem != null) { IFileItemHandle handle = fileItem.getItemHandle(); // Now you can use the handle }
Ensure proper error handling if the file item isn't found. Let me know if you need further help!
One other answer
An IFileItem extends IVersionable, which in turn extends IVersionableHandle.
So if you are saying in your code you have an IFileItem, then you already have the IVersionableHandle.
Or are you saying you only have a String, which represents the name of some file, in which case there's no easy solution, as there could be all sorts of different files in the DB with the same string name.