none
How to read the list of projects using PSI that using a administrator account in the console application. RRS feed

  • Question

  •             private SvcProject.ProjectClient _project;
                const int MAXSIZE = 500000000;
                string svcRouter = "http://192.168.1.90/pwa/_vti_bin/PSI/ProjectServer.svc";
                BasicHttpBinding binding = null;

                if (string.Compare(svcRouter.Substring(0, 5), "https", true) == 0)
                {
                    binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
                }
                else
                {
                    binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);
                }
                binding.Name = "basicHttpConf";
                binding.SendTimeout = TimeSpan.MaxValue;
                binding.MaxReceivedMessageSize = MAXSIZE;
                binding.ReaderQuotas.MaxNameTableCharCount = MAXSIZE;
                binding.MessageEncoding = WSMessageEncoding.Text;
                binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;

                EndpointAddress address = new EndpointAddress(svcRouter);
                _project = new SvcProject.ProjectClient(binding, address);
                _project.ClientCredentials.UserName.UserName = @"company\administrator";
                _project.ClientCredentials.UserName.Password = "password";
               
                 SvcProject.ProjectDataSet projectDs = _project.ReadProjectStatus(
                      Guid.Empty, SvcProject.DataStoreEnum.WorkingStore,
                      string.Empty, (int)PSLibrary.Project.ProjectType.Project);

     

    Is there any way to use the administrator account to get all the projects info?

    Friday, May 20, 2011 5:47 AM

Answers