MoveObjectResult MoveObject(OdId tParent, MoveObjectArg tArg)
tParent. Moved object moniker.
tArg. Operation execution parameters.
The MoveObject operation moves a repository object.
To execute the operation, in the tParent parameter specify the moved object moniker. In the tArg parameter specify information on where the object is moved. This parameter may also contain parameters of updating the list of repository objects, that will be applied after the operation is executed.
The result of the operation is description of the moved object, and also the updated list of repository objects, if respective operation execution parameters are specified.
The example of moving an object. The object is moved to the repository folder with the Temp identifier.
The example of moving an object. The object is moved to the repository folder with the Temp identifier.
{ "MoveObject" : { "tParent" : { "id" : "S1!M!8081"
}, "tArg" : { "info" : { "parent" : { "@isShortcut" : "false", "@isLink" : "false", "@hf" : "false",
"i" : "TEMP", "n" : "Temp", "k" : "65", "c" : "0", "p" : "4294967295", "h" : "false" } }, "getObjects" : {
"parent" : { "id" : "S1!M!65" }, "filter" : { "hideEmptyFolders" : "true", "classes" : { "it" :
{ "k" : "1538" } } }, "arg" : { "pattern" : { "sd" : "false",
"n" : "false", "i" : "true", "ts" : "false", "ds" : "false", "isShortcut" : "false" } } } } } }
{ "MoveObjectResult" : { "object" : { "@isShortcut" : "0", "@isLink" : "0", "i" : "NEWFORM1", "n" : "NewForm1", "k" : "8081", "c" : "1538",
"p" : "65", "h" : "0" }, "objects" : { "id" : { "id" : "S1!M!8081" }, "objects" :
{ "its" : { "d" : [ { "@isLink" : "0", "@hf" : "0", "i" : "OBJ90", "n" : "",
"k" : "90", "c" : "1538", "p" : "4294967295", "h" : "0" }, { "@isLink" : "0", "@hf" : "0", "i" : "NEWFORM1", "n" : "",
"k" : "8081", "c" : "1538", "p" : "4294967295", "h" : "0" } ] } } } } }
The MoveObject function specified below moves the object in the specified repository folder. The identifier of the moved object and the folder are sent as the moveableObj and newParentId input parameters, respectively. After the object is moved, the list of objects in the folder is updated. The updated information is available as a result of this function. The example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier example.
public static MoveObjectResult MoveObject(MbId mb, string moveableObj, string newParentId) { var somClient = new SomPortTypeClient(); //Proxy object for operation execution var tObject = FindObjectById(mb, moveableObj); var tParent = FindObjectById(mb, newParentId); //Operation execution parameters var tMove = new MoveObject() { tArg = new MoveObjectArg()
{ //Parameters of refreshing object list after move getObjects = new GetObjectsOpArg() { arg = new GetObjectsArg() { pattern = new OdsPattern() { ds = false, i = true
isShortcut = false, n = false, sd = false, ts = false } }, filter = new OdsFilt() { classes = new OdClass[1] {
//Refresh object list with the same class that moved object has new OdClass(){k = tObject.c}, }, hideEmptyFolders = true }, parent = new OdId() { id = mb.id + "!" + tParent.k } }, info = new ObjectMoveInfo() { parent = tParent
} }, tParent = new OdId() { id = mb.id + "!" + tObject.k } }; //Move object var result = somClient.MoveObject(tMove); return result; }
See also: