Espacio de nombres: microsoft.graphNamespace: microsoft.graph
Importante
Las API de la /beta versión de Microsoft Graph están sujetas a cambios.APIs under the /beta version in Microsoft Graph are subject to change.No se admite el uso de estas API en aplicaciones de producción.Use of these APIs in production applications is not supported.Para determinar si una API está disponible en v1.0, usa el selector de versiones.To determine whether an API is available in v1.0, use the Version selector.
Agregar varios miembros a un grupo en una sola solicitud al equipo.Add multiple members in a single request to a team.La respuesta ofrece información detallada sobre qué pertenencias se pudieron o no crear.The response provides details about which memberships could and could not be created.
PermissionsPermissions
Se requiere uno de los siguientes permisos para llamar a esta API. Para obtener más información, incluido cómo elegir permisos, vea Permisos.One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
Tipo de permisoPermission type
Permisos (de menos a más privilegiados)Permissions (from least to most privileged)
Delegado (cuenta profesional o educativa)Delegated (work or school account)
TeamMember.ReadWrite.AllTeamMember.ReadWrite.All
Delegado (cuenta personal de Microsoft)Delegated (personal Microsoft account)
No admitidoNot supported
AplicaciónApplication
TeamMember.ReadWrite.AllTeamMember.ReadWrite.All
Solicitud HTTPHTTP Request
Esta es una acción vinculada para agregar varios elementos a una colección conversationMember en una sola solicitud.This is a bound action for adding multiple elements to a conversationMember collection in a single request.
POST /teams/{team-id}/members/add
Encabezados de solicitudRequest headers
EncabezadoHeader
ValorValue
AuthorizationAuthorization
{token} de portador. Obligatorio.Bearer {token}. Required.
Cuerpo de la solicitudRequest body
En el cuerpo de la solicitud, proporcione la representación JSON de la lista de derivados conversationMember que se debe agregar al equipo.In the request body, supply the JSON representation of the list of conversationMember derivatives that need to be added to the team.
La siguiente tabla muestra los parámetros que se pueden usar con esta acción.The following table shows the parameters that can be used with this action.
Lista de miembros de la conversación que se deben agregar.List of conversation members that should be added.
RespuestaResponse
Si se ejecuta correctamente, este método devuelve un código de respuesta 200 OK y la colección de derivados de un actionResultPart en el cuerpo de la respuesta.If successful, this action returns a 200 OK response code and a collection of derivatives of actionResultPart in the response body.
Esta API devuelve una respuesta 200 que indica que todos los miembros especificados se agregaron al equipo o una respuesta 207 que indica que solo algunos de los miembros proporcionados se agregaron al equipo.This API returns a 200 response indicating all members supplied were added to the team or a 207 response indicating that only some of the supplied members were added to the team.El autor de la llamada debe inspeccionar la carga de respuesta para determinar cuándo se produjeron errores al agregar miembros.The caller should inspect the response payload to determine which member additions failed.El cuerpo de la respuesta es una colección de derivados del recurso actionResultPart.The response body is a collection of derivatives of the actionResultPart resource.
EjemplosExamples
Ejemplo 1: agregar usuarios de forma masiva a un equipoExample 1: Add members in bulk to a team
SolicitudRequest
El ejemplo siguiente muestra una solicitud para agregar varios miembros a un equipo.The following example shows a request to add multiple members to a team.
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var values = new List<ConversationMember>()
{
new AadUserConversationMember
{
Roles = new List<String>()
{
},
AdditionalData = new Dictionary<string, object>()
{
{"user@odata.bind", "https://graph.microsoft.com/beta/users('18a80140-b0fb-4489-b360-2f6efaf225a0')"}
}
},
new AadUserConversationMember
{
Roles = new List<String>()
{
"owner"
},
AdditionalData = new Dictionary<string, object>()
{
{"user@odata.bind", "https://graph.microsoft.com/beta/users('86503198-b81b-43fe-81ee-ad45b8848ac9')"}
}
}
};
await graphClient.Teams["e4183b04-c9a2-417c-bde4-70e3ee46a6dc"].Members
.Add(values)
.Request()
.PostAsync();
Importante
Los SDK de Microsoft Graph usan la versión v 1.0 de la API de forma predeterminada y no admiten todos los tipos, las propiedades y las API disponibles en la versión beta.Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version.Para obtener más información sobre cómo obtener acceso a la API beta con el SDK, vea usar los SDK de Microsoft Graph con la API de la versión beta.For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Los SDK de Microsoft Graph usan la versión v 1.0 de la API de forma predeterminada y no admiten todos los tipos, las propiedades y las API disponibles en la versión beta.Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version.Para obtener más información sobre cómo obtener acceso a la API beta con el SDK, vea usar los SDK de Microsoft Graph con la API de la versión beta.For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Los SDK de Microsoft Graph usan la versión v 1.0 de la API de forma predeterminada y no admiten todos los tipos, las propiedades y las API disponibles en la versión beta.Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version.Para obtener más información sobre cómo obtener acceso a la API beta con el SDK, vea usar los SDK de Microsoft Graph con la API de la versión beta.For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
IGraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
LinkedList<ConversationMember> valuesList = new LinkedList<ConversationMember>();
AadUserConversationMember values = new AadUserConversationMember();
LinkedList<String> rolesList = new LinkedList<String>();
values.roles = rolesList;
values.additionalDataManager().put("user@odata.bind", new JsonPrimitive("https://graph.microsoft.com/beta/users('18a80140-b0fb-4489-b360-2f6efaf225a0')"));
valuesList.add(values);
AadUserConversationMember values1 = new AadUserConversationMember();
LinkedList<String> rolesList1 = new LinkedList<String>();
rolesList1.add("owner");
values1.roles = rolesList1;
values1.additionalDataManager().put("user@odata.bind", new JsonPrimitive("https://graph.microsoft.com/beta/users('86503198-b81b-43fe-81ee-ad45b8848ac9')"));
valuesList.add(values1);
ConversationMemberCollectionResponse conversationMemberCollectionResponse = new ConversationMemberCollectionResponse();
conversationMemberCollectionResponse.value = valuesList;
ConversationMemberCollectionPage conversationMemberCollectionPage = new ConversationMemberCollectionPage(conversationMemberCollectionResponse, null);
graphClient.teams("e4183b04-c9a2-417c-bde4-70e3ee46a6dc").members()
.add(valuesList)
.buildRequest()
.post();
Importante
Los SDK de Microsoft Graph usan la versión v 1.0 de la API de forma predeterminada y no admiten todos los tipos, las propiedades y las API disponibles en la versión beta.Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version.Para obtener más información sobre cómo obtener acceso a la API beta con el SDK, vea usar los SDK de Microsoft Graph con la API de la versión beta.For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
A continuación se muestra la respuesta.The following is the response.
Nota: se puede acortar el objeto de respuesta que se muestra aquí para mejorar la legibilidad.Note: The response object shown here might be shortened for readability.
Ejemplo 2: agregar miembros en masa y encontrar un error parcialExample 2: Add members in bulk and encounter partial failure
SolicitudRequest
El ejemplo siguiente muestra una solicitud para agregar varios miembros a un equipo que resulta en un error parcial.The following example shows a request to add multiple members to a team that results in a partial failure.
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var values = new List<ConversationMember>()
{
new AadUserConversationMember
{
Roles = new List<String>()
{
},
AdditionalData = new Dictionary<string, object>()
{
{"user@odata.bind", "https://graph.microsoft.com/beta/users('18a80140-b0fb-4489-b360-2f6efaf225a0')"}
}
},
new AadUserConversationMember
{
Roles = new List<String>()
{
"owner"
},
AdditionalData = new Dictionary<string, object>()
{
{"user@odata.bind", "https://graph.microsoft.com/beta/users('86503198-b81b-43fe-81ee-ad45b8848ac9')"}
}
}
};
await graphClient.Teams["e4183b04-c9a2-417c-bde4-70e3ee46a6dc"].Members
.Add(values)
.Request()
.PostAsync();
Importante
Los SDK de Microsoft Graph usan la versión v 1.0 de la API de forma predeterminada y no admiten todos los tipos, las propiedades y las API disponibles en la versión beta.Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version.Para obtener más información sobre cómo obtener acceso a la API beta con el SDK, vea usar los SDK de Microsoft Graph con la API de la versión beta.For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Los SDK de Microsoft Graph usan la versión v 1.0 de la API de forma predeterminada y no admiten todos los tipos, las propiedades y las API disponibles en la versión beta.Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version.Para obtener más información sobre cómo obtener acceso a la API beta con el SDK, vea usar los SDK de Microsoft Graph con la API de la versión beta.For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Los SDK de Microsoft Graph usan la versión v 1.0 de la API de forma predeterminada y no admiten todos los tipos, las propiedades y las API disponibles en la versión beta.Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version.Para obtener más información sobre cómo obtener acceso a la API beta con el SDK, vea usar los SDK de Microsoft Graph con la API de la versión beta.For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
IGraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
LinkedList<ConversationMember> valuesList = new LinkedList<ConversationMember>();
AadUserConversationMember values = new AadUserConversationMember();
LinkedList<String> rolesList = new LinkedList<String>();
values.roles = rolesList;
values.additionalDataManager().put("user@odata.bind", new JsonPrimitive("https://graph.microsoft.com/beta/users('18a80140-b0fb-4489-b360-2f6efaf225a0')"));
valuesList.add(values);
AadUserConversationMember values1 = new AadUserConversationMember();
LinkedList<String> rolesList1 = new LinkedList<String>();
rolesList1.add("owner");
values1.roles = rolesList1;
values1.additionalDataManager().put("user@odata.bind", new JsonPrimitive("https://graph.microsoft.com/beta/users('86503198-b81b-43fe-81ee-ad45b8848ac9')"));
valuesList.add(values1);
ConversationMemberCollectionResponse conversationMemberCollectionResponse = new ConversationMemberCollectionResponse();
conversationMemberCollectionResponse.value = valuesList;
ConversationMemberCollectionPage conversationMemberCollectionPage = new ConversationMemberCollectionPage(conversationMemberCollectionResponse, null);
graphClient.teams("e4183b04-c9a2-417c-bde4-70e3ee46a6dc").members()
.add(valuesList)
.buildRequest()
.post();
Importante
Los SDK de Microsoft Graph usan la versión v 1.0 de la API de forma predeterminada y no admiten todos los tipos, las propiedades y las API disponibles en la versión beta.Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version.Para obtener más información sobre cómo obtener acceso a la API beta con el SDK, vea usar los SDK de Microsoft Graph con la API de la versión beta.For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
A continuación se muestra la respuesta.The following is the response.
Nota: Se puede reducir el objeto de respuesta que se muestra aquí para mejorar la legibilidad.Note: The response object shown here might be shortened for readability.