Getting latest object version and properties in UIXv2

Is there a UIXv2 method that allows me to get the latest version and its properties for any given ObjID?


Preferably it would be an option to the GetObjectDataOfMultipleObjects method that lets me specify to retrieve the latest version instead of a specific version, just like the UIXv1 method GetObjectVersionAndPropertiesOfMultipleObjects did with its LatestVersions and AllowCheckedOut arguments.

I have tried passing the following request object to GetObjectDataOfMultipleObjects :

{
  "obj_vers": [
    {
      "obj_id": {
        "type": 0,
        "item_id": {
          "internal_id": 530,
          "external_repository_id": {
            "connection": "",
            "item": ""
          }
        }
      },
      "version": {
        "type": 1,
        "internal_version": 162,
        "external_repository_version": "",
        "external_repository_sort_key": 0
      }
    }
  ],
  "data_request": {
    "required_data_flags": {
      "all": false,
      "object_version": true,
      "properties": true,
      "acl": false,
      "current_user_permissions": false,
      "properties_for_display": false,
      "relationships": false,
      "collection_member_relationships": false,
      "object_activities": false
    },
    "error_tolerance": 1,
    "identity_type": 1,
    "object_activities_parameters": {
      "category_filter": {
        "all": false,
        "metadata": false,
        "file_content": false,
        "comments": false
      },
      "limit": 0,
      "offset_obj_ver_version": {
        "type": 1,
        "internal_version": 0,
        "external_repository_version": "",
        "external_repository_sort_key": 0
      }
    }
  }
}

but the result returns an incomplete object (it is missing the object_data member) and indicates an error:

{
  "results": [
    {
      "obj_ver": {
        "obj_id": {
          "type": 0,
          "item_id": {
            "internal_id": 530,
            "external_repository_id": {
              "connection": "",
              "item": ""
            }
          }
        },
        "version": {
          "type": 1,
          "internal_version": 162,
          "external_repository_version": "",
          "external_repository_sort_key": 0
        }
      },
      "error_info": {
        "error_code": -2147221493
      }
    }
  ]
}

Note that in the request object I have used type 1 (standing for OBJ_VER_VERSION_TYPE_LATEST) in two places to indicate latest version, as documented in https://developer.m-files.com/Frameworks/User-Interface-Extensibility-Framework/Reference/gRPC/Enums/ObjVerVersionType/ but it doesn't seem to work. If I pass type 7 the call works but will return the specific version of the request, not the latest version.

Can someone post a valid request object?  

Parents
  • Didn't we discuss this before? Slight smile
    https://community.m-files.com/groups-1602070992/developers/f/developer-forum/10691/uixv2-equivalent-to-getobjectversionandpropertiesofmultipleobjects/32056

    I don't see the version_type property in your request anywhere.

    I have passed along the need for better documentation and examples with this.  I will do so again.

  • Hi Joel,

    thanks for tje quick reply. I can't access that link "page no longer exists" (it may have been moved to a section I cannot access, for example "developer" section).

    I was referring to obj_vers[0].version.type and data_request.object_activities_parameters.offset_obj_ver_version.type  which I both set to 1 in the request object.

    I have added a version_type member with value 1 to the request object and it appears to be working (returning the latest version). Thanks a lot!

    New request object:

    {
      "obj_vers": [
        {
          "obj_id": {
            "type": 0,
            "item_id": {
              "internal_id": 530,
              "external_repository_id": {
                "connection": "",
                "item": ""
              }
            }
          },
          "version": {
            "type": 1,
            "internal_version": 162,
            "external_repository_version": "",
            "external_repository_sort_key": 0
          }
        }
      ],
      "data_request": {
        "required_data_flags": {
          "all": false,
          "object_version": true,
          "properties": true,
          "acl": false,
          "current_user_permissions": false,
          "properties_for_display": false,
          "relationships": false,
          "collection_member_relationships": false,
          "object_activities": false
        },
        "error_tolerance": 1,
        "identity_type": 1,
        "version_type": 1,
        "object_activities_parameters": {
          "category_filter": {
            "all": false,
            "metadata": false,
            "file_content": false,
            "comments": false
          },
          "limit": 0,
          "offset_obj_ver_version": {
            "type": 1,
            "internal_version": 0,
            "external_repository_version": "",
            "external_repository_sort_key": 0
          }
        }
      }
    }

    Once again, thank you and sorry for bothering again.

    Martin

Reply
  • Hi Joel,

    thanks for tje quick reply. I can't access that link "page no longer exists" (it may have been moved to a section I cannot access, for example "developer" section).

    I was referring to obj_vers[0].version.type and data_request.object_activities_parameters.offset_obj_ver_version.type  which I both set to 1 in the request object.

    I have added a version_type member with value 1 to the request object and it appears to be working (returning the latest version). Thanks a lot!

    New request object:

    {
      "obj_vers": [
        {
          "obj_id": {
            "type": 0,
            "item_id": {
              "internal_id": 530,
              "external_repository_id": {
                "connection": "",
                "item": ""
              }
            }
          },
          "version": {
            "type": 1,
            "internal_version": 162,
            "external_repository_version": "",
            "external_repository_sort_key": 0
          }
        }
      ],
      "data_request": {
        "required_data_flags": {
          "all": false,
          "object_version": true,
          "properties": true,
          "acl": false,
          "current_user_permissions": false,
          "properties_for_display": false,
          "relationships": false,
          "collection_member_relationships": false,
          "object_activities": false
        },
        "error_tolerance": 1,
        "identity_type": 1,
        "version_type": 1,
        "object_activities_parameters": {
          "category_filter": {
            "all": false,
            "metadata": false,
            "file_content": false,
            "comments": false
          },
          "limit": 0,
          "offset_obj_ver_version": {
            "type": 1,
            "internal_version": 0,
            "external_repository_version": "",
            "external_repository_sort_key": 0
          }
        }
      }
    }

    Once again, thank you and sorry for bothering again.

    Martin

Children