President Camacho
President Camacho

Reputation: 1920

VSTO Microsoft Project 2010. Create a CustomField with a lookup list?

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.

Upvotes: 0

Views: 1537

Answers (2)

President Camacho
President Camacho

Reputation: 1920

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");

Upvotes: 1

melan
melan

Reputation: 1718

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.

Upvotes: 0

Related Questions