问题
@dillenmeister I tried Trello.NET wrapper but it is always returning NULL after successfully accepting AppKey and Token. I'm sure that AppKey and Token are correct because when I deliberately entered wrong AppKey/Token then I got error.
Versions of packages I've installed are:
Trello.NET 0.6.2 Json.NET 7.0.1 RestSharp 105.1.0
Follwing is the assembly references on class level:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using TrelloNet;
using RestSharp;
using Newtonsoft.Json.Serialization;
public partial class TestTrello : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ITrello trello = new Trello("[AppKey]");
trello.Authorize("[Token]");
// Get a board
Board theTrelloDevBoard = trello.Boards.WithId("[boardId]");
string boardName = theTrelloDevBoard.Name;
}
}
So, what is it I'm missing to get it work?
回答1:
It looks like there's a color enum that is missing some colors. That causes an exception when you're trying to download board data. There's several pull requests open to rectify the issue, but the creator hasn't merged one yet, probably because all of the PRs cause the test suite to fail.
As a quick workaround, you can clone the repository:
git clone https://github.com/dillenmeister/Trello.NET.git
Update the Cards\Color.cs file
public enum Color
{
Green, Yellow, Orange, Red, Purple, Blue, Turquoise, Lightgreen, Pink, Sky, Lime, Black
}
..and then build the project in Visual Studio. Add the resulting TrelloNet.dll as a reference in your project, and you should be able to get board data.
Update
Via @ajwaka's comment: Nuget has TrelloNet.Temp.Fork by the same dev and it seems to work.
来源:https://stackoverflow.com/questions/31447368/trello-net-objects-returning-null