UIX v2: ShellListing SelectObjectVersion

Hi, 

Looking in documentation of SelectObjectVersion at this link (https://developer.m-files.com/Frameworks/User-Interface-Extensibility-Framework/Reference/UIExt2/Interfaces/IShellListing/SelectObjectVersion/) I tried to select an object, after refreshing the listing.

My objVer structure comes from a Vault Extension Method but I also tried with a static value. From my understanding, ObjVer can be declared like here:

const staticObjVer = {
      obj_id: {
        type: 101, // my Object Type
        item_id: {
          internal_id: 2, // my Object ID
          external_repository_id: null,
        },
      },
      version: {
        type: 7,
        internal_version: 7, // my Object Version
        external_repository_version: null,
        external_repository_sort_key: 0,
      },
    };

  Then, I if I am calling 

await dashboard.ShellFrame.Listing.SelectObjectVersion(staticObjVer); 
it doesn't work. What is wrong?
Thanks,
Viorel
  • Unless this behavior is only available in a very well-defined/specific view, how can you be sure the object will be available for selection in the refreshed listing? Are you sure you don't need an AddListingItem() call first? or maybe just a SetVirtualSelection()?
     
    I would search for the object in the listing using the type and id.  That way you don't need to create the structure yourself, and can confirm the object is actually present, and if not, act accordingly.  Once you are sure the object is in the listing, check that it is at least the version you want -- if the version is too old, call RefreshObject(), after that, SelectObjectVersion should work. Again, I recommend calling the methods with the structure received from the listing itself instead of building it yourself -- not because you have to, but just because it is easier.