How to get the parent folder of a new list item?


Badge +2

Hi all,

Does anyone know how to get the parent folder (name) of a list item on create?  I have a challenge where I have a single list with 10 folders (using for security), and everytime a user creates a new list item, I want to automatically populate a metadata fields with the name of the parent folder.   In a document library I could use column default values, but I can't in a list.

Thanks for any help!

Cheers,

Troy


2 replies

Userlevel 3
Badge +9

You have the name of the folder in the url of the item.  You can pull it from there.  I'm curious though, why do you want to populate the name of a folder as metadata for an item?  And what do you mean you can't use default values in a list?

Badge +2

Thanks Brendan.  I was trying to use the URL fields available and didn't realize I could use the Absolute Encoded URL (this is the only URL that has the folder path).  So thanks for pointing me in the write direction!

Cheers,

Troy

Reply