EnterpriseResource.GetSelf-Methode
Ruft den aktuell angemeldeten Benutzer ab.
Namespace: Microsoft.ProjectServer.Client
Assembly: Microsoft.ProjectServer.Client (in Microsoft.ProjectServer.Client.dll)
Syntax
'Declaration
<RemoteAttribute> _
Public Shared Function GetSelf ( _
Context As ClientRuntimeContext _
) As EnterpriseResource
'Usage
Dim Context As ClientRuntimeContext
Dim returnValue As EnterpriseResource
returnValue = EnterpriseResource.GetSelf(Context)
[RemoteAttribute]
public static EnterpriseResource GetSelf(
ClientRuntimeContext Context
)
Parameter
Context
Typ: Microsoft.SharePoint.Client.ClientRuntimeContextEin ClientRuntimeContext -Objekt.
Rückgabewert
Typ: Microsoft.ProjectServer.Client.EnterpriseResource
Die EnterpriseResource , der derzeit angemeldet ist.
Beispiele
Das folgende Beispiel ruft den Namen des Benutzers an.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.ProjectServer.Client;
namespace WhoAmI
{
class Program
{
private const string pwaPath = "https://ServerName/pwa/"; // Change the path for your Project Web App.
private static ProjectContext projContext;
static void Main(string[] args)
{
projContext = new ProjectContext(pwaPath);
// Load the application user, who must be an enterprise resource.
EnterpriseResource self = EnterpriseResource.GetSelf(projContext);
projContext.Load(self);
projContext.ExecuteQuery();
Console.WriteLine("I am: {0}", self.Name);
Console.Write("\nPress any key to exit: ");
Console.ReadKey(false);
}
}
}