How to programatically change the property "Name in URL" for a file?

Vote:
 

I would like to programatically change the property "Name in URL" for files. I have a situation where you manually can name the files regardless of what the original filename is (via a form). The first name given to the file becomes the name in the url. If I update/change the filename I would also like to change the URL. Can't seem to find the propertyname for this though. Thankful for help!

#191130
Apr 20, 2018 16:14
Vote:
 

I'm pretty sure you can just cast a variable as your page and create a writeableclone from that and then access page variables such as url, then save to ContentRepository

Edit: oops i thought you were editing pages 

#191135
Edited, Apr 20, 2018 16:50
Vote:
 

What kind of files?

"Name in URL" maps to the RouteSegment property normally.

#191137
Apr 20, 2018 17:03
Vote:
 

Yes, that works :) Thanks...

file1.RouteSegment = somename + extension;

#191161
Edited, Apr 23, 2018 8:22
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.