Espacio de nombres: microsoft.graph
Importante
Las API de la versión /beta de Microsoft Graph están sujetas a cambios. No se admite el uso de estas API en aplicaciones de producción. Para determinar si una API está disponible en la versión 1.0, use el selector de Versión.
Determine si se permite una interacción de Microsoft Teams especificada entre el usuario que inició sesión y los usuarios especificados.
Nota: Todas las solicitudes a esta API se registran en los registros de auditoría de Microsoft 365 de los inquilinos donde existen los usuarios de destino especificados por el parámetro users . Para obtener más información, vea Auditar actividades de registro.
Esta API está disponible en las siguientes implementaciones nacionales de nube.
| Servicio global |
Gobierno de EE. UU. L4 |
Us Government L5 (DOD) |
China operada por 21Vianet |
| ✅ |
❌ |
❌ |
❌ |
Permissions
Elija el permiso o los permisos marcados como con privilegios mínimos para esta API. Use un permiso o permisos con privilegios superiores solo si la aplicación lo requiere. Para obtener más información sobre los permisos delegados y de aplicación, consulte Tipos de permisos. Para obtener más información sobre estos permisos, consulte la referencia de permisos.
| Tipo de permiso |
Permisos con privilegios mínimos |
Permisos con privilegios más altos |
| Delegado (cuenta profesional o educativa) |
TeamworkUserInteraction.Read.All |
No disponible. |
| Delegado (cuenta personal de Microsoft) |
No admitida. |
No admitida. |
| Aplicación |
No admitida. |
No admitida. |
Solicitud HTTP
POST /teamwork/determineIfInteractionIsAllowed
| Nombre |
Descripción |
| Authorization |
{token} de portador. Obligatorio. Obtenga más información sobre la autenticación y la autorización. |
| Content-Type |
application/json. Obligatorio. |
Cuerpo de la solicitud
En el cuerpo de la solicitud, proporcione una representación JSON de los parámetros.
En la tabla siguiente se muestran los parámetros que puede usar con esta acción.
Respuesta
Si se ejecuta correctamente, esta acción devuelve un 200 OK código de respuesta y un valor Boolean en el cuerpo de la respuesta.
Ejemplos
Ejemplo 1: Determinar si el usuario que ha iniciado sesión puede crear un chat con otro usuario en el mismo inquilino con su identificador
En el ejemplo siguiente se muestra una solicitud que determina si el usuario que inició sesión, autenticado a través del contexto delegado, puede crear un chat con otro usuario en el mismo inquilino especificando el identificador del otro usuario.
Solicitud
En el ejemplo siguiente se muestra la solicitud.
POST https://graph.microsoft.com/beta/teamwork/determineIfInteractionIsAllowed
{
"users":
[
{
"@odata.type": "microsoft.graph.teamworkUserIdentity",
"id": "59b5bc69-ca73-4ffd-a2e0-88a79115d13b"
}
],
"interactionType": "createChat"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Teamwork.DetermineIfInteractionIsAllowed;
using Microsoft.Graph.Beta.Models;
var requestBody = new DetermineIfInteractionIsAllowedPostRequestBody
{
Users = new List<Identity>
{
new TeamworkUserIdentity
{
OdataType = "microsoft.graph.teamworkUserIdentity",
Id = "59b5bc69-ca73-4ffd-a2e0-88a79115d13b",
},
},
InteractionType = TeamworkInteractionType.CreateChat,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Teamwork.DetermineIfInteractionIsAllowed.PostAsDetermineIfInteractionIsAllowedPostResponseAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphteamwork "github.com/microsoftgraph/msgraph-beta-sdk-go/teamwork"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphteamwork.NewDetermineIfInteractionIsAllowedPostRequestBody()
identity := graphmodels.NewTeamworkUserIdentity()
id := "59b5bc69-ca73-4ffd-a2e0-88a79115d13b"
identity.SetId(&id)
users := []graphmodels.Identityable {
identity,
}
requestBody.SetUsers(users)
interactionType := graphmodels.CREATECHAT_TEAMWORKINTERACTIONTYPE
requestBody.SetInteractionType(&interactionType)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
determineIfInteractionIsAllowed, err := graphClient.Teamwork().DetermineIfInteractionIsAllowed().PostAsDetermineIfInteractionIsAllowedPostResponse(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.teamwork.determineifinteractionisallowed.DetermineIfInteractionIsAllowedPostRequestBody determineIfInteractionIsAllowedPostRequestBody = new com.microsoft.graph.beta.teamwork.determineifinteractionisallowed.DetermineIfInteractionIsAllowedPostRequestBody();
LinkedList<Identity> users = new LinkedList<Identity>();
TeamworkUserIdentity identity = new TeamworkUserIdentity();
identity.setOdataType("microsoft.graph.teamworkUserIdentity");
identity.setId("59b5bc69-ca73-4ffd-a2e0-88a79115d13b");
users.add(identity);
determineIfInteractionIsAllowedPostRequestBody.setUsers(users);
determineIfInteractionIsAllowedPostRequestBody.setInteractionType(TeamworkInteractionType.CreateChat);
var result = graphClient.teamwork().determineIfInteractionIsAllowed().post(determineIfInteractionIsAllowedPostRequestBody);
const options = {
authProvider,
};
const client = Client.init(options);
const _boolean = {
users:
[
{
'@odata.type': 'microsoft.graph.teamworkUserIdentity',
id: '59b5bc69-ca73-4ffd-a2e0-88a79115d13b'
}
],
interactionType: 'createChat'
};
await client.api('/teamwork/determineIfInteractionIsAllowed')
.version('beta')
.post(_boolean);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Teamwork\DetermineIfInteractionIsAllowed\DetermineIfInteractionIsAllowedPostRequestBody;
use Microsoft\Graph\Beta\Generated\Models\Identity;
use Microsoft\Graph\Beta\Generated\Models\TeamworkUserIdentity;
use Microsoft\Graph\Beta\Generated\Models\TeamworkInteractionType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new DetermineIfInteractionIsAllowedPostRequestBody();
$usersIdentity1 = new TeamworkUserIdentity();
$usersIdentity1->setOdataType('microsoft.graph.teamworkUserIdentity');
$usersIdentity1->setId('59b5bc69-ca73-4ffd-a2e0-88a79115d13b');
$usersArray []= $usersIdentity1;
$requestBody->setUsers($usersArray);
$requestBody->setInteractionType(new TeamworkInteractionType('createChat'));
$result = $graphServiceClient->teamwork()->determineIfInteractionIsAllowed()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Teams
$params = @{
users = @(
@{
"@odata.type" = "microsoft.graph.teamworkUserIdentity"
id = "59b5bc69-ca73-4ffd-a2e0-88a79115d13b"
}
)
interactionType = "createChat"
}
Invoke-MgBetaDetermineTeamworkIfInteractionIsAllowed -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.teamwork.determine_if_interaction_is_allowed.determine_if_interaction_is_allowed_post_request_body import DetermineIfInteractionIsAllowedPostRequestBody
from msgraph_beta.generated.models.identity import Identity
from msgraph_beta.generated.models.teamwork_user_identity import TeamworkUserIdentity
from msgraph_beta.generated.models.teamwork_interaction_type import TeamworkInteractionType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = DetermineIfInteractionIsAllowedPostRequestBody(
users = [
TeamworkUserIdentity(
odata_type = "microsoft.graph.teamworkUserIdentity",
id = "59b5bc69-ca73-4ffd-a2e0-88a79115d13b",
),
],
interaction_type = TeamworkInteractionType.CreateChat,
)
result = await graph_client.teamwork.determine_if_interaction_is_allowed.post(request_body)
Respuesta
En el ejemplo siguiente se muestra la respuesta.
Nota: Se puede acortar el objeto de respuesta que se muestra aquí para mejorar la legibilidad.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Edm.Boolean",
"value": true
}
Ejemplo 2: Determinar si el usuario que ha iniciado sesión puede crear un chat con otro usuario en un inquilino diferente mediante su identificador y su identificador de inquilino
En el ejemplo siguiente se muestra una solicitud que determina si el usuario que inició sesión, autenticado a través del contexto delegado, puede crear un chat con otro usuario en un inquilino diferente mediante el identificador y el identificador de inquilino del otro usuario.
Solicitud
En el ejemplo siguiente se muestra la solicitud.
POST https://graph.microsoft.com/beta/teamwork/determineIfInteractionIsAllowed
{
"users":
[
{
"@odata.type": "microsoft.graph.teamworkUserIdentity",
"id": "59b5bc69-ca73-4ffd-a2e0-88a79115d13b",
"tenantId": "b11186db-6149-4b3d-95ad-23c9e1bf6853"
}
],
"interactionType": "createChat"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Teamwork.DetermineIfInteractionIsAllowed;
using Microsoft.Graph.Beta.Models;
var requestBody = new DetermineIfInteractionIsAllowedPostRequestBody
{
Users = new List<Identity>
{
new TeamworkUserIdentity
{
OdataType = "microsoft.graph.teamworkUserIdentity",
Id = "59b5bc69-ca73-4ffd-a2e0-88a79115d13b",
AdditionalData = new Dictionary<string, object>
{
{
"tenantId" , "b11186db-6149-4b3d-95ad-23c9e1bf6853"
},
},
},
},
InteractionType = TeamworkInteractionType.CreateChat,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Teamwork.DetermineIfInteractionIsAllowed.PostAsDetermineIfInteractionIsAllowedPostResponseAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphteamwork "github.com/microsoftgraph/msgraph-beta-sdk-go/teamwork"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphteamwork.NewDetermineIfInteractionIsAllowedPostRequestBody()
identity := graphmodels.NewTeamworkUserIdentity()
id := "59b5bc69-ca73-4ffd-a2e0-88a79115d13b"
identity.SetId(&id)
additionalData := map[string]interface{}{
"tenantId" : "b11186db-6149-4b3d-95ad-23c9e1bf6853",
}
identity.SetAdditionalData(additionalData)
users := []graphmodels.Identityable {
identity,
}
requestBody.SetUsers(users)
interactionType := graphmodels.CREATECHAT_TEAMWORKINTERACTIONTYPE
requestBody.SetInteractionType(&interactionType)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
determineIfInteractionIsAllowed, err := graphClient.Teamwork().DetermineIfInteractionIsAllowed().PostAsDetermineIfInteractionIsAllowedPostResponse(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.teamwork.determineifinteractionisallowed.DetermineIfInteractionIsAllowedPostRequestBody determineIfInteractionIsAllowedPostRequestBody = new com.microsoft.graph.beta.teamwork.determineifinteractionisallowed.DetermineIfInteractionIsAllowedPostRequestBody();
LinkedList<Identity> users = new LinkedList<Identity>();
TeamworkUserIdentity identity = new TeamworkUserIdentity();
identity.setOdataType("microsoft.graph.teamworkUserIdentity");
identity.setId("59b5bc69-ca73-4ffd-a2e0-88a79115d13b");
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("tenantId", "b11186db-6149-4b3d-95ad-23c9e1bf6853");
identity.setAdditionalData(additionalData);
users.add(identity);
determineIfInteractionIsAllowedPostRequestBody.setUsers(users);
determineIfInteractionIsAllowedPostRequestBody.setInteractionType(TeamworkInteractionType.CreateChat);
var result = graphClient.teamwork().determineIfInteractionIsAllowed().post(determineIfInteractionIsAllowedPostRequestBody);
const options = {
authProvider,
};
const client = Client.init(options);
const _boolean = {
users:
[
{
'@odata.type': 'microsoft.graph.teamworkUserIdentity',
id: '59b5bc69-ca73-4ffd-a2e0-88a79115d13b',
tenantId: 'b11186db-6149-4b3d-95ad-23c9e1bf6853'
}
],
interactionType: 'createChat'
};
await client.api('/teamwork/determineIfInteractionIsAllowed')
.version('beta')
.post(_boolean);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Teamwork\DetermineIfInteractionIsAllowed\DetermineIfInteractionIsAllowedPostRequestBody;
use Microsoft\Graph\Beta\Generated\Models\Identity;
use Microsoft\Graph\Beta\Generated\Models\TeamworkUserIdentity;
use Microsoft\Graph\Beta\Generated\Models\TeamworkInteractionType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new DetermineIfInteractionIsAllowedPostRequestBody();
$usersIdentity1 = new TeamworkUserIdentity();
$usersIdentity1->setOdataType('microsoft.graph.teamworkUserIdentity');
$usersIdentity1->setId('59b5bc69-ca73-4ffd-a2e0-88a79115d13b');
$additionalData = [
'tenantId' => 'b11186db-6149-4b3d-95ad-23c9e1bf6853',
];
$usersIdentity1->setAdditionalData($additionalData);
$usersArray []= $usersIdentity1;
$requestBody->setUsers($usersArray);
$requestBody->setInteractionType(new TeamworkInteractionType('createChat'));
$result = $graphServiceClient->teamwork()->determineIfInteractionIsAllowed()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Teams
$params = @{
users = @(
@{
"@odata.type" = "microsoft.graph.teamworkUserIdentity"
id = "59b5bc69-ca73-4ffd-a2e0-88a79115d13b"
tenantId = "b11186db-6149-4b3d-95ad-23c9e1bf6853"
}
)
interactionType = "createChat"
}
Invoke-MgBetaDetermineTeamworkIfInteractionIsAllowed -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.teamwork.determine_if_interaction_is_allowed.determine_if_interaction_is_allowed_post_request_body import DetermineIfInteractionIsAllowedPostRequestBody
from msgraph_beta.generated.models.identity import Identity
from msgraph_beta.generated.models.teamwork_user_identity import TeamworkUserIdentity
from msgraph_beta.generated.models.teamwork_interaction_type import TeamworkInteractionType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = DetermineIfInteractionIsAllowedPostRequestBody(
users = [
TeamworkUserIdentity(
odata_type = "microsoft.graph.teamworkUserIdentity",
id = "59b5bc69-ca73-4ffd-a2e0-88a79115d13b",
additional_data = {
"tenant_id" : "b11186db-6149-4b3d-95ad-23c9e1bf6853",
}
),
],
interaction_type = TeamworkInteractionType.CreateChat,
)
result = await graph_client.teamwork.determine_if_interaction_is_allowed.post(request_body)
Respuesta
En el ejemplo siguiente se muestra la respuesta.
Nota: Se puede acortar el objeto de respuesta que se muestra aquí para mejorar la legibilidad.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Edm.Boolean",
"value": true
}
Ejemplo 3: Determinar si el usuario que inició sesión puede crear un chat con otro usuario con su nombre principal de usuario
En el ejemplo siguiente se muestra una solicitud que determina si el usuario que inició sesión, autenticado a través del contexto delegado, puede crear un chat con otro usuario especificando el nombre principal del otro usuario. Al especificar el nombre principal de usuario de un usuario en otro inquilino, no es necesario especificar tenantId .
Solicitud
En el ejemplo siguiente se muestra la solicitud.
POST https://graph.microsoft.com/beta/teamwork/determineIfInteractionIsAllowed
{
"users":
[
{
"@odata.type": "microsoft.graph.teamworkUserIdentity",
"userPrincipalName": "maia@contoso.com"
}
],
"interactionType": "createChat"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Teamwork.DetermineIfInteractionIsAllowed;
using Microsoft.Graph.Beta.Models;
var requestBody = new DetermineIfInteractionIsAllowedPostRequestBody
{
Users = new List<Identity>
{
new TeamworkUserIdentity
{
OdataType = "microsoft.graph.teamworkUserIdentity",
UserPrincipalName = "maia@contoso.com",
},
},
InteractionType = TeamworkInteractionType.CreateChat,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Teamwork.DetermineIfInteractionIsAllowed.PostAsDetermineIfInteractionIsAllowedPostResponseAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphteamwork "github.com/microsoftgraph/msgraph-beta-sdk-go/teamwork"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphteamwork.NewDetermineIfInteractionIsAllowedPostRequestBody()
identity := graphmodels.NewTeamworkUserIdentity()
userPrincipalName := "maia@contoso.com"
identity.SetUserPrincipalName(&userPrincipalName)
users := []graphmodels.Identityable {
identity,
}
requestBody.SetUsers(users)
interactionType := graphmodels.CREATECHAT_TEAMWORKINTERACTIONTYPE
requestBody.SetInteractionType(&interactionType)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
determineIfInteractionIsAllowed, err := graphClient.Teamwork().DetermineIfInteractionIsAllowed().PostAsDetermineIfInteractionIsAllowedPostResponse(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.teamwork.determineifinteractionisallowed.DetermineIfInteractionIsAllowedPostRequestBody determineIfInteractionIsAllowedPostRequestBody = new com.microsoft.graph.beta.teamwork.determineifinteractionisallowed.DetermineIfInteractionIsAllowedPostRequestBody();
LinkedList<Identity> users = new LinkedList<Identity>();
TeamworkUserIdentity identity = new TeamworkUserIdentity();
identity.setOdataType("microsoft.graph.teamworkUserIdentity");
identity.setUserPrincipalName("maia@contoso.com");
users.add(identity);
determineIfInteractionIsAllowedPostRequestBody.setUsers(users);
determineIfInteractionIsAllowedPostRequestBody.setInteractionType(TeamworkInteractionType.CreateChat);
var result = graphClient.teamwork().determineIfInteractionIsAllowed().post(determineIfInteractionIsAllowedPostRequestBody);
const options = {
authProvider,
};
const client = Client.init(options);
const _boolean = {
users:
[
{
'@odata.type': 'microsoft.graph.teamworkUserIdentity',
userPrincipalName: 'maia@contoso.com'
}
],
interactionType: 'createChat'
};
await client.api('/teamwork/determineIfInteractionIsAllowed')
.version('beta')
.post(_boolean);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Teamwork\DetermineIfInteractionIsAllowed\DetermineIfInteractionIsAllowedPostRequestBody;
use Microsoft\Graph\Beta\Generated\Models\Identity;
use Microsoft\Graph\Beta\Generated\Models\TeamworkUserIdentity;
use Microsoft\Graph\Beta\Generated\Models\TeamworkInteractionType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new DetermineIfInteractionIsAllowedPostRequestBody();
$usersIdentity1 = new TeamworkUserIdentity();
$usersIdentity1->setOdataType('microsoft.graph.teamworkUserIdentity');
$usersIdentity1->setUserPrincipalName('maia@contoso.com');
$usersArray []= $usersIdentity1;
$requestBody->setUsers($usersArray);
$requestBody->setInteractionType(new TeamworkInteractionType('createChat'));
$result = $graphServiceClient->teamwork()->determineIfInteractionIsAllowed()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Teams
$params = @{
users = @(
@{
"@odata.type" = "microsoft.graph.teamworkUserIdentity"
userPrincipalName = "maia@contoso.com"
}
)
interactionType = "createChat"
}
Invoke-MgBetaDetermineTeamworkIfInteractionIsAllowed -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.teamwork.determine_if_interaction_is_allowed.determine_if_interaction_is_allowed_post_request_body import DetermineIfInteractionIsAllowedPostRequestBody
from msgraph_beta.generated.models.identity import Identity
from msgraph_beta.generated.models.teamwork_user_identity import TeamworkUserIdentity
from msgraph_beta.generated.models.teamwork_interaction_type import TeamworkInteractionType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = DetermineIfInteractionIsAllowedPostRequestBody(
users = [
TeamworkUserIdentity(
odata_type = "microsoft.graph.teamworkUserIdentity",
user_principal_name = "maia@contoso.com",
),
],
interaction_type = TeamworkInteractionType.CreateChat,
)
result = await graph_client.teamwork.determine_if_interaction_is_allowed.post(request_body)
Respuesta
En el ejemplo siguiente se muestra la respuesta.
Nota: Se puede acortar el objeto de respuesta que se muestra aquí para mejorar la legibilidad.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Edm.Boolean",
"value": true
}
Ejemplo 4: Determinar si el usuario que ha iniciado sesión puede crear un chat con otro usuario mediante su correo electrónico
En el ejemplo siguiente se muestra una solicitud que determina si el usuario que ha iniciado sesión, autenticado a través del contexto delegado, puede crear un chat con otro usuario especificando el correo electrónico del otro usuario.
Solicitud
En el ejemplo siguiente se muestra la solicitud.
POST https://graph.microsoft.com/beta/teamwork/determineIfInteractionIsAllowed
{
"users":
[
{
"@odata.type": "microsoft.graph.emailIdentity",
"email": "LauraW@contoso.com"
}
],
"interactionType": "createChat"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Teamwork.DetermineIfInteractionIsAllowed;
using Microsoft.Graph.Beta.Models;
var requestBody = new DetermineIfInteractionIsAllowedPostRequestBody
{
Users = new List<Identity>
{
new EmailIdentity
{
OdataType = "microsoft.graph.emailIdentity",
Email = "LauraW@contoso.com",
},
},
InteractionType = TeamworkInteractionType.CreateChat,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Teamwork.DetermineIfInteractionIsAllowed.PostAsDetermineIfInteractionIsAllowedPostResponseAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphteamwork "github.com/microsoftgraph/msgraph-beta-sdk-go/teamwork"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphteamwork.NewDetermineIfInteractionIsAllowedPostRequestBody()
identity := graphmodels.NewEmailIdentity()
email := "LauraW@contoso.com"
identity.SetEmail(&email)
users := []graphmodels.Identityable {
identity,
}
requestBody.SetUsers(users)
interactionType := graphmodels.CREATECHAT_TEAMWORKINTERACTIONTYPE
requestBody.SetInteractionType(&interactionType)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
determineIfInteractionIsAllowed, err := graphClient.Teamwork().DetermineIfInteractionIsAllowed().PostAsDetermineIfInteractionIsAllowedPostResponse(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.teamwork.determineifinteractionisallowed.DetermineIfInteractionIsAllowedPostRequestBody determineIfInteractionIsAllowedPostRequestBody = new com.microsoft.graph.beta.teamwork.determineifinteractionisallowed.DetermineIfInteractionIsAllowedPostRequestBody();
LinkedList<Identity> users = new LinkedList<Identity>();
EmailIdentity identity = new EmailIdentity();
identity.setOdataType("microsoft.graph.emailIdentity");
identity.setEmail("LauraW@contoso.com");
users.add(identity);
determineIfInteractionIsAllowedPostRequestBody.setUsers(users);
determineIfInteractionIsAllowedPostRequestBody.setInteractionType(TeamworkInteractionType.CreateChat);
var result = graphClient.teamwork().determineIfInteractionIsAllowed().post(determineIfInteractionIsAllowedPostRequestBody);
const options = {
authProvider,
};
const client = Client.init(options);
const _boolean = {
users:
[
{
'@odata.type': 'microsoft.graph.emailIdentity',
email: 'LauraW@contoso.com'
}
],
interactionType: 'createChat'
};
await client.api('/teamwork/determineIfInteractionIsAllowed')
.version('beta')
.post(_boolean);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Teamwork\DetermineIfInteractionIsAllowed\DetermineIfInteractionIsAllowedPostRequestBody;
use Microsoft\Graph\Beta\Generated\Models\Identity;
use Microsoft\Graph\Beta\Generated\Models\EmailIdentity;
use Microsoft\Graph\Beta\Generated\Models\TeamworkInteractionType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new DetermineIfInteractionIsAllowedPostRequestBody();
$usersIdentity1 = new EmailIdentity();
$usersIdentity1->setOdataType('microsoft.graph.emailIdentity');
$usersIdentity1->setEmail('LauraW@contoso.com');
$usersArray []= $usersIdentity1;
$requestBody->setUsers($usersArray);
$requestBody->setInteractionType(new TeamworkInteractionType('createChat'));
$result = $graphServiceClient->teamwork()->determineIfInteractionIsAllowed()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Teams
$params = @{
users = @(
@{
"@odata.type" = "microsoft.graph.emailIdentity"
email = "LauraW@contoso.com"
}
)
interactionType = "createChat"
}
Invoke-MgBetaDetermineTeamworkIfInteractionIsAllowed -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.teamwork.determine_if_interaction_is_allowed.determine_if_interaction_is_allowed_post_request_body import DetermineIfInteractionIsAllowedPostRequestBody
from msgraph_beta.generated.models.identity import Identity
from msgraph_beta.generated.models.email_identity import EmailIdentity
from msgraph_beta.generated.models.teamwork_interaction_type import TeamworkInteractionType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = DetermineIfInteractionIsAllowedPostRequestBody(
users = [
EmailIdentity(
odata_type = "microsoft.graph.emailIdentity",
email = "LauraW@contoso.com",
),
],
interaction_type = TeamworkInteractionType.CreateChat,
)
result = await graph_client.teamwork.determine_if_interaction_is_allowed.post(request_body)
Respuesta
En el ejemplo siguiente se muestra la respuesta.
Nota: Se puede acortar el objeto de respuesta que se muestra aquí para mejorar la legibilidad.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Edm.Boolean",
"value": true
}
Ejemplo 5: Determinar si el usuario que ha iniciado sesión puede crear un chat con otros tres usuarios
En el ejemplo siguiente se muestra una solicitud que determina si el usuario que ha iniciado sesión, autenticado a través del contexto delegado, puede crear un chat con otros tres usuarios. Usa una combinación de los tipos de identidad admitidos. En este ejemplo, no se permite la interacción.
Solicitud
En el ejemplo siguiente se muestra la solicitud.
POST https://graph.microsoft.com/beta/teamwork/determineIfInteractionIsAllowed
{
"users":
[
{
"@odata.type": "microsoft.graph.emailIdentity",
"email": "LauraW@foo.com"
},
{
"@odata.type": "microsoft.graph.teamworkUserIdentity",
"userPrincipalName": "MaiaR@foobar.com"
},
{
"@odata.type": "microsoft.graph.teamworkUserIdentity",
"id": "bd6a223f-59b5-46dd-90bc-0ddebaf3da5a"
}
],
"interactionType": "createChat"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Teamwork.DetermineIfInteractionIsAllowed;
using Microsoft.Graph.Beta.Models;
var requestBody = new DetermineIfInteractionIsAllowedPostRequestBody
{
Users = new List<Identity>
{
new EmailIdentity
{
OdataType = "microsoft.graph.emailIdentity",
Email = "LauraW@foo.com",
},
new TeamworkUserIdentity
{
OdataType = "microsoft.graph.teamworkUserIdentity",
UserPrincipalName = "MaiaR@foobar.com",
},
new TeamworkUserIdentity
{
OdataType = "microsoft.graph.teamworkUserIdentity",
Id = "bd6a223f-59b5-46dd-90bc-0ddebaf3da5a",
},
},
InteractionType = TeamworkInteractionType.CreateChat,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Teamwork.DetermineIfInteractionIsAllowed.PostAsDetermineIfInteractionIsAllowedPostResponseAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphteamwork "github.com/microsoftgraph/msgraph-beta-sdk-go/teamwork"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphteamwork.NewDetermineIfInteractionIsAllowedPostRequestBody()
identity := graphmodels.NewEmailIdentity()
email := "LauraW@foo.com"
identity.SetEmail(&email)
identity1 := graphmodels.NewTeamworkUserIdentity()
userPrincipalName := "MaiaR@foobar.com"
identity1.SetUserPrincipalName(&userPrincipalName)
identity2 := graphmodels.NewTeamworkUserIdentity()
id := "bd6a223f-59b5-46dd-90bc-0ddebaf3da5a"
identity2.SetId(&id)
users := []graphmodels.Identityable {
identity,
identity1,
identity2,
}
requestBody.SetUsers(users)
interactionType := graphmodels.CREATECHAT_TEAMWORKINTERACTIONTYPE
requestBody.SetInteractionType(&interactionType)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
determineIfInteractionIsAllowed, err := graphClient.Teamwork().DetermineIfInteractionIsAllowed().PostAsDetermineIfInteractionIsAllowedPostResponse(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.teamwork.determineifinteractionisallowed.DetermineIfInteractionIsAllowedPostRequestBody determineIfInteractionIsAllowedPostRequestBody = new com.microsoft.graph.beta.teamwork.determineifinteractionisallowed.DetermineIfInteractionIsAllowedPostRequestBody();
LinkedList<Identity> users = new LinkedList<Identity>();
EmailIdentity identity = new EmailIdentity();
identity.setOdataType("microsoft.graph.emailIdentity");
identity.setEmail("LauraW@foo.com");
users.add(identity);
TeamworkUserIdentity identity1 = new TeamworkUserIdentity();
identity1.setOdataType("microsoft.graph.teamworkUserIdentity");
identity1.setUserPrincipalName("MaiaR@foobar.com");
users.add(identity1);
TeamworkUserIdentity identity2 = new TeamworkUserIdentity();
identity2.setOdataType("microsoft.graph.teamworkUserIdentity");
identity2.setId("bd6a223f-59b5-46dd-90bc-0ddebaf3da5a");
users.add(identity2);
determineIfInteractionIsAllowedPostRequestBody.setUsers(users);
determineIfInteractionIsAllowedPostRequestBody.setInteractionType(TeamworkInteractionType.CreateChat);
var result = graphClient.teamwork().determineIfInteractionIsAllowed().post(determineIfInteractionIsAllowedPostRequestBody);
const options = {
authProvider,
};
const client = Client.init(options);
const _boolean = {
users:
[
{
'@odata.type': 'microsoft.graph.emailIdentity',
email: 'LauraW@foo.com'
},
{
'@odata.type': 'microsoft.graph.teamworkUserIdentity',
userPrincipalName: 'MaiaR@foobar.com'
},
{
'@odata.type': 'microsoft.graph.teamworkUserIdentity',
id: 'bd6a223f-59b5-46dd-90bc-0ddebaf3da5a'
}
],
interactionType: 'createChat'
};
await client.api('/teamwork/determineIfInteractionIsAllowed')
.version('beta')
.post(_boolean);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Teamwork\DetermineIfInteractionIsAllowed\DetermineIfInteractionIsAllowedPostRequestBody;
use Microsoft\Graph\Beta\Generated\Models\Identity;
use Microsoft\Graph\Beta\Generated\Models\EmailIdentity;
use Microsoft\Graph\Beta\Generated\Models\TeamworkUserIdentity;
use Microsoft\Graph\Beta\Generated\Models\TeamworkInteractionType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new DetermineIfInteractionIsAllowedPostRequestBody();
$usersIdentity1 = new EmailIdentity();
$usersIdentity1->setOdataType('microsoft.graph.emailIdentity');
$usersIdentity1->setEmail('LauraW@foo.com');
$usersArray []= $usersIdentity1;
$usersIdentity2 = new TeamworkUserIdentity();
$usersIdentity2->setOdataType('microsoft.graph.teamworkUserIdentity');
$usersIdentity2->setUserPrincipalName('MaiaR@foobar.com');
$usersArray []= $usersIdentity2;
$usersIdentity3 = new TeamworkUserIdentity();
$usersIdentity3->setOdataType('microsoft.graph.teamworkUserIdentity');
$usersIdentity3->setId('bd6a223f-59b5-46dd-90bc-0ddebaf3da5a');
$usersArray []= $usersIdentity3;
$requestBody->setUsers($usersArray);
$requestBody->setInteractionType(new TeamworkInteractionType('createChat'));
$result = $graphServiceClient->teamwork()->determineIfInteractionIsAllowed()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Teams
$params = @{
users = @(
@{
"@odata.type" = "microsoft.graph.emailIdentity"
email = "LauraW@foo.com"
}
@{
"@odata.type" = "microsoft.graph.teamworkUserIdentity"
userPrincipalName = "MaiaR@foobar.com"
}
@{
"@odata.type" = "microsoft.graph.teamworkUserIdentity"
id = "bd6a223f-59b5-46dd-90bc-0ddebaf3da5a"
}
)
interactionType = "createChat"
}
Invoke-MgBetaDetermineTeamworkIfInteractionIsAllowed -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.teamwork.determine_if_interaction_is_allowed.determine_if_interaction_is_allowed_post_request_body import DetermineIfInteractionIsAllowedPostRequestBody
from msgraph_beta.generated.models.identity import Identity
from msgraph_beta.generated.models.email_identity import EmailIdentity
from msgraph_beta.generated.models.teamwork_user_identity import TeamworkUserIdentity
from msgraph_beta.generated.models.teamwork_interaction_type import TeamworkInteractionType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = DetermineIfInteractionIsAllowedPostRequestBody(
users = [
EmailIdentity(
odata_type = "microsoft.graph.emailIdentity",
email = "LauraW@foo.com",
),
TeamworkUserIdentity(
odata_type = "microsoft.graph.teamworkUserIdentity",
user_principal_name = "MaiaR@foobar.com",
),
TeamworkUserIdentity(
odata_type = "microsoft.graph.teamworkUserIdentity",
id = "bd6a223f-59b5-46dd-90bc-0ddebaf3da5a",
),
],
interaction_type = TeamworkInteractionType.CreateChat,
)
result = await graph_client.teamwork.determine_if_interaction_is_allowed.post(request_body)
Respuesta
En el ejemplo siguiente se muestra la respuesta.
Nota: Se puede acortar el objeto de respuesta que se muestra aquí para mejorar la legibilidad.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Edm.Boolean",
"value": false
}