Getting List of Objects by Class

Below is the example of using the GetObjects operation to get the list of objects of the specified classes in the specified repository folder. Before the list is obtained, the repository tree is updated and the cache is cleared. Keys, identifiers, class and creation date identifiers are obtained for the objects. The list of objects is sorted by the object creation date in ascending order.

The example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier example.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<GetObjects xmlns="http://www.fsight.ru/PP.SOM.Som">
<tParent xmlns="">
  <id>FNDKOLJACBNNFOAEDCEENEKPOGMMOOGEBLEIHFKEJOFOFMNJ!M!65</id>
  </tParent>
<tFilter xmlns="">
  <levels>-1</levels>
  <hideEmptyFolders>true</hideEmptyFolders>
  <hideAllFolders>false</hideAllFolders>
  <limit>-1</limit>
<classes>
<it>
  <k>1537</k>
  </it>
<it>
  <k>1538</k>
  </it>
  </classes>
  </tFilter>
<tArg xmlns="">
<pattern>
  <n>false</n>
  <i>true</i>
  <ts>false</ts>
  <ds>false</ds>
  <isShortcut>false</isShortcut>
  </pattern>
<refresh>
  <all>true</all>
  </refresh>
<orderBy>
  <asc>true</asc>
  <attribute>Timestamp</attribute>
  </orderBy>
  </tArg>
  </GetObjects>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<GetObjectsResult xmlns="http://www.fsight.ru/PP.SOM.Som" xmlns:q1="http://www.fsight.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<id xmlns="">
  <id>FNDKOLJACBNNFOAEDCEENEKPOGMMOOGEBLEIHFKEJOFOFMNJ!M!65</id>
  </id>
<objects xmlns="">
<its>
<d ts="2012-01-19T11:18:43.000Z" isShortcut="0" isLink="0" hf="0">
  <i>OBJ66</i>
  <n />
  <k>66</k>
  <c>1537</c>
  <p>65</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  </d>
<d ts="2014-08-14T11:36:26.000Z" isShortcut="0" isLink="0" hf="0">
  <i>OBJ90</i>
  <n />
  <k>90</k>
  <c>1538</c>
  <p>65</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  </d>
<d ts="2022-08-03T08:31:50.071Z" isShortcut="0" isLink="0" hf="0">
  <i>NEWFORM1</i>
  <n />
  <k>305000</k>
  <c>1538</c>
  <p>65</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  </d>
<d ts="2022-08-03T08:31:52.259Z" isShortcut="0" isLink="0" hf="0">
  <i>NEWFORM2</i>
  <n />
  <k>305001</k>
  <c>1538</c>
  <p>65</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  </d>
  </its>
  </objects>
  </GetObjectsResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"GetObjects" :
{
"tParent" :
{
"id" : "FNDKOLJACBNNFOAEDCEENEKPOGMMOOGEBLEIHFKEJOFOFMNJ!M!65"
},
"tFilter" :
{
"levels" : "-1",
"hideEmptyFolders" : "true",
"hideAllFolders" : "false",
"limit" : "-1",
"classes" :
{
"it" :
[
{
"k" : "1537"
},
{
"k" : "1538"
}
]
}
},
"tArg" :
{
"pattern" :
{
"n" : "false",
"i" : "true",
"ts" : "false",
"ds" : "false",
"isShortcut" : "false"
},
"refresh" :
{
"all" : "true"
},
"orderBy" :
{
"asc" : "true",
"attribute" : "Timestamp"
}
}
}
}

JSON response:

{
"GetObjectsResult" :
{
"id" :
{
"id" : "FNDKOLJACBNNFOAEDCEENEKPOGMMOOGEBLEIHFKEJOFOFMNJ!M!65"
},
"objects" :
{
"its" :
{
"d" :
[
{
"@ts" : "2012-01-19T11:18:43.000Z",
"@isShortcut" : "0",
"@isLink" : "0",
"@hf" : "0",
"i" : "OBJ66",
"n" : "",
"k" : "66",
"c" : "1537",
"p" : "65",
"h" : "0",
"hasPrv" : "0",
"ic" : "0"
},
{
"@ts" : "2014-08-14T11:36:26.000Z",
"@isShortcut" : "0",
"@isLink" : "0",
"@hf" : "0",
"i" : "OBJ90",
"n" : "",
"k" : "90",
"c" : "1538",
"p" : "65",
"h" : "0",
"hasPrv" : "0",
"ic" : "0"
},
{
"@ts" : "2022-08-03T08:31:50.071Z",
"@isShortcut" : "0",
"@isLink" : "0",
"@hf" : "0",
"i" : "NEWFORM1",
"n" : "",
"k" : "305000",
"c" : "1538",
"p" : "65",
"h" : "0",
"hasPrv" : "0",
"ic" : "0"
},
{
"@ts" : "2022-08-03T08:31:52.259Z",
"@isShortcut" : "0",
"@isLink" : "0",
"@hf" : "0",
"i" : "NEWFORM2",
"n" : "",
"k" : "305001",
"c" : "1538",
"p" : "65",
"h" : "0",
"hasPrv" : "0",
"ic" : "0"
}
]
}
}
}
}
public static Ods GetObjectsByClass(MbId mb, string parent, OdClass[] classes)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tObject = new GetObjects()
{
//Specify obtained information
tArg = new GetObjectsArg()
{
//Get: keys, identifiers and class identifiers
//Sort by ascending creation date
orderBy = new OdsOrderBy()
{
asc = true,
attribute = OdAttribute.Timestamp
},
pattern = new OdsPattern()
{
ds = false,
i = true,
isShortcut = false,
n = false,
ts = false
},
refresh = new MbRefresh()
{
all = true,
},
},
tFilter = new OdsFilt()
{
classes = classes,
limit = -1,
levels = -1,
hideAllFolders = false,
hideEmptyFolders = true
},
//Specify identifier of the object, which child objects are used in search
tParent = new OdId()
{
id = mb.id + "!" + FindObjectById(mb, parent).k
}
};
//Get list of objects according to the specified selection parameters
var result = somClient.GetObjects(tObject);
return result.objects;
}

See also:

GetObjects: Operation