« Microsoft Office Project 2007 Webcasts coming up | Main | Microsoft Project 2007 Example Project Templates »

Adding tasks to MS Project using C#

Eric Landes has a brief code snippet on using C3 to automate project here:Corporate Coder : Project 2003 Adding Tasks via C#

All I can say is that C# is slightly less than elegant in the way it handles optional parameters.
For what an idea of what I'm talking about, here is how to invoke FileOpen:
m_ProjectProApp.FileOpen ( "MyProjectName", missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, PjPoolOpen.pjDoNotOpenPool, missingValue, missingValue, missingValue, missingValue);
Just a bit awkward, wouldn't you say?

RELATED POSTS

Comments (3)

Sarath Pinninty:

Whats is the missingValue type? I could not get it work with type string and objects with values null, "", String.Empty, "Nothing". If possible, please send me the sample code.

I appriciate your help.

Thanks,
Sarath

Bela Orosz:

If anyone is searching for missingValue:
object missingValue = Type.Missing;

danny:

just include system.reflections

Post a comment

(Comments are moderated to fight SPAM and will be published after I have a chance to approve them. Thanks for waiting.)

About

The previous article is Microsoft Office Project 2007 Webcasts coming up.

The next article is Microsoft Project 2007 Example Project Templates.

Current articles are in the main index page and you can find a complete list of articles in the archives.

Creative Commons License
This weblog is licensed under a Creative Commons License.
Powered by
Movable Type 3.34