ProjectServer.Projects-Eigenschaft
Ruft die Auflistung von Projekten in der Project Web App -Instanz.
Namespace: Microsoft.ProjectServer.Client
Assembly: Microsoft.ProjectServer.Client (in Microsoft.ProjectServer.Client.dll)
Syntax
'Declaration
<RemoteAttribute> _
Public ReadOnly Property Projects As ProjectCollection
Get
'Usage
Dim instance As ProjectServer
Dim value As ProjectCollection
value = instance.Projects
[RemoteAttribute]
public ProjectCollection Projects { get; }
Eigenschaftswert
Typ: Microsoft.ProjectServer.Client.ProjectCollection
Eine Auflistung von Project -Objekten.
Hinweise
Project-Entität enthält zusätzliche Entitätstypen, wie Aufgaben, Ressourcen und Zuordnungen.
Beispiele
Hinweis
Es wird empfohlen, dass Sie anstelle der ProjectServerProjectContext -Objekts verwenden.
Das folgende Beispiel verwendet das ProjectServer -Objekt die veröffentlichten Projekte in Project Web Appaufgelistet. Die gleichen an, die das ProjectContext -Objekt verwendet, finden Sie unter ProjectContext.Projects. Informationen zum Erstellen einer einfachen CSOM-Anwendung im Microsoft Visual Studiofinden Sie unter Microsoft.ProjectServer.Client.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.Client;
using Microsoft.ProjectServer.Client;
namespace ReadProjectList
{
class Program
{
private const string pwaPath = "https://ServerName/PwaName/"; // Change the path for Project Web App.
private static ProjectServer projSvr;
private static ClientRuntimeContext context;
static void Main(string[] args)
{
context = new ClientContext(pwaPath);
projSvr = new ProjectServer(context);
// Get the list of published projects in Project Web App.
context.Load(projSvr.Projects);
context.ExecuteQuery();
Console.WriteLine("\nProject ID : Project name : Created date");
foreach (PublishedProject pubProj in projSvr.Projects)
{
Console.WriteLine("\n\t{0}\n\t{1} : {2}", pubProj.Id.ToString(), pubProj.Name,
pubProj.CreatedDate.ToString());
}
Console.Write("\nPress any key to exit: ");
Console.ReadKey(false);
}
}
}