Try our conversational search powered by Generative AI!

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


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!

Apr 20, 2018 16:14

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 

Edited, Apr 20, 2018 16:50

What kind of files?

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

Apr 20, 2018 17:03

Yes, that works :) Thanks...

file1.RouteSegment = somename + extension;

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.