我遇到了VersionOneAPIClient的一个问题,因为它不会识别任何我给它的资产类型。我理解属性定义可能没有任何意义,但我一直在尝试几乎所有的东西。我的最终目标是查询TeamRooms并从队伍中的所有团队获取团队名称。VersionOne API客户端不识别资产类型?
这是我的理解从asset types和how to query的文档,这应该工作,但这就是我们都说。
我使用: C#ASP.NET,VersionOneAPIClient 15.0.0.0
弦乐我曾尝试:
- 工作室
- 任务
- 范围
项目
public bool APIgetTeams() { IAssetType teamroomType = services.Meta.GetAssetType("Task"); Query query = new Query(teamroomType); IAttributeDefinition teamAttribute = teamroomType.GetAttributeDefinition("Children:Room.Team.Name"); query.Selection.Add(teamAttribute); IAttributeDefinition scheduleAttribute = teamroomType.GetAttributeDefinition("Children:Scope.Room.Schedule.Name"); query.Selection.Add(scheduleAttribute); query.Find = new QueryFind(scheduleName, new AttributeSelection(scheduleAttribute)); query.Paging.PageSize = 1; query.Paging.PageSize = 0; teamRoomAsset = (Asset)services.Retrieve(query).Assets.ToArray().GetValue(0); return true; }
我的服务和接口的定义:
public static V1Connector connector = V1Connector
.WithInstanceUrl("http://versionone.cscinfo.com/VersionOneProd/")
.WithUserAgentHeader("New Dashboard?", "1.0")
.WithWindowsIntegrated()
.Build();
public IServices services = new Services(connector);
这些都是我的错误/堆栈跟踪:
的错误是在我的脸上可能简单而正确的,但我无法弄清楚。
你永远不会明白我是多么感激你的指导。 – Griffin
发现问题。我正在使连接器变成静态的,这样它就可以通过服务,并且这样做可以打破所有问题。我应该看到这一点。 – Griffin
我在Java中遇到同样的问题,我想知道为什么连接器是静态的会很重要,因为我也将它抽象为一个单独的静态实用类。你能澄清吗? –