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.

1 Answer 1

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
}
4
  • 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. Feb 11, 2015 at 14:04
  • Thanks for the feedback. I will adapt my code (and answer) accordingly Feb 11, 2015 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. Apr 15, 2016 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? Feb 24, 2017 at 22:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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