4

I have a structure in which we have a field defined as "File" data type. The requirement is to point this to a specific location within "Media Library". We have done this by specifying guid of the folder in source. I have tried path as well instead of guid.

(Using Content Editor) When I create an instance of the template and click on "Open file" link to select a file. I get "Browse" and "Search" option. File selection works fine when I use Browse tab. When I use "Search" tab to select a file I get "The media item could not be found" error (screenshot below).

![The media item could not be found - screenshot]1

I could not find anything in the logs either to help debug. Has anyone faced this issue?

Update: I forgot to mention that selection of search works fine when the source is not specified.

  • The File field is an internal Sitecore field type. Sitecore recommends the "Image" field type even for PDF documents. That field will also allow you to search from your root. Depending on your needs, you could also use the "General Link with Search" field type. – maz Nov 14 '17 at 15:58
  • Thanks, @maz. File field is among the Simple Types and I doubt if Image will serve the purpose. So, I tried Image type and selecting PDF, I get "The selected item does not contain an image". I forgot to mention that selection from search works fine when the source is not specified. – Ramesh Nov 14 '17 at 16:27
  • I would try the General Link with Search. I think the File field type is leveraged by the rich text control and probably should be avoided. Sitecore seriously needs to work on its data architecture documentation. – maz Nov 14 '17 at 18:30
  • We tried General Link with Search, the challenge is that it has additional links on the field which are not applicable requiring customization to hide them. Appreciate your help @maz – Ramesh Nov 15 '17 at 3:18
  • which version of Sitecore are you using? – Ankit Joshi Dec 4 '17 at 10:56
0

We logged a ticket with Sitecore for this and they acknowledged and provided a patch to resolve the error. After the patch, selecting a file from search results works fine if the item belongs to the location defined in "source". You will get the same error when a file outside of "source" location is selected. Sitecore support suggested that we implement code at our end to restrict the search to the "source" location as opposed to showing the content from the entire site.

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.