3

In our custom ECL extension, we ran into the following problem. We created an ECL extension that allowed us to browse folders and files in an external system.

The folders and subfolders are showing up fine, and files can also be opened correctly. However, we did notice that the files were also appearing in the tree in the Content Manager Explorer, and were also expandable.

When expanding these items, strangely enough, we would see a list of our publications (see screenshot).

ECL file items also expanding

Our ECL extension was based on one of the example implementations we found, but t here, this problem would not occur.

5

After some debugging, we found the cause of this problem. In our ECL extension, we have to implement the function

public IFolderContent GetFolderContent(IEclUri parentFolderUri, int pageIndex, EclItemTypes itemTypes)
{
  //implementation here
}

The key to the solution is the itemTypes parameter

This ItemTypes parameter contains a list of itemType Enums that you should return. Usually, this is "Mountpoint and Folder" or "Folder and "File". In our initial implementation, we would always return a set of folders, subfolders and files. However, we had to implement the following logic :

//UPDATED code after comment
if (itemTypes.HasFlag(EclItemTypes.File) && itemTypes.HasFlag(EclItemTypes.Folder))
{
   //return both (sub)folders and files. 
}
else if(itemTypes.HasFlag(EclItemTypes.Folder))
{
   //only return (sub)folders
}
| improve this answer | |
  • 3
    While this seems to work, it is not the correct behavior. The ItemTypes parameter is a flag. If EclItemTypes.File is set, return the files. If EclItemTypes.Folders is set, return the folders. If both are set, return both. – Lars Møllebjerg Feb 11 '15 at 14:04
  • Thanks for the feedback. I will adapt my code (and answer) accordingly – Harald Hoffelinck Feb 11 '15 at 14:19
  • Hmm, I should have spotted this earlier, but it is still wrong. EclItemTypes is a flag. You need to support all three possible values (well, technically speaking four). You only support two. – Lars Møllebjerg Apr 15 '16 at 8:20
  • I seem to have the similar issue but in my case while clicking on the file type in tree, the debugger does not go to the GetFolderContent(). any thoughts? – Vikas Kumar Feb 24 '17 at 22:23

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.