Application.GetApplication, méthode (Microsoft.SharePoint.Portal.SingleSignon)
Gets the enterprise application definition.
Espace de noms : Microsoft.SharePoint.Portal.SingleSignon
Assembly : Microsoft.SharePoint.Portal.SingleSignon (dans microsoft.sharepoint.portal.singlesignon.dll)
Syntaxe
'Déclaration
Public Shared Sub GetApplication ( _
strApplicationName As String, _
ByRef App As ApplicationInfo _
)
'Utilisation
Dim strApplicationName As String
Dim App As ApplicationInfo
Application.GetApplication(strApplicationName, App)
public static void GetApplication (
string strApplicationName,
ref ApplicationInfo App
)
Paramètres
- strApplicationName
The name of the enterprise application definition associated with this NTDomain\Group
account name. This is not the enterprise application definition friendly name. The string must be at least 1 character and no more than 128 characters long. If strApplicationName parameter does not exist in the single sign-on database, a SingleSignonException error is thrown.
- App
The ApplicationInfo object that contains the enterprise application definition.
Remarques
All users can call the GetApplication method. The result of each call to the GetApplication method is audited and stored in the single sign-on database. The ServiceAction enumeration recorded is GetApplication.
Exemple
The following code example shows how to use the GetApplication method.
using System;
using Microsoft.SharePoint.Portal.SingleSignon;
namespace SSOSampleCode
{
/// <summary>
/// Sample code for SharePoint Portal Single SignOn.
/// </summary>
class CMainEntry
{
[STAThread]
static void Main(string[] args)
{
try
{
//Create the application fields (max 5 fields).
Application.ApplicationField[] rgFields = new Application.ApplicationField[5];
rgFields[0] = new Application.ApplicationField(
"Field1 Label", //Application field name
true); //true == mask in the UI, false == don't mask in the UI
rgFields[1] = new Application.ApplicationField(
"Field2 Label",
false);
rgFields[2] = new Application.ApplicationField(
"Field3 Label",
true);
rgFields[3] = new Application.ApplicationField(
"Field4 Label",
false);
rgFields[4] = new Application.ApplicationField(
"Field5 Label",
true);
//Create group application information data.
Application.ApplicationInfo App = new Application.ApplicationInfo(
"MyIndividualApplicationID",
"My Individual Applicaiton Display Name",
Application.ApplicationType.Individual,
"someone@someplace.someext");
//Now, add the application.
Application.AddApplication(
App,
rgFields,
Application.ApplicationCreationDisposition.CreateNew);
Console.WriteLine("Successfully added the individual application!");
//Get the application.
Application.ApplicationInfo MyApp = null;
Application.GetApplication(
"MyIndividualApplicationID",
ref MyApp);
Console.WriteLine("Application Information:");
Console.WriteLine("Application ID: " + MyApp.ApplicationName);
Console.WriteLine("Application friendly name: " + MyApp.ApplicationFriendlyName);
Console.WriteLine("Application contact: " + MyApp.ContactName);
Console.WriteLine("Application type: " + MyApp.Type);
//Now, delete the application.
Application.DeleteApplication("MyIndividualApplicationID");
Console.WriteLine("Successfully deleted the individual application!");
}
catch (SingleSignonException esso)
{
Console.WriteLine("SingleSignonException caught.");
Console.WriteLine("Exception Code: " + "0x" + esso.LastErrorCode.ToString("x"));
Console.WriteLine("Source: " + esso.Source);
Console.WriteLine("StackTrace: " + esso.StackTrace);
Console.WriteLine("MethodName: " + esso.TargetSite.Name);
Console.WriteLine("Message: " + esso.Message);
}
catch (Exception e)
{
Console.WriteLine("Exception caught.");
Console.WriteLine("Source: " + e.Source);
Console.WriteLine("StackTrace: " + e.StackTrace);
Console.WriteLine("MethodName: " + e.TargetSite.Name);
Console.WriteLine("Message: " + e.Message);
}
}
}
}
Voir aussi
Référence
Application, classe
Membres Application
Microsoft.SharePoint.Portal.SingleSignon, espace de noms