我想通过.NET client libraries for VSTS (and TFS)访问和更改我的TFS通知。例如,我能够获得给定变更集编号的变更集详细信息,如下所示:
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri("http://..."));
tpc.EnsureAuthenticated();
var vcs = tpc.GetService<VersionControlServer>();
var changeset = vcs.GetChangeset(378418);
我希望能够在同一庄园中访问我的通知
var ns = tpc.GetService<NotificationSubscription>();
但ns
为空,所以可能不是这样的。我该怎么做呢?
答案 0 :(得分:1)
您可以将TFS rest api用于update an existing Notification subscription:
PATCH http://TFS2017:8080/tfs/DefaultCollection/_apis/notification/subscriptions/{subscriptionId}?api-version=3.2-preview
Content-Type: application/json
{
...
}
我已经在我身边测试过,它正在发挥作用。
Rest Api比SOAP api更简单。要使用SOAP api,您需要使用GetService<IEventService>
,请查看此案例以获取更多信息:TFS 2015 Alert API: Create an alert for Team or TFS Group。