: Application.GetGroupApplicationGroup (Método) (Microsoft.SharePoint.Portal.SingleSignon)
Gets a Microsoft Windows NT Domain\Group account associated with a group enterprise application definition.
Espacio de nombres:
Ensamblado: Microsoft.SharePoint.Portal.SingleSignon (in microsoft.sharepoint.portal.singlesignon.dll)
Sintaxis
'Declaración
<SingleSignonPermissionAttribute(SecurityAction.Demand, Access:=SingleSignonAccess.Minimal)> _
Public Shared Sub GetGroupApplicationGroup ( _
strApplicationName As String, _
ByRef strGroupName As String _
)
'Uso
Dim strApplicationName As String
Dim strGroupName As String
Application.GetGroupApplicationGroup(strApplicationName, strGroupName)
[SingleSignonPermissionAttribute(SecurityAction.Demand, Access=SingleSignonAccess.Minimal)]
public static void GetGroupApplicationGroup (
string strApplicationName,
ref string strGroupName
)
Parámetros
- 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 maximum number of allowed characters is 128.
- strGroupName
The SSO group name.
Comentarios
Microsoft Single Sign-On service (SSOSrv) has two enterprise application definition types: group application and individual application. Use the GetGroupApplicationGroup method for the group application type. If the specified application definition name is not a group application, an Application Not Found error is returned. If the specified application definition name is a group application, but the credentials are not set, NULL is returned.
Only a member of the single sign-on admin group or an application manager can use the GetGroupApplicationGroup method.
The result of each call to the GetGroupApplicationGroup method is audited and stored in the single sign-on database. The ServiceAction enumeration recorded is GetApplication.
Ejemplo
The following code example shows how to use the GetGroupApplicationGroup method. To use this example, replace domain_name\\group_name
with a valid domain and group on your network.
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(
"MyGroupApplicationID",
"My Group Applicaiton Display Name",
Application.ApplicationType.Group,
"someone@someplace.someext");
//Now, add the application
Application.AddApplication(
App,
rgFields,
Application.ApplicationCreationDisposition.CreateNew);
Console.WriteLine("Successfully added the group application!");
//Next, add credentials for this group application.
string[] rgCredentialsData = new string[5];
rgCredentialsData[0] = "Data for field1";
rgCredentialsData[1] = "Data for field2";
rgCredentialsData[2] = "Data for field3";
rgCredentialsData[3] = "Data for field4";
rgCredentialsData[4] = "Data for field5";
Credentials.SetGroupCredentials(
"MyGroupApplicationID",
"domain_name\\group_name",
rgCredentialsData);
Console.WriteLine("Successfully added credentials to the group application");
//Get the group applications associated group account name.
string strGroupName = null;
Application.GetGroupApplicationGroup(
"MyGroupApplicationID",
ref strGroupName);
Console.WriteLine("Group account associated with this application is: " + strGroupName);
}
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);
}
}
}
}
Vea también
Referencia
Application (Clase)
Application (Miembros)
Microsoft.SharePoint.Portal.SingleSignon (Espacio de nombres)