How do I get a media path location? E.g.
Folder > Folder > Folder > Image.png
The backoffice folder structure path, not the physical path.
Litium version: 6.2.2
How do I get a media path location? E.g.
Folder > Folder > Folder > Image.png
The backoffice folder structure path, not the physical path.
Litium version: 6.2.2
Since I havent found it in media module the only way i have been able to get it is by making an export from product module of product with connected images.
Use the FolderService to get all ancestors’ system id:
var systemIds = new List<Guid>();
if (folder.SystemId == Guid.Empty)
{
return systemIds;
}
while (folder != null && folder.ParentFolderSystemId != Guid.Empty)
{
systemIds.Add(folder.ParentFolderSystemId);
folder = _folderService.Get(folder.ParentFolderSystemId);
}
// add RootId to the end
systemIds.Add(Guid.Empty);
return systemIds;
Then use FolderService.Get(systemIds) to get the list of folders, get their names then you have the full path.
Thanks!