The example of using the SaveObjectAs operation to move a repository object. The request contains the moved object moniker and description of the parent object, to which the object is moved. The response contains the updated list of objects of the parent object, to which the object is moved.
{
"SaveObjectAs" :
{
"tObject" :
{
"id" : "S1!M!176178"
},
"tArg" :
{
"destination" :
{
"operation" : "MoveToParent",
"move" :
{
"parent" :
{
"@isShortcut" : "false",
"@isLink" : "false",
"@hf" : "false",
"i" : "TEMP",
"n" : "Temp",
"k" : "65",
"c" : "0",
"p" : "70",
"h" : "false",
"hasPrv" : "false",
"ic" : "false"
}
},
"autoGenerateName" : "true"
},
"getObjects" :
{
"parent" :
{
"id" : "S1!M!65"
}
}
}
}
}
{
"SaveObjectAsResult" :
{
"object" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "1",
"@hf" : "0",
"i" : "REPORT_COPY",
"n" : "Regular report(Copy)",
"k" : "176178",
"c" : "2562",
"p" : "65",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"obId" :
{
"id" : "S1!M!176178"
}
},
"objects" :
{
"id" :
{
"id" : "S1!M!176178"
},
"objects" :
{
"its" :
{
"d" :
[
{
"@isShortcut" : "0",
"@isLink" : "0",
"@hf" : "0",
"i" : "OBJ66",
"n" : "check macros",
"k" : "66",
"c" : "1537",
"p" : "65",
"h" : "0",
"hasPrv" : "0",
"ic" : "0"
},
{
"@isShortcut" : "0",
"@isLink" : "0",
"@hf" : "0",
"i" : "OBJ90",
"n" : "Form90",
"k" : "90",
"c" : "1538",
"p" : "65",
"h" : "0",
"hasPrv" : "0",
"ic" : "0"
},
{
"@isShortcut" : "0",
"@isLink" : "0",
"@hf" : "0",
"i" : "NEWFORM1",
"n" : "NewForm1",
"k" : "176176",
"c" : "1538",
"p" : "65",
"h" : "0",
"hasPrv" : "0",
"ic" : "0"
},
{
"@isShortcut" : "0",
"@isLink" : "0",
"@hf" : "0",
"i" : "NEWFORM2",
"n" : "NewForm2",
"k" : "176177",
"c" : "1538",
"p" : "65",
"h" : "0",
"hasPrv" : "0",
"ic" : "0"
},
{
"@isShortcut" : "0",
"@isLink" : "0",
"@hf" : "0",
"i" : "REPORT_COPY",
"n" : "Regular report (Copy)",
"k" : "176178",
"c" : "2562",
"p" : "65",
"h" : "0",
"hasPrv" : "0",
"ic" : "0"
}
]
}
}
}
}
}
The MoveObj function specified below moves the repository object. The identifier of the object and the folder, to which the object is moved, are sent by the objId and parentId input parameters. The example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier example. The result of the operation is the result of the function.
public static SaveObjectAsResult MoveObj(MbId mb, string objId, string parentId)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tParent = FindObjectById(mb, parentId);
var tSave = new SaveObjectAs()
{
tArg = new SaveObjectAsArg()
{
destination = new ObjectCopyInfo()
{
//Action - move object
operation = ObjectCopyOperation.MoveToParent,
move = new ObjectMoveInfo()
{
parent = tParent
}
},
getObjects = new GetObjectsOpArg()
{
parent = new OdId() { id = mb.id + "!" + tParent.k }
}
},
tObject = new OdId()
{
id = mb.id + "!" + FindObjectById(mb, objId).k
}
};
//Move object
var result = somClient.SaveObjectAs(tSave);
return result;
}
See also: