none
ActiveProject.TaskViewList Property is returning the Task Filters instead of Views RRS feed

  • Question

  • Hi,

    We are working on a Project VSTO Add-in using Visual Studio 2013 and targeting .net framework 4.5.2. In our application, we have to check if the current view is an active view.

    We are using the below code to determine that.

                string curViewName = app.ActiveProject.CurrentView;
                Boolean viewOk = false;
            
                foreach (string viewName in app.ActiveProject.TaskViewList) {
                    if (viewName == curViewName) {
                        viewOk = true;
                        break;
                    }
                }

                return viewOK.

    This was working on on our development machine with MS Project 2013 installed.

    But, when the same code is being executed in a machine with only MS Project 2007 installed, it is failing even though the current view is Gantt Chart.

    We tried debugging it further and found that the below API's returning filters instead of views.

    1) ActiveProject.TaskViewList

    2) ActiveProject.ResourceViewList

    The same  code was working when the application was in Visual Studio 2010 and targeted to .net framework 4.0.

    Please let us know if it is a bug?

    If yes, is there any fix/workaround available?

    If no, do we need to set any properties for Microsoft.office.* references to make this work?

     Currently, the Embedded Interops = false, specific version = false, version=15.0.0.0 (MSProject, Office)

    Thanks,

    Murali

    Friday, January 29, 2016 10:17 AM

All replies

  • Hi,

    Any update on this?

    Thanks,

    Murali

    Monday, February 1, 2016 10:39 AM
  • Hi,

    Please let me know if I need to post in a different forum for this kind of post.

    Also, is it possible to file a bug against this particular product?

    Thanks,

    Murali

    Wednesday, February 3, 2016 7:05 AM
  • Still no response in the forum.

    Please let me know if I need to check somewhere else.

    thanks,

    Murali

    Wednesday, February 10, 2016 3:00 PM
  • Murali,

    Sorry for the delay in giving you a response, this is the right forum. I don't work with Visual Studio and I don't have Project 2013 so I was hoping someone else might step in and give you an answer. However, that hasn't happened so this is what I can offer. With Project Pro 2010, fully updated, I get the following responses in VBA:

    ActiveProject.TaskViewList(1) gives "Gantt Chart"

    ActiveProject.ResourceViewList(1) gives "Resource Form"

    In other words, both properties give the expected results. Why you would get the filters list I don't know. I'll ping Rod Gill, our resident Project VBA guru, and see it he can shed any light.

    John


    Wednesday, February 10, 2016 3:58 PM
  • Hi,

    VSTO has had a number of problems like this. But firstly, is Project 2007 up to date with SP3 and the latest cumulative update? If not you need it.

    If Project 2007 still has problems, then the only solution is likely to upgrade or call a local VBA macro.

    Good Luck!


    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

    Wednesday, February 10, 2016 9:14 PM
    Moderator
  • I have VS 2012 with all versions of MSP since 2003 on my development machine. Unfortunately I don't have one with only 2007 for testing. When I run code to check the view list in 2007 I get views, not filters. I do have SP3 of 2007 so, as Rod said, you should check that. Aside from that, there could be a compatibility problem with the Office Interop version. I'm using 14.0.0.0 in my code and it seems to work fine, so you might want to try that.
    Thursday, February 11, 2016 2:35 PM
  • Thanks for the answers.

    I'll try to update my MSP 2007 to latest service pack.

    If that doesn't resolve my problem, I'll use office 14.0.0.0 Interop's.

    Thanks,

    Murali

    Friday, February 12, 2016 1:14 PM
  • Hi Rod Gill,

    I have updated MSP 2007 professional to SP3 (12.0.6607.1000). It didn't resolve the issue.

    Tried changing the office libraries from 15.0.0.0 to 14.0.0.0. (Copy local - true, embed - false, specific - false). No luck with this as well.

    Our code was working when it was in Visual Studio 2010 and targeting office 2007.

    As we need to upgrade to .net runtime 4.5.2, we upgraded our Visual Studio as well.

    Please let me know if you want me to share any other details to debug this issue further.

    I think you should also be able to reproduce. I don't have nay issues with MSP 2010.

    Thanks,

    Murali

    Monday, February 15, 2016 9:56 AM
  • Can't help you any further I'm afraid. I've found VSTO to be hard to get working properly with various properties and methods that work properly in Project VBA not working in VSTO, so I gave up working with it and refined my VBA deployment practices and software. Haven't found a need for an add-in since.

    And for many macros, they run faster than the VSTO add-in as well.


    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz


    Monday, February 15, 2016 10:47 AM
    Moderator
  • Hi,

    We are really looking for solution since we deliver the plugin to our ERP customers. 

    I tried to find a workaround, but no luck. 

    What is the process to file a bug against this API?

    Thanks,

    Murali

    Friday, February 19, 2016 12:49 PM
  • We found another solution to get the same result.

                // are we in a task view?

                string curViewName = app.ActiveProject.CurrentView;
                Boolean viewOk = false;
                foreach (MSProject.View taskView in app.ActiveProject.Views) {
                    if (taskView.Type.Equals(MSProject.PjItemType.pjTaskItem))
                    {
                        string viewName = taskView.Name;
                        if (viewName == curViewName)
                        {
                            viewOk = true;
                            break;
                        }
                    }
                }
               return viewOk;
            }


    We still want to report the issue with TaskViewList/ResourceViewList API.

    Please let us know the process to file a bug.

    Thanks,

    Murali



    Wednesday, March 2, 2016 8:00 AM
  • To file a bug, call Microsoft Help.

    I had another thought, can you create a virtual PC on a spare PC and install only Visual Studio and Project and Office 2007? There may be a conflict that 2013 dlls are being compiled and you need 2007 only.

    Might work, but no guarantees I'm afraid.


    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

    Wednesday, March 2, 2016 8:40 AM
    Moderator
  • Hi Rod Gill,

    Actually, we are using the virtual PC with Visual Studio 2010 and MS Project 2007 as a work around for the issue.

    We upgraded our code source to MS Visual Studio 2013 and .net runtime to 4.5.2.

    In order to use 2007 Office libraries, I think we need Visual studio 2010. 

    So, we need to maintain two code sources and .net runtime 4.0 is not supported now.

    Thanks,

    Murali

    Thursday, March 10, 2016 6:55 AM
  • Hi,

    We are also facing this issue when getting the project start date.

    Application.ActiveProject.Start is actually returning the value of project.Start1

    Thanks,

    Murali

    Wednesday, March 16, 2016 2:20 PM
  • Hi Rod Gill,

    In the machine where we are publishing the plugin using VS 2013 build exe has two versions of MSP's installed.

    1. MS Project 2007

    2. MS Project 2010

    We also observed that, the Office dll and MSProject dll's are being copied to the published folder. Is this expected?

    Do you think uninstalling MSP 2007 in the publishing machine will resolve the issue?

    Thanks,

    Murali

    Wednesday, March 16, 2016 3:42 PM
  • Can't help you with that. As I said, VSTO got way too complex and ornery for me to rely on it so I've stopped developing in it.

    I think your best bet may be to use something like:

    https://www.add-in-express.com/add-in-vsto/features.php


    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

    Wednesday, March 16, 2016 8:56 PM
    Moderator