Options

MS Project 2007 and NAV Import problem

sendohsendoh Member Posts: 207
Hi Guys,

I'm working on the MS Project Integration now and have some unconsistent problem, the code below is working fine before,but for some unknown reason i got some random error like, ("Could not invoke the member count","Could not invoke the tasks" and etc.) and sometimes it works fine.
i know this error comes out because i'm using the API of MSproject member and the description of the error is descriptive but i couldn't resolve this issue. is this a registry problem or unproper installation or what? please advise. Thanks.
mportMSProjFile(pPath : Text[400];pVisible : Boolean)
CLEAR(Task);
CLEAR(Tasks);
CLEAR(App);

IF ISCLEAR(App) THEN
  CREATE(App);

LCtrTask := 0;
App.FileOpenEx(pPath);

Tasks := App.ActiveProject.Tasks;

FOR LCtrTask := 1 TO Tasks.Count DO BEGIN
  
  Task := Tasks.Item(LCtrTask); //Row No.

  WITH ProjMapping DO BEGIN
    INIT;
    ID := Task.ID;
    "Task Name" := Task.Name;
    Start := Task.Start;
    Finish := Task.Finish;
    Resource := Task.ResourceNames;
    Duration := Finish - Start;
    Milestone := Task.Milestone;
    INSERT;
  END;

END;

App.Visible := pVisible;
IF App.FileExit(0) THEN
  CLEAR(App);

Regards,
Sendoh
Sendoh
be smart before being a clever.

Comments

  • Options
    sendohsendoh Member Posts: 207
    Hi Guys,

    After some testing I found out that the error rise when there's an open MSProject file and when it first time I run the codeunit and when trying to run the codeunit in second time it works fine.. I think I missed something before this line
    App.FileOpenEx(pPath);
    
    Please advise what I missed. Thanks in advance.

    Regards,
    Sendoh
    Sendoh
    be smart before being a clever.
Sign In or Register to comment.