none
Unable to access Application.ActiveProject.NewTasksCreatedAsManual RRS feed

  • Question

  • Hi,

    I am developing a pretty complex AddIn for Microsoft Project 2010 using C# 4.0 with Visual Studio 2010.  I am writing a class that will check to see if the current project is set to create manually scheduled tasks by default and as such I am using the the ActiveProject.NewTasksCreatedAsManual property found on  the Project object please refer to the code below:

     

    <br/><pre lang="x-c#">if (MSProjectInstance.ActiveProject != null)
    {
       returnValue =   MSProjectInstance.ActiveProject.NewTasksCreatedAsManual;
    }
    

     

      The code above is being used directly inside the ThisAddIn class and executes as I would expect.

    The problem comes when I implement my Check logic which is found in a separate class library that is referenced by the ThisAddIn class.  My Check class has a single Method called check and looks as below:

     

     public bool Check(Project objectToCheck)
     {
          bool foundIssue = false;
          if (objectToCheck.NewTasksCreatedAsManual)
          {
            foundIssue = true;
          }
          return foundIssue;
     }
    

     

     The above  Check Method will not compile it gives an error as though the NewTasksCreatedAsManual property does not exist on the Project Object.  I am referencing the Microsoft.Office.Interop.MSProject assembly but maybe I need something else as well.  I am flumoxed by this and would appreciate any help or suggestions of things that may be causing this issue. 

     

    Thanks in advance!

     

    Monday, June 20, 2011 5:30 PM

Answers

  • Update:

     

    I resolved the issue I had the wrong version of the Interop Assembly referenced needed v2.0.50727.

     

    Thanks

    • Marked as answer by Thomas_Bell Monday, June 20, 2011 6:51 PM
    Monday, June 20, 2011 6:51 PM