Book a Demo

Author Topic: Move elments or packages via Automation  (Read 4159 times)

bittercoder

  • EA User
  • **
  • Posts: 30
  • Karma: +0/-0
  • .Net developer
    • View Profile
Move elments or packages via Automation
« on: January 10, 2007, 04:46:20 pm »
Is there any way to "move" an element or package from it's current package to a new/different package via Automation, or can this only be done by manipulating the database itself?

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Move elments or packages via Automation
« Reply #1 on: January 10, 2007, 05:08:25 pm »
You should be able to just change the Element.PackageID value to the ID of the desired package and perform Update().  I have just quickly tested this and it appears to work.

Code: [Select]
element.PackageID = targetPackageID
element.Update
repository.RefreshModelView targetPackageID

Likewise, to move a Package change the Package.ParentID value.
« Last Edit: January 10, 2007, 05:16:03 pm by AaronB »

bittercoder

  • EA User
  • **
  • Posts: 30
  • Karma: +0/-0
  • .Net developer
    • View Profile
Re: Move elments or packages via Automation
« Reply #2 on: January 11, 2007, 01:47:04 pm »
I just assumed that property was read only ;o) woops.. heh

Thanks for the help!