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

Cannot programmatically select a task in Team planner - Office MS Project 2010

$
0
0

Hi,

I'm using Visual Studio 2010 32 bits, MS Project 32 bits on a windows 7 64 bits environment.
I created a MS project 2010 addin in Visual Studio. I can do many things with this addin, add ribbon, create tasks,
change colors in gant view...
However I cannot selected a task in the team planner view !
I use SelectTPTask in the application instance as referenced (http://msdn.microsoft.com/en-us/library/ms474284.aspx).
After this selection I want to change the color of the task by using SegmentFillColor method but nothing happens.
If I manually click on a task then SegmentFillColor works and the task color is changed.
Here is the code of the action:
private void buttonPriority_Click(object sender, RibbonControlEventArgs e)
		{
			var app = Globals.ThisAddIn.Application;
			var pj = app.ActiveProject;

			//create Tasks

			Task newTask = pj.Tasks.Add("First task");
			newTask.Duration = "3";
			newTask.ResourceNames = "Resource A";

			newTask = pj.Tasks.Add("Second task");
			newTask.Duration = "4";
			newTask.ResourceNames = "Resource B";

			//Change color of the assignments

			foreach (Task t in app.ActiveProject.Tasks)
			{
				if ((t != null) && !(bool)t.Summary)
				{
					bool b1 = app.SelectTPTask(t.UniqueID);
					bool b2 = app.SelectTaskAssns();
					bool b3 = app.SegmentFillColor(0xFFFFFF);
				}
			}
		}
Is it a bug or I do not use it properly,
Thanks,
Alex.





Viewing all articles
Browse latest Browse all 5347

Trending Articles



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