(String, String, Int32, ConnectionRunAt, Object, String, String, String) del método WebPart.RegisterInterface
NOTA: esta API está ahora obsoleta.
Registra una interfaz desde el espacio de nombres Microsoft.SharePoint.WebPartPages.Communication para un elemento Web conectable.
Espacio de nombres: Microsoft.SharePoint.WebPartPages
Ensamblado: Microsoft.SharePoint (en Microsoft.SharePoint.dll)
Sintaxis
'Declaración
<ObsoleteAttribute("Use ConnectionProvider or ConnectionConsumer attribute to create ConnectionPoint instead.")> _
Protected Sub RegisterInterface ( _
interfaceName As String, _
interfaceType As String, _
maxConnections As Integer, _
runAtOptions As ConnectionRunAt, _
interfaceObject As Object, _
interfaceClientReference As String, _
menuLabel As String, _
description As String _
)
'Uso
Dim interfaceName As String
Dim interfaceType As String
Dim maxConnections As Integer
Dim runAtOptions As ConnectionRunAt
Dim interfaceObject As Object
Dim interfaceClientReference As String
Dim menuLabel As String
Dim description As String
Me.RegisterInterface(interfaceName, _
interfaceType, maxConnections, runAtOptions, _
interfaceObject, interfaceClientReference, _
menuLabel, description)
[ObsoleteAttribute("Use ConnectionProvider or ConnectionConsumer attribute to create ConnectionPoint instead.")]
protected void RegisterInterface(
string interfaceName,
string interfaceType,
int maxConnections,
ConnectionRunAt runAtOptions,
Object interfaceObject,
string interfaceClientReference,
string menuLabel,
string description
)
Parámetros
interfaceName
Tipo: System.StringEl nombre descriptivo de la interfaz.
interfaceType
Tipo: System.StringEl tipo de la interfaz, como se muestra en los campos de la clase InterfaceTypes .
maxConnections
Tipo: System.Int32El límite especificado en el número de conexiones a esta interfaz. Puede ser LimitOneConnection o UnlimitedConnections.
runAtOptions
Tipo: Microsoft.SharePoint.WebPartPages.Communication.ConnectionRunAtUn ConnectionRunAt valorque especifica dónde se puede ejecutar la interfaz.
interfaceObject
Tipo: System.ObjectUna referencia a la interfaz implementada.
interfaceClientReference
Tipo: System.Stringstring que se usa para hacer referencia a la interfaz de la secuencia de comandos de conexiones de cliente, por ejemplo RowProviderInterface_WPQ_.
menuLabel
Tipo: System.StringLa etiqueta que se usará en la interfaz de usuario para crear una conexión de elementos Web con esta interfaz.
description
Tipo: System.StringUna breve descripción de la interfaz que se usará en la interfaz de usuario para crear una conexión de elementos Web con esta interfaz.
Comentarios
Al desarrollar un elemento Web conectable, debe llamar a este método una vez para cada interfaz en el método EnsureInterfaces para el elemento Web.
Este método es uno de los dos métodos sobrecargados RegisterInterface . No incluye el parámetro allowCrossPageConnection en su firma de función, lo que le permite especificar si se expone una interfaz de conexión en la interfaz de usuario de creación de entornos para la creación de una conexión entre dos páginas de elementos Web. En esta versión del método, el parámetro allowCrossPageConnection predeterminado es true para todas las interfaces de conexión que son compatibles con las reglas de compatibilidad de conexión definidas por la infraestructura de elementos Web y false para todas las interfaces de conexión.
Para especificar el parámetro allowCrossPageConnection , utilice el método [RegisterInterface(String,String,Int32,Microsoft.SharePoint.WebPartPages.Communication.ConnectionRunAt,object,String,String,String,Boolean)] en su lugar.
Ejemplos
En el ejemplo de código siguiente se muestra un método invalidado EnsureInterfaces que llama al método RegisterInterface . Este ejemplo de código forma parte de un ejemplo más extenso de la interfaz ICellProvider .
For an overview of the steps for creating a connectable Web Part, see Walkthrough: Creating a Connectable SharePoint Web Part.
' Step #4: Override the EnsureInterfaces() method and call the RegisterInterface method.
Public Overrides Sub EnsureInterfaces()
' If your Web Part is installed in the bin directory and the Code Access Security (CAS) setting doesn't
' allow Web Part Connections, an exception will be thrown. To allow your Web Part to behave
' well and continue working, a try/catch block should be used when attempting to register interfaces.
' Web Part Connections will only work if the level attribute of the <trust> tag in the
' web.config file is set to WSS_Minimal, WSS_Medium, or Full. By default a new SharePoint site
' is installed with the trust level set to WSS_Minimal.
Try
' Register the ICellProvider Interface
' <param name="interfaceName">Friendly name of the interface that is being implemented.
' It must be unique on the client so the _WPQ_ token is used.</param>
' <param name="interfaceType">Specifies which interface is being implemented.</param>
' <param name="maxConnections">Defines how many times this interface can be connected.</param>
' <param name="runAtOptions">Determines where the interface can run.</param>
' <param name="interfaceObject">Reference to the object that is implementing this interface.</param>
' <param name="interfaceClientReference">Name used to reference the interface on the client.
' It must be unique on the client so the _WPQ_ token is used.</param>
' <param name="menuLabel">Label for the interface which appears in the UI</param>
' <param name="description">Description of the interface which appears in the UI</param>
' <param name="allowCrossPageConnection">Specifies if the interface can connect to a Web Part
' on a different page. This is an optional parameter with a default of false. Note that only some
' server-side interfaces are allowed to connect across pages by the Web Part Infrastructure.
' The ICellProvider interface is not allowed to connect across pages.</param>
RegisterInterface("MyCellProviderInterface_WPQ_", InterfaceTypes.ICellProvider, WebPart.UnlimitedConnections, ConnectionRunAt.Server, Me, "CellProviderInterface_WPQ_", "Provide Cell To", "Provides a single value to a cell consumer Web Part.")
Catch se As SecurityException
_registrationErrorOccurred = True
End Try
End Sub
// Step #4: Override the EnsureInterfaces() method and call the RegisterInterface method.
public override void EnsureInterfaces()
{
// If your Web Part is installed in the bin directory and the Code Access Security (CAS) setting doesn't
// allow Web Part Connections, an exception will be thrown. To allow your Web Part to behave
// well and continue working, a try/catch block should be used when attempting to register interfaces.
// Web Part Connections will only work if the level attribute of the <trust> tag in the
// web.config file is set to WSS_Minimal, WSS_Medium, or Full. By default a new SharePoint site
// is installed with the trust level set to WSS_Minimal.
try
{
// Register the ICellProvider Interface
// <param name="interfaceName">Friendly name of the interface that is being implemented.
// It must be unique on the client so the _WPQ_ token is used.</param>
// <param name="interfaceType">Specifies which interface is being implemented.</param>
// <param name="maxConnections">Defines how many times this interface can be connected.</param>
// <param name="runAtOptions">Determines where the interface can run.</param>
// <param name="interfaceObject">Reference to the object that is implementing this interface.</param>
// <param name="interfaceClientReference">Name used to reference the interface on the client.
// It must be unique on the client so the _WPQ_ token is used.</param>
// <param name="menuLabel">Label for the interface which appears in the UI</param>
// <param name="description">Description of the interface which appears in the UI</param>
// <param name="allowCrossPageConnection">Specifies if the interface can connect to a Web Part
// on a different page. This is an optional parameter with a default of false. Note that only some
// server-side interfaces are allowed to connect across pages by the Web Part infrastructure.
// The ICellProvider interface is not allowed to connect across pages.</param>
RegisterInterface("MyCellProviderInterface_WPQ_", //InterfaceName
InterfaceTypes.ICellProvider, //InterfaceType
WebPart.UnlimitedConnections, //MaxConnections
ConnectionRunAt.Server, //RunAtOptions
this, //InterfaceObject
"CellProviderInterface_WPQ_", //InterfaceClientReference
"Provide Cell To", //MenuLabel
"Provides a single value to a cell consumer Web Part."); //Description
}
catch(SecurityException se)
{
_registrationErrorOccurred = true;
}
}