Namespace: microsoft.graph
Importante
As APIs na versão /beta no Microsoft Graph estão sujeitas a alterações. Não há suporte para o uso dessas APIs em aplicativos de produção. Para determinar se uma API está disponível na v1.0, use o seletor Versão.
Determine se é permitida uma interação especificada do Microsoft Teams entre o utilizador com sessão iniciada e os utilizadores especificados.
Nota: todos os pedidos para esta API são registados nos registos de auditoria do Microsoft 365 dos inquilinos onde existem os utilizadores visados especificados pelo parâmetro de utilizadores . Para obter mais informações, veja Atividades de registo de auditoria.
Esta API está disponível nas seguintes implementações de cloud nacionais.
| Serviço global |
US Government L4 |
US Government L5 (DOD) |
China operada pela 21Vianet |
| ✅ |
❌ |
❌ |
❌ |
Permissões
Escolha a permissão ou permissões marcadas como menos privilegiadas para esta API. Utilize uma permissão ou permissões com privilégios mais elevados apenas se a sua aplicação o exigir. Para obter detalhes sobre as permissões delegadas e de aplicação, veja Tipos de permissão. Para saber mais sobre estas permissões, veja a referência de permissões.
| Tipo de permissão |
Permissões com menos privilégios |
Permissões com privilégios superiores |
| Delegado (conta corporativa ou de estudante) |
TeamworkUserInteraction.Read.All |
Indisponível. |
| Delegado (conta pessoal da Microsoft) |
Sem suporte. |
Sem suporte. |
| Aplicativo |
Sem suporte. |
Sem suporte. |
Solicitação HTTP
POST /teamwork/determineIfInteractionIsAllowed
| Nome |
Descrição |
| Autorização |
{token} de portador. Obrigatório. Saiba mais sobre autenticação e autorização. |
| Content-Type |
application/json. Obrigatório. |
Corpo da solicitação
No corpo do pedido, forneça uma representação JSON dos parâmetros.
A tabela seguinte mostra os parâmetros que pode utilizar com esta ação.
Resposta
Se for bem-sucedida, esta ação devolve um 200 OK código de resposta e um Booleano no corpo da resposta.
Exemplos
Exemplo 1: determinar se o utilizador com sessão iniciada pode criar uma conversa com outro utilizador no mesmo inquilino com o respetivo ID
O exemplo seguinte mostra um pedido que determina se o utilizador com sessão iniciada, autenticado através de contexto delegado, pode criar uma conversa com outro utilizador no mesmo inquilino ao especificar o ID do outro utilizador.
Solicitação
O exemplo a seguir mostra uma solicitação.
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)
Resposta
O exemplo a seguir mostra a resposta.
Observação: o objeto de resposta mostrado aqui pode ser encurtado para legibilidade.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Edm.Boolean",
"value": true
}
Exemplo 2: determinar se o utilizador com sessão iniciada pode criar uma conversa com outro utilizador num inquilino diferente com o respetivo ID e ID de inquilino
O exemplo seguinte mostra um pedido que determina se o utilizador com sessão iniciada, autenticado através de contexto delegado, pode criar uma conversa com outro utilizador num inquilino diferente com o ID e o ID de inquilino do outro utilizador.
Solicitação
O exemplo a seguir mostra uma solicitação.
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)
Resposta
O exemplo a seguir mostra a resposta.
Observação: o objeto de resposta mostrado aqui pode ser encurtado para legibilidade.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Edm.Boolean",
"value": true
}
Exemplo 3: determinar se o utilizador com sessão iniciada pode criar uma conversa com outro utilizador com o respetivo nome principal de utilizador
O exemplo seguinte mostra um pedido que determina se o utilizador com sessão iniciada, autenticado através de contexto delegado, pode criar uma conversa com outro utilizador ao especificar o nome principal de utilizador do outro utilizador. Quando especificar o nome principal de utilizador de um utilizador noutro inquilino, o tenantId não precisa de ser especificado.
Solicitação
O exemplo a seguir mostra uma solicitação.
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)
Resposta
O exemplo a seguir mostra a resposta.
Observação: o objeto de resposta mostrado aqui pode ser encurtado para legibilidade.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Edm.Boolean",
"value": true
}
Exemplo 4: determinar se o utilizador com sessão iniciada pode criar uma conversa com outro utilizador através do respetivo e-mail
O exemplo seguinte mostra um pedido que determina se o utilizador com sessão iniciada, autenticado através de contexto delegado, pode criar uma conversa com outro utilizador ao especificar o e-mail do outro utilizador.
Solicitação
O exemplo a seguir mostra uma solicitação.
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)
Resposta
O exemplo a seguir mostra a resposta.
Observação: o objeto de resposta mostrado aqui pode ser encurtado para legibilidade.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Edm.Boolean",
"value": true
}
Exemplo 5: Determinar se o utilizador com sessão iniciada pode criar uma conversa com outros três utilizadores
O exemplo seguinte mostra um pedido que determina se o utilizador com sessão iniciada, autenticado através de contexto delegado, pode criar uma conversa com outros três utilizadores. Utiliza uma combinação dos tipos de identidade suportados. Neste exemplo, a interação não é permitida.
Solicitação
O exemplo a seguir mostra uma solicitação.
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)
Resposta
O exemplo a seguir mostra a resposta.
Observação: o objeto de resposta mostrado aqui pode ser encurtado para legibilidade.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Edm.Boolean",
"value": false
}