问题描述
我一直在使用 Greg Dennis 的 Manatee.Trello 库,但最近我需要在板上移动卡片。不幸的是,我没有成功地将一张卡片从一个列表中的一个列表移到另一个列表中。得知开发者决定停止支持 Manatee.Trello 时,我有点沮丧。
我有两个不同的测试用例,但都不起作用。 最终目标是根据卡片描述中包含的值搜索卡片,然后将该卡片移动到同一版块中的不同列表。
当我尝试分配新列表时,以下内容引发异常:
Exception:
'' is not a valid value.
Stack trace:
at Manatee.Trello.Internal.Field`1.Validate(T value)
at Manatee.Trello.Internal.Field`1.set_Value(T value)
at Manatee.Trello.Card.set_List(IList value)
at [my project].TrelloTestTwo() in [my code location]:line 333
Private Sub TrelloTestTwo()
TrelloAuthorization.Default.AppKey = AppSettings("TrelloAppKey")
TrelloAuthorization.Default.UserToken = AppSettings("TrelloDefaultUserToken")
Dim Query As String = "TN9999999"
Dim FoundCard As Manatee.Trello.Card
Dim TheNextList As Manatee.Trello.List
Dim Descr As String
Board.DownloadedFields = Board.Fields.Description Or Board.Fields.Labels Or Board.Fields.CustomFields Or Board.Fields.ShortLink Or Board.Fields.ShortUrl Or Board.Fields.Url Or Board.Fields.Lists Or Board.Fields.Cards
Dim bd As Manatee.Trello.Board = New Board("[TheBoardIDFromTrello]")
Dim srch As Search = New Search(Query,100,SearchModelType.Cards,nothing,True)
bd.Refresh.Wait()
TheNextList = bd.Lists.Item("[TheListIDFromTrello]")
srch.Refresh.Wait()
' this is just a quick and dirty loop right Now
' I understand it is not "safe" or "clean"
For Each FoundCard In srch.Cards
Descr = FoundCard.Description
If (Descr = "thevalue") Then Exit For
Next
'THIS THROWS AN EXCEPTION
Try
FoundCard.List = TheNextList
Catch ex As Exception
Stop
End Try
End Sub
以下不会抛出异常,但 Card 不会移动到指定的列表。
Private Sub TrelloTestOne()
TrelloAuthorization.Default.AppKey = AppSettings("TrelloAppKey")
TrelloAuthorization.Default.UserToken = AppSettings("TrelloDefaultUserToken")
Dim EditCard As Manatee.Trello.Card
Dim TheNextList As Manatee.Trello.List
Dim Descr As String
Board.DownloadedFields = Board.Fields.Description Or Board.Fields.Labels Or Board.Fields.CustomFields Or Board.Fields.ShortLink Or Board.Fields.ShortUrl Or Board.Fields.Url Or Board.Fields.Lists Or Board.Fields.Cards
Dim bd As Manatee.Trello.Board = New Board("[TheBoardIDFromTrello]")
bd.Refresh.Wait()
TheNextList = bd.Lists.Item("[TheListIDFromTrello]")
EditCard = bd.Cards.Item("[TheCardIDFromTrello]")
'This does not throw an exception,but the card does not move to the specified list
Try
EditCard.List = TheNextList
Catch ex As Exception
Stop
End Try
End Sub
在这两种情况下,Card 和 List 对象都是有效的对象 - 即它们不是 nothing。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)