Search code examples
trellomanatee.trello

Manatee Trello List All Organisations


I've been playing with Manatee.Trello and it is soooo awesome. Thank you Gregsdennis.

I can list the names of all of my open boards, along with their organisation, like so:

Dim myBoards = New Search(SearchFor.IsOpen, 100, SearchModelType.Boards)

For Each myBoard As Board In myBoards.Boards
    Response.Write(myBoard.Name & " - " & myBoard.Organization.Name & "<br/>")
Next

However, if I try the same with Organisations, the resulting count is always 0:

Dim myOrganisations = New Search(SearchFor.IsOpen, 20, SearchModelType.Organizations)

Response.Write(myOrganisations.Organizations.Count) 'this is 0

For Each myOrganisation As Organization In myOrganisations.Organizations
    Response.Write(myOrganisation.Name)
Next
' nothing written out

Does anyone have any ideas please? Thanks.


Solution

  • Thanks for using my library! I have recently had similar questions asked regarding the search, and it seems the issue (if it can be called that) is at Trello's end.

    They say that some of the search criteria are set up to only return cards. See the Oct 26 (2015) response by Stephen Fluin on their API dev board.

    Yes, there are a number of modifiers that restrict the results set to cards, including edited created is:archived and more.

    It's likely that is:open (how you would add the criteria on their site) is one of those.

    This seems to be by design since Organizations (now they're called Teams) can't be closed, only deleted. Boards can be closed, lists and cards can be archived. I expect these would respond well to the is:open search.

    Instead of performing a search, try simply enumerating the Member.Organizations property (use Member.Me.Organizations for the user who owns the token). This will list all of the organizations to which the user belongs. [This is dead now. See Edit 1.] Also, there are a number of extension methods that can be used on these properties to filter the results.

    Edit 1

    As of version 3.0, the filtering functionality has been moved from an extension method to a new Filter property on all collections.