Our folder hierarchy is a bit odd, so the sub-folder an email exists in doesn't always have a unique name, especially for localized stuff, the folder names end up being "en-us" or "es-la", etc.

I already pull the full record into our database from FuelSDK.ET_Email() which gives me 'Folder', but that's just the name of the sub-folder the email lives in. Is there some way to extract the full path for each individual email?


The CategoryID commonly identifies the folder in which an SFMC API Object resides. DataFolder object contains the name of the folder.


| improve this answer | |

@adam-spriggs was correct above, but I just wanted to post this here in case anyone else is trying to do this.

You can traverse up the folder hierarchy using the Retrieve Folder method in the FuelSDK.

This was super quick to do in python, so here's the code.

Assume the var 'category' is the CategoryID of the folder you're trying to get the full path for. In my case this was returned from the Retrieve Emails method.

Here's the code:

import FuelSDK

myClient = FuelSDK.ET_Client()
f = FuelSDK.ET_Folder()
f.auth_stub = myClient
f.props = ['ParentFolder.ID', 'ID', 'Name']
f.search_filter = {'Property': 'ID', 'SimpleOperator': 'equals', 'Value': str(category)}

results = f.get()

path = results.results[0]['Name']

while results.results[0]['ParentFolder']['ID']:
    f.search_filter['Value'] = str(results.results[0]['ParentFolder']['ID'])
    results = f.get()
    path = results.results[0]['Name'] + '/' + path

print path
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.