Quantcast
Channel: Project Customization and Programming forum
Viewing all articles
Browse latest Browse all 5347

Microsoft Project 2013 Interop fails after installing the last updates

$
0
0

We have a code sequence that reads tasks from an MPP file. It used to work fine, however since applying the last Office updates the code fails at the line 

var tasks = project.Tasks

with an InvalidCastException ("Return argument has an invalid type", HR=-2147467262).

Has something changed in the Microsoft Project 2013 object model?

Below you have a code sequence that used to work fine and now it fails:

    var app = new Microsoft.Office.Interop.MSProject.ApplicationClass();
            var toOpen = @"d:\work\test.mpp";
            var succeeded = app.FileOpen(toOpen);
            if (!succeeded)
            {
                Console.WriteLine("Cannot open file");
                return;
            }
            var project = app.ActiveProject;
            var tasks = project.Tasks;



Viewing all articles
Browse latest Browse all 5347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>