Frage

I've an addin for microsoft project that loads data into a microsoft project sheet.

I was wondering if it's possible to create a customfield in VS with a lookup list.

This is how you do it in microsoft project: http://www.youtube.com/watch?v=ZML9IyoPY7Y (dropdownlist)

But I want my code to do it for me. So when I press on the load button in my addin it should automatically create the list.

War es hilfreich?

Lösung

I actually found the solution for it. After some headbanging.

myproject.Application.CustomFieldRename(PjCustomField.pjCustomTaskText12, "columnName");                       
myproject.Application.CustomFieldPropertiesEx(PjCustomField.pjCustomTaskText12, PjCustomFieldAttribute.pjFieldAttributeValueList);
myproject.Application.CustomFieldValueListAdd(PjCustomField.pjCustomTaskText12, "ListValue");

Andere Tipps

This link MSDN Article about working with Local Custom Fields and Lookup Tables from UI and VBA. This article is for Project 2007, but VBA wasn't change since that time.

Here is a reference to LookupTable from Project 2010 documentation

And also there is no too much difference between VBA and C#, if you plan to use VSTO Add-In. The only thing about C#: don't forget to release any reference to COM explicitly using Marshal.ReleaseComObject Garbage Collector does not free these kind of resources.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top