Método IOrganizationService.Associate
Se aplica a: CRM 2015 on-prem, CRM Online
Creates a link between records.
Espacio de nombres: Microsoft.Xrm.Sdk
Ensamblado: Microsoft.Xrm.Sdk (en Microsoft.Xrm.Sdk.dll)
Sintaxis
'Declaración
<FaultContractAttribute(GetType(OrganizationServiceFault))> _
<OperationContractAttribute> _
Sub Associate ( _
entityName As String, _
entityId As Guid, _
relationship As Relationship, _
relatedEntities As EntityReferenceCollection _
)
[FaultContractAttribute(typeof(OrganizationServiceFault))]
[OperationContractAttribute]
void Associate (
string entityName,
Guid entityId,
Relationship relationship,
EntityReferenceCollection relatedEntities
)
Parámetros
- entityName
Type: Cadena. The logical name of the entity that is specified in the entityId parameter.
- entityId
Type: Guid. El identificador del registro to which the related records are associated.
- relationship
Type: Relationship. The name of the relationship to be used to create the link.
- relatedEntities
Type: EntityReferenceCollection. Una recopilación de referencias de entidad (referencias a registros) to be associated.
Ejemplo
The following example shows how to use the Associate method to create an association or link between records. For this sample to work correctly, you must be connected to the server to get an IOrganizationService interface. You can find the complete sample in the sample code package in the folder SampleCode\CS\GeneralProgramming\LateBound\AssociateDisassociateDE.cs
.
Comentarios
Message Availability
Este mensaje funciona independientemente de si el autor de la llamada está conectado al servidor o no.
Privileges and Access Rights
To perform this action, the caller must have privileges on the entity that is specified in the entityName parameter and access rights on the record that is specified in the entityId parameter. For a list of the required privileges, see Associate Privileges.
Notes for Callers
This method creates multiple associations in one transaction between the record that is specified by the entityId parameter and each record in the relatedEntities parameter for the specified relationship in the relationship parameter.
For a one-to-many relationship, this method sets the ReferencingAttribute in the related record to the value of the entityId.
For a many-to-many relationship, this method creates a record in the intersect table for the relationship, which contains the ID of both the referenced and referencing records. The intersect table name is defined in the IntersectEntityName property for the relationship. You need this when you query for the records. However, you need the relationship name to set the Relationship property. This name is defined in the SchemaName property for the relationship.
For more information about the exceptions that can be thrown when this method is called, see Handle Exceptions in Your Code.
Supported Entities
You can use this method to associate any records that participate in a relationship, including records for custom entities.
Seguridad de hilo
Los miembros estáticos públicos (Shared en Visual Basic) de este tipo son seguros para el hilo. No se garantiza que los miembros de instancia sean seguros para el hilo.
Plataformas
Plataformas de desarrollo
Windows Vista, Windows Server 2003 y
Plataformas de destino
Windows Vista,Windows XP
Vea también
Referencia
Interfaz de IOrganizationService
Miembros de IOrganizationService
Espacio de nombres de Microsoft.Xrm.Sdk
Entity Metadata
AssociateRequest
AssociateResponse
Assign
Otros recursos
Customize Entity Relationship Metadata
Sample: Associate (Early Bound)
Handle Exceptions in Your Code
Troubleshooting and Error Handling
Send comments about this topic to Microsoft.
© 2014 Microsoft Corporation. All rights reserved.