17

I want to move one component from one folder to another folder already created.

while (textReader.Read())
{
    textReader.MoveToElement();
    Component comp = tdse.GetComponent(textReader.GetAttribute("ID"), constant_Publication, true, -1);
}

I try looking for comp.Move but it doesn't exist. Also, I saw that in comp.Info.Path there is the path, but if I try to modify it I have the following error:

Error 7 Property or indexer 'Tridion.ContentManager.Interop.TDS._Info.Path' cannot be assigned to -- it is read only.

What can i do to move the component?

0

2 Answers 2

14

It looks like you are using TOM rather than TOM.NET

You need to perform a paste action with the folder you want to get the new item into

Something like

objFolder.PasteItem(comp, 1, false)

The first parameter is the item you want to paste, the second is an enumerator (EnumTDSCutCopyAction - 1 is cut (move), 0 is copy ) to say if you want to Copy and Paste or Cut and Paste, and the final one is whether you want to assert a unique name.

In TOM.NET there is a RepositoryLocalObject.Move() method.

1
  • 1
    I just wanted to add that you should use the enumeration (TDSDefines.EnumTDSCutCopyAction) instead of hard-coding it to "1". It won't change, but it's a good practice regardless :) Commented Mar 18, 2013 at 10:49
12

in the TOM API you have this method implemented on the Folder as a paste action (in the 2011 TOM.NET API there is a Component.Move indeed).

Folder.PasteItem(ByVal Item As Variant, ByVal action As TDSDefines.EnumTDSCutCopyAction, ByVal makeUnique As Boolean)

Parameters

  • item - The TOM object or URI representing the item to be pasted.
  • action - The action to perform: cut-paste or copy-paste.
  • makeUnique - Specifies whether the title of the pasted item should be made unique within the new organizational item.
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.