How to create IVersionablehandle in server side
![](http://jazz.net/_images/myphoto/65826afec55ecceefe2f1726e411fb80.jpg)
Accepted answer
![](http://jazz.net/_images/myphoto/65826afec55ecceefe2f1726e411fb80.jpg)
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
![](http://jazz.net/_images/myphoto/65826afec55ecceefe2f1726e411fb80.jpg)
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.
Comments
![](http://jazz.net/_images/myphoto/65826afec55ecceefe2f1726e411fb80.jpg)
Actually I want to update a file(next version )that was already in source control how to do that in server side
![](http://jazz.net/_images/myphoto/65826afec55ecceefe2f1726e411fb80.jpg)
I also have IFolderHandle
![](http://jazz.net/_images/myphoto/313b3ca11558f1740206a71ed27e6691.jpg)
I want to re-emphasize that doing anything based on only a 'file name' is very error prone. There could be multiple different files with the same file name, and also such an approach likely breaks down if the file gets renamed (meaning it could have different names in different streams/branches).
It's really not clear what information you have, and the details of the use case / workflow.
If you are on EWM 7.0.3, you could try looking at IScmQueryService.searchFiles() to see if that helps with your use case.