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.
{
"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"
}
}
}
}
{
"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: