Book a Demo

Author Topic: Cannot add a File to a Use Case  (Read 3624 times)

michael.jeier

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Cannot add a File to a Use Case
« on: October 02, 2008, 03:58:44 am »
Hi,

I'm trying to add a File to a Use Case, but it isn't working though I get true, when I do an Update(). The File is simply not added to the properties when I check it manually on the Use Case. I also check before, whether it's the right Use Case - it is.  :-?

Here's the code snippet:

Code: [Select]
          // element is an EA.Element
            MessageBox.Show("Use Case name: " + element.Name
                    + " element ID: " + element.ElementID);
            element.Files.AddNew(strURL, "Web Address");
            bool updated = element.Update();
            element.Files.Refresh();
            element.Refresh();
            MessageBox.Show("updated: " + updated.ToString()); // true

Does someone see a mistake there??!? I really don't know what else to do.  :(  Thanks!

Regards, Michael

Takeshi K

  • EA User
  • **
  • Posts: 632
  • Karma: +43/-1
    • View Profile
    • Sparx Systems Japan
Re: Cannot add a File to a Use Case
« Reply #1 on: October 02, 2008, 06:28:14 am »
You need to call File.Update() method.

For example,

file = element.Files.AddNew(strURL, "Web Address");
file.Update();

Hope this helps.

--
t-kouno
--
t-kouno

michael.jeier

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Cannot add a File to a Use Case
« Reply #2 on: October 03, 2008, 12:41:25 am »
Hi,

yup - that worked! I knew I was missing something completely obvious!  :-/ Thanks a lot!!

Regards, Michael