Query Subfolder

Forums vLooup for SharePoint Query Subfolder

Viewing 6 reply threads
  • Author
    Posts
    • #18376
      Michael
      Participant

      Hi,
      i’m not sure what exactly i’m doing wrong.

      I just want to Show items from a specific Folder, so i use the following query:

      <Query><Where><IsNotNull><FieldRef Name=’ID’ /></IsNotNull></Where></Query><QueryOptions><Folder>myLib/CustomFolder</Folder></QueryOptions>

      When i use this query e.g. in the query builder tool, i only recieve the Contents of this Folder. When i add it to the vlookup query configuration, all items / Folders in the library are shown.

      Can you please give me a hint what i’m doing wrong?!

      Regards,
      Michael

    • #18400
      Alexander Bautz
      Keymaster

      Hi,
      Based on the CAML syntax you are not doing anything wrong, but unfortunately I haven’t added support for specifying the QueryOptions like this in the vLookup setup.

      I’ll see what I can do about it in the next release.

      Alexander

    • #18402
      Alexander Bautz
      Keymaster

      I did another test and found that you can use this in the “Write your own CAML-query” field:

      <Where><Eq><FieldRef Name='FileRef' /><Value Type='Text'>SITE_URL/DOC_LIB/SUBFOLDER</Value></Eq></Where>

      Alexander

    • #19195
      Ivan Wilson
      Participant

      I’ve been able to use this CAML query to display a specific subfolder in a library in SharePoint Online.

      Ideally I would like to show the contents of this folder expanded by default. How would I automate an onClick event? This would also solve the problem with the rendering of the initial view of the vLookup – the folder name is wrapping onto a second line until you expand it (screenshot attached).

    • #19216
      Alexander Bautz
      Keymaster

      Hi,
      I have finally found out why the folder content is sometimes listed twice and will try to get out a new version of vLookup early next week.

      To expand your folder you can use this snippet (will most likely show duplicates until I get the bug fixed):

      function vLookupIsLoadedCallback(fin){
          if(fin === "YOUR_VLOOKUP_COL_NAME"){
              jQuery("#dffs_YOUR_VLOOKUP_COL_NAME .vLookupFolderName").parent().trigger("click");
          }
      }

      Change “YOUR_VLOOKUP_COL_NAME” for your vLookup column name.

      If you get duplicate files you can try wrapping it in a setTimeout like this:

      function vLookupIsLoadedCallback(fin){
          if(fin === "vLookupDocuments"){
              setTimeout(function(){
                  jQuery("#dffs_YOUR_VLOOKUP_COL_NAME .vLookupFolderName").parent().trigger("click");
              },3000);
          }
      }

      Alexander

    • #22784
      Michael
      Participant

      Hi Alexander,

      i have another question on this topic:
      In my case, we always lookup for the contents in a folder where the foldername is equal to the current items title.
      Now when the vlookup column is setup within the list view, we have 2 “problems”:

      1.) empty folders are also displayed (which is understandable from the function)
      2.) we don’t “need” to see the foldername, because ist the same as the title

      So my question:
      Is there any way to “hide” the folder icon and just show the contents under the folder?

      Best Regards,
      Michael

    • #22822
      Alexander Bautz
      Keymaster

      Hi,
      You will have to use custom js – try it like his to automatically expand the first folder and then hide the folder – change vLookupDocuments with the name of your vLookup field:

      function vLookupIsLoadedCallback(fin){
          if(fin === "vLookupDocuments"){
              jQuery("#dffs_vLookupDocuments .vLookupFolderIcon:first").parent().trigger("click").parents(".vLookupTableRow:first").hide();
          }
      }

      Alexander

Viewing 6 reply threads
  • You must be logged in to reply to this topic.