How to connect to ITeamFoundationServerProxy dll

Topics: For TFSAdmin Developers
Jun 20, 2011 at 10:33 PM
Edited Jun 21, 2011 at 2:57 PM

I'm trying to create TFS projects and add users to roles in sharepoint and reporting services from a Silverlight applicaton.

I don't know if there is an easy way to do this.  I'm trying the below from a Silverlight app but get an exception.

I believe the TeamProjects collection in the iTFSProxy is null.  So maybe I have to do something to fill that collection or maybe I'm not connecting properly.

           TFSAdministrationTool.Proxy.ITeamFoundationServerProxy iTFSProxy = TFSAdministrationTool.Proxy.TeamFoundationServerProxyFactory.CreateProxy();
            iTFSProxy.Connect(new Uri(collectionUrl), System.Net.CredentialCache.DefaultNetworkCredentials);
            iTFSProxy.SelectTeamProject(teamProjectName);    this causes exception

            iTFSProxy.SharePointAddUserToRole(teamProjectName, "TFS-" + teamProjectName + "-Developers", "Web Designer");
            iTFSProxy.ReportingServiceAddUserToRole(teamProjectName, "TFS-" + teamProjectName + "-Developers", "Browser");

 

System.NullReferenceException was unhandled by user code
  Message=Object reference not set to an instance of an object.
  Source=TFSAdministrationTool.Proxy
  StackTrace:
       at TFSAdministrationTool.Proxy.SharePointProxy.GetVersion() in D:\Work\TFSAdmin\Main\src\TFSAdministrationTool.Proxy\SharePointProxy.cs:line 264
       at TFSAdministrationTool.Proxy.SharePointProxy..ctor(String url, SiteStatus status, ICredentials credentials) in D:\Work\TFSAdmin\Main\src\TFSAdministrationTool.Proxy\SharePointProxy.cs:line 67
       at TFSAdministrationTool.Proxy.SharePointProxyFactory.CreateRealProxy(String url, SiteStatus status, ICredentials credentials) in D:\Work\TFSAdmin\Main\src\TFSAdministrationTool.Proxy\SharePointProxy.cs:line 31
       at TFSAdministrationTool.Proxy.TeamFoundationServerProxy.InitializeTeamProjectProxy(String teamProject) in D:\Work\TFSAdmin\Main\src\TFSAdministrationTool.Proxy\TeamFoundationServerProxy.cs:line 208
       at TFSAdministrationTool.Proxy.TeamFoundationServerProxy.SelectTeamProject(String name) in D:\Work\TFSAdmin\Main\src\TFSAdministrationTool.Proxy\TeamFoundationServerProxy.cs:line 490
       at TfsTools.Web.Services.TfsService.AddProjectWindowsGroups(String collectionUrl, String teamProjectName, Boolean isSensitiveProject) in D:\TFS\Common\TfsTools\TfsTools.Web\Services\TfsService.cs:line 118
       at TfsTools.Web.Services.TfsService.AddProjectWindowsGroups(String teamProjectName, Boolean isSensitiveProject) in D:\TFS\Common\TfsTools\TfsTools.Web\Services\TfsService.cs:line 139
       at AddProjectWindowsGroups(DomainService , Object[] )
       at System.ServiceModel.DomainServices.Server.ReflectionDomainServiceDescriptionProvider.ReflectionDomainOperationEntry.Invoke(DomainService domainService, Object[] parameters)
       at System.ServiceModel.DomainServices.Server.DomainService.Invoke(InvokeDescription invokeDescription, IEnumerable`1& validationErrors)
  InnerException: