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 operation results in the 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!176176"
},
"tArg" :
{
"info" :
{
"parent" :
{
"@isShortcut" : "false",
"@isLink" : "false",
"@hf" : "false",
"i" : "TEMP",
"n" : "Temp",
"k" : "65",
"c" : "0",
"p" : "70",
"h" : "false",
"hasPrv" : "false",
"ic" : "false"
}
},
"getObjects" :
{
"parent" :
{
"id" : "S1!M!65"
},
"filter" :
{
"hideEmptyFolders" : "true",
"classes" :
{
"it" :
{
"k" : "1538"
}
}
},
"arg" :
{
"pattern" :
{
"n" : "false",
"i" : "true",
"ts" : "false",
"ds" : "false",
"isShortcut" : "false"
}
}
}
}
}
}
{
"MoveObjectResult" :
{
"object" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "1",
"@hf" : "0",
"i" : "NEWFORM1",
"n" : "NewForm1",
"k" : "176176",
"c" : "1538",
"p" : "65",
"h" : "0",
"hasPrv" : "0",
"ic" : "0"
},
"objects" :
{
"id" :
{
"id" : "S1!M!176176"
},
"objects" :
{
"its" :
{
"d" :
[
{
"@isShortcut" : "0",
"@isLink" : "0",
"@hf" : "0",
"i" : "OBJ90",
"n" : "",
"k" : "90",
"c" : "1538",
"p" : "65",
"h" : "0",
"hasPrv" : "0",
"ic" : "0"
},
{
"@isShortcut" : "0",
"@isLink" : "0",
"@hf" : "0",
"i" : "NEWFORM1",
"n" : "",
"k" : "176176",
"c" : "1538",
"p" : "65",
"h" : "0",
"hasPrv" : "0",
"ic" : "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 objects list after moving
getObjects = new GetObjectsOpArg()
{
arg = new GetObjectsArg()
{
pattern = new OdsPattern()
{
ds = false,
i = true,
isShortcut = false,
n = false,
ts = false
}
},
filter = new OdsFilt()
{
classes = new OdClass[1]
{
//Refresh list of objects with the same class, which the 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: