Domiowa
Domiowa

Reputation: 1

VSTO Msproject: Lock Task

I'm working on a small addin, when I click on a button, I'd like to set my remainig work and duration to 0 and locked my tasks So I built something like that, my like function works but it's just to locked my tasks where I have a problem:

  foreach (MSProject.Task i_objTask in g_objProject.Tasks)
            {
                if (i_objTask.WBS.like(WbsIndex+"%"))
                {
                    i_objTask.RemainingWork = 0;
                    i_objTask.RemainingDuration = 0;
                    **Here I'd like to add something like : i_objtTask.Locked=true but this proprety doesn't exist****

                }
            }

Any idea of how could I do that?

Upvotes: 0

Views: 196

Answers (1)

Jerred S.
Jerred S.

Reputation: 376

Record Macro (under the Developer ribbon) is handy for this stuff. Using it gets you:

SetTaskField field:="Locked", value:="Yes"

Unfortunately, you have to select & iterate through tasks on the Task Sheet to manipulate tasks' fields in this way. I haven't seen a Task object property that you can set directly to manipulate the locked state.

Upvotes: 1

Related Questions