Trello C#api,.Boards.WithId()和.Members.Me()始终为空

时间:2015-04-30 12:32:34

标签: c# trello trello.net

我开始使用C#Trello API。我创建了简单的控制台应用程序,并首先运行它以获取访问令牌:

static void GetToken()
{
     ITrello trello = new Trello("application key");
     var url = trello.GetAuthorizationUrl("Test api", Scope.ReadWrite, Expiration.Never);
     Process.Start(url.ToString());
}

Process.Start打开了我的默认浏览器实例,我允许访问该应用程序,并在下一页获得了我的令牌。然后我对令牌进行了硬编码并尝试实现this example

static void Main(string[] args)
{
     ITrello trello = new Trello("application key");
     trello.Authorize(token); // hardcoded token

     Member me = trello.Members.Me();
     Console.WriteLine(me.FullName);
}

me始终为空。我错过了什么?授权失败了吗?如果是这样,我为什么不得TrelloNet.TrelloUnauthorizedException

编辑: 过了一会儿,我发现了this thread项目中包含的关于Json.NET版本的一些建议,所以我更新了Json.NET,现在我得到了TrelloNet.TrelloException,没有留言:< / p>

Member me = trello.Members.Me();

TrelloNet.TrelloException without any message

StackTrace:

at TrelloNet.Internal.TrelloRestClient.ThrowIfRequestWasUnsuccessful(IRestRequest request, IRestResponse response)
   at TrelloNet.Internal.TrelloRestClient.Request[T](IRestRequest request)
   at TrelloNet.Internal.Members.Me()
   at ConsoleApplication1.Program.Main(String[] args) in f:\Dropbox\Projects\TrelloManager\ConsoleApplication1\Program.cs:line 26
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

1 个答案:

答案 0 :(得分:2)

这可能会有所帮助。我遇到了同样的问题null。我发现获取某些组件的最新版本解决了这个问题。

看到这篇文章: Trello.Net authorisation works but cannot access data once authorised