Compartilhar via


Statusing.GetNewTaskCount método

Obtém o número de novas atribuições para o usuário atual.

Namespace:  WebSvcStatusing
Assembly:  ProjectServerServices (em ProjectServerServices.dll)

Sintaxe

'Declaração
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Statusing/GetNewTaskCount", RequestNamespace := "https://schemas.microsoft.com/office/project/server/webservices/Statusing/",  _
    ResponseNamespace := "https://schemas.microsoft.com/office/project/server/webservices/Statusing/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function GetNewTaskCount As Integer
'Uso
Dim instance As Statusing
Dim returnValue As Integer

returnValue = instance.GetNewTaskCount()
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Statusing/GetNewTaskCount", RequestNamespace = "https://schemas.microsoft.com/office/project/server/webservices/Statusing/", 
    ResponseNamespace = "https://schemas.microsoft.com/office/project/server/webservices/Statusing/", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public int GetNewTaskCount()

Valor retornado

Tipo: System.Int32

Comentários

Permissões do Project Server

Nenhuma permissão especial aplicada. Este método lê os dados para somente o logon de recurso atual.

Exemplos

O exemplo a seguir lê a nova contagem de tarefa para o usuário atual e exibe-os. Para obter algumas novas tarefas, execute o exemplo no tópico de método CreateNewAssignment para gerá-los.

For critical information about running this code example, see Prerequisites for ASMX-Based Code Samples.

using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Data;
using System.Web.Services.Protocols;
using System.Threading;
using PSLibrary = Microsoft.Office.Project.Server.Library;

namespace Microsoft.SDK.Project.Samples.GetNewTaskCount
{
   class Program
   {
      [STAThread]
      static void Main()
      {
         try
         {
            #region Setup
            const string PROJECT_SERVER_URI = "https://ServerName/ProjectServerName/"; // <<--Change to match your project server and directory
            const string STATUSING_SERVICE_PATH = "_vti_bin/psi/statusing.asmx";

            // Set up the services.
            SvcStatusing.Statusing statusingSvc = new SvcStatusing.Statusing();
            statusingSvc.UseDefaultCredentials = true;
            statusingSvc.Url = PROJECT_SERVER_URI + STATUSING_SERVICE_PATH;
            #endregion

            int newTaskCount = statusingSvc.GetNewTaskCount();


            Console.WriteLine("You have {0} new tasks.", newTaskCount);
         }

         catch (SoapException ex)
         {
            ExceptionHandlers.HandleSoapException(ex);
         }
         catch (WebException ex)
         {
            ExceptionHandlers.HandleWebException(ex);
         }
         catch (Exception ex)
         {
            ExceptionHandlers.HandleException(ex);
         }
         finally
         {
            ExceptionHandlers.ResetConsole();
         }
      }
   }

   class ExceptionHandlers
   {

      public static void HandleSoapException(SoapException ex)
      {
         PSLibrary.PSClientError error = new PSLibrary.PSClientError(ex);
         PSLibrary.PSErrorInfo[] errors = error.GetAllErrors();
         string errMess = "==============================\r\nError: \r\n";
         for (int i = 0; i < errors.Length; i++)
         {
            errMess += "\n" + ex.Message.ToString() + "\r\n";
            errMess += "".PadRight(30, '=') + "\r\nPSCLientError Output:\r\n \r\n";
            errMess += errors[i].ErrId.ToString() + "\n";

            for (int j = 0; j < errors[i].ErrorAttributes.Length; j++)
            {
               errMess += "\r\n\t" + errors[i].ErrorAttributeNames()[j] + ": "
                  + errors[i].ErrorAttributes[j];
            }
            errMess += "\r\n".PadRight(30, '=');
         }
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine(errMess);
      }

      public static void HandleWebException(WebException ex)
      {
         string errMess = ex.Message.ToString() +
            "\n\nLog on, or check the Project Server Queuing Service";
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine("Error: " + errMess);
      }

      public static void HandleException(Exception ex)
      {
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine("Error: " + ex.Message);
      }

      public static void ResetConsole()
      {
         Console.ResetColor();
         Console.WriteLine("\r\n\r\nPress any key...");
         Console.ReadKey();
      }
   }
}

Ver também

Referência

Statusing classe

Statusing membros

WebSvcStatusing namespace