Microsoft Docs LinkPredecessors
Method is described as:
public void LinkPredecessors (object Tasks, Microsoft.Office.Interop.MSProject.PjTaskLinkType Link = Microsoft.Office.Interop.MSProject.PjTaskLinkType.pjFinishToStart, object Lag);
How can I assign a Lag value to "object Lag"? The below code works to assign predecessor and task link type, however, I cannot figure out how to add the lag.
Microsoft.Office.Interop.MSProject.PjTaskLinkType LinkType;
var p = IApp.ActiveProject;
foreach (var y in tasksPred)
{
int intTaskType = Convert.ToInt32(y.RelationshipType);
switch (intTaskType)
{
case 0:
LinkType = Microsoft.Office.Interop.MSProject.PjTaskLinkType.pjFinishToFinish;
break;
case 1:
LinkType = Microsoft.Office.Interop.MSProject.PjTaskLinkType.pjFinishToStart;
break;
case 2:
LinkType = Microsoft.Office.Interop.MSProject.PjTaskLinkType.pjStartToFinish;
break;
case 3:
LinkType = Microsoft.Office.Interop.MSProject.PjTaskLinkType.pjStartToStart;
break;
default:
LinkType = Microsoft.Office.Interop.MSProject.PjTaskLinkType.pjFinishToStart;
break;
}
if (y.UniqueIDPredecessor != "")
{
p.Tasks[Convert.ToInt32(y.UniqueID)].LinkPredecessors(p.Tasks[Convert.ToInt32(y.UniqueIDPredecessor)], LinkType);
}
}