List all Fortress work items

Post your questions regarding using the Vault and Fortress API in your programs.

Moderator: SourceGear

Post Reply
DetroitJ
Posts: 19
Joined: Fri Sep 26, 2008 12:10 pm
Location: Morrisville, NC
Contact:

List all Fortress work items

Post by DetroitJ » Mon Oct 20, 2008 1:01 pm

I can't seem to find a method in the API to list all the items for a project. There is a ProcessCommandListMyOpenFortressItems and ProcessCommandListOpenFortressItems method but these only show open items. Is there a way to do this from the API?

shannon

Re: List all Fortress work items

Post by shannon » Mon Oct 20, 2008 1:08 pm

Those are just convenience functions for the queries we run most often. You'd want to construct a MantisItemQueryFilter and pass it to ProcessCommandQueryFortressItems. Let me know if you need more help than that to get going.

DetroitJ
Posts: 19
Joined: Fri Sep 26, 2008 12:10 pm
Location: Morrisville, NC
Contact:

Re: List all Fortress work items

Post by DetroitJ » Mon Oct 20, 2008 1:18 pm

I saw that but I could not find an example or documentation of the MantisItemQueryFilter. Basically, I want a list of all items for a given project id/name sorted by last modified date. If there is any docs or links you can point me to that would be great. Thank you.

DetroitJ
Posts: 19
Joined: Fri Sep 26, 2008 12:10 pm
Location: Morrisville, NC
Contact:

Re: List all Fortress work items

Post by DetroitJ » Mon Oct 20, 2008 1:31 pm

I did manage to piece together a MantisItemQueryFilter. I only specified the Project ID and it seemed to give me the results I was expecting except for the sorting. Any docs or examples would still be handy though. Thanks again for the help.

shannon

Re: List all Fortress work items

Post by shannon » Mon Oct 20, 2008 1:35 pm

I didn't run this or anything, so forgive me if there are any small typos. Fill in your values and give it a try:

MantisItemQueryFilter qf = new MantisItemQueryFilter();
qf.ProjectLevelFilterID = <yourProjID>;
qf.Types = new int[] {<openItemType>.ID}; // get this from ProcessCommandListFortressItemTypes, just loop over those and get the one you want
MantisItemQuerySort sort = new MantisItemQuerySort(MantisLib.ItemSortType.LAST_MODIFIED);
qf.Sorts = new MantisItemQuerySort[] {sort};

DetroitJ
Posts: 19
Joined: Fri Sep 26, 2008 12:10 pm
Location: Morrisville, NC
Contact:

Re: List all Fortress work items

Post by DetroitJ » Mon Oct 20, 2008 1:53 pm

That was awesome. Now that I see an example it makes sense. Just hunting through the intellisense was getting annoying.

shannon

Re: List all Fortress work items

Post by shannon » Mon Oct 20, 2008 1:56 pm

Glad I could help.

Post Reply