命名空间:microsoft.graph
更新 workforceIntegration 对象的属性。
此 API 可用于以下国家级云部署。
全局服务 |
美国政府 L4 |
美国政府 L5 (DOD) |
由世纪互联运营的中国 |
✅ |
❌ |
❌ |
❌ |
权限
为此 API 选择标记为最低特权的权限。
只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。
权限类型 |
最低特权权限 |
更高特权权限 |
委派(工作或学校帐户) |
WorkforceIntegration.ReadWrite.All |
不可用。 |
委派(个人 Microsoft 帐户) |
不支持。 |
不支持。 |
应用程序 |
WorkforceIntegration.ReadWrite.All |
不可用。 |
注意:此 API 支持管理员权限。 具有管理员角色的用户可以访问他们不是其成员的组。
HTTP 请求
PATCH /teamwork/workforceIntegrations/{workforceIntegrationId}
名称 |
说明 |
Authorization |
持有者 {token}。 必填。 详细了解 身份验证和授权。 |
MS-APP-ACTS-AS |
GUID) (用户 ID。 仅当授权令牌是应用程序令牌时才需要;否则为可选。 |
请求正文
在请求正文中, 仅 提供要更新的属性的值。 请求正文中未包含的现有属性会保留其以前的值,或者根据对其他属性值的更改重新计算。
下表指定可更新的属性。
属性 |
类型 |
说明 |
apiVersion |
Int32 |
回调 URL 的 API 版本。 从 1 开始。 |
displayName |
String |
劳动力集成的名称。 |
eligibilityFilteringEnabledEntities |
eligibilityFilteringEnabledEntities |
支持查看资格筛选结果。 可取值为:none 、swapRequest 、offerShiftRequest 、unknownFutureValue 、timeOffReason 。 使用 Prefer: include-unknown-enum-members 请求标头获取此 可演变枚举中的以下值: timeOffReason 。 |
加密 |
workforceIntegrationEncryption |
劳动力集成加密资源。 |
isActive |
布尔值 |
指示此劳动力集成当前是否处于活动状态且可用。 |
supportedEntities |
workforceIntegrationSupportedEntities |
同步更改通知支持的 Shifts 实体。 当客户端更改到此属性中指定的实体时,Shift 将调用提供的 URL。 可取值为:none 、shift 、swapRequest 、userShiftPreferences 、openShift 、openShiftRequest 、offerShiftRequest 、unknownFutureValue 、timeCard 、timeOffReason 、timeOff 、timeOffRequest 。 使用 Prefer: include-unknown-enum-members 请求标头获取此 可演变枚举中的以下值: timeCard 、 timeOffReason 、 timeOff 、 timeOffRequest 。 |
url |
String |
班次服务回调的劳动力集成 URL。 |
响应
如果成功,此方法在响应正文中返回响应 200 OK
代码和更新的 workforceIntegration 对象。
示例
请求
以下示例显示了一个请求。
PATCH https://graph.microsoft.com/v1.0/teamwork/workforceIntegrations/{workforceIntegrationId}
Content-Type: application/json
{
"displayName": "ABCWorkforceIntegration",
"apiVersion": 1,
"isActive": true,
"encryption": {
"protocol": "sharedSecret",
"secret": "My Secret"
},
"url": "https://ABCWorkforceIntegration.com/Contoso/",
"supportedEntities": "Shift,SwapRequest",
"eligibilityFilteringEnabledEntities": "SwapRequest"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new WorkforceIntegration
{
DisplayName = "ABCWorkforceIntegration",
ApiVersion = 1,
IsActive = true,
Encryption = new WorkforceIntegrationEncryption
{
Protocol = WorkforceIntegrationEncryptionProtocol.SharedSecret,
Secret = "My Secret",
},
Url = "https://ABCWorkforceIntegration.com/Contoso/",
SupportedEntities = WorkforceIntegrationSupportedEntities.Shift | WorkforceIntegrationSupportedEntities.SwapRequest,
EligibilityFilteringEnabledEntities = EligibilityFilteringEnabledEntities.SwapRequest,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Teamwork.WorkforceIntegrations["{workforceIntegration-id}"].PatchAsync(requestBody);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
mgc teamwork workforce-integrations patch --workforce-integration-id {workforceIntegration-id} --body '{\
"displayName": "ABCWorkforceIntegration",\
"apiVersion": 1,\
"isActive": true,\
"encryption": {\
"protocol": "sharedSecret",\
"secret": "My Secret"\
},\
"url": "https://ABCWorkforceIntegration.com/Contoso/",\
"supportedEntities": "Shift,SwapRequest",\
"eligibilityFilteringEnabledEntities": "SwapRequest"\
}\
'
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewWorkforceIntegration()
displayName := "ABCWorkforceIntegration"
requestBody.SetDisplayName(&displayName)
apiVersion := int32(1)
requestBody.SetApiVersion(&apiVersion)
isActive := true
requestBody.SetIsActive(&isActive)
encryption := graphmodels.NewWorkforceIntegrationEncryption()
protocol := graphmodels.SHAREDSECRET_WORKFORCEINTEGRATIONENCRYPTIONPROTOCOL
encryption.SetProtocol(&protocol)
secret := "My Secret"
encryption.SetSecret(&secret)
requestBody.SetEncryption(encryption)
url := "https://ABCWorkforceIntegration.com/Contoso/"
requestBody.SetUrl(&url)
supportedEntities := graphmodels.SHIFT,SWAPREQUEST_WORKFORCEINTEGRATIONSUPPORTEDENTITIES
requestBody.SetSupportedEntities(&supportedEntities)
eligibilityFilteringEnabledEntities := graphmodels.SWAPREQUEST_ELIGIBILITYFILTERINGENABLEDENTITIES
requestBody.SetEligibilityFilteringEnabledEntities(&eligibilityFilteringEnabledEntities)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
workforceIntegrations, err := graphClient.Teamwork().WorkforceIntegrations().ByWorkforceIntegrationId("workforceIntegration-id").Patch(context.Background(), requestBody, nil)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
WorkforceIntegration workforceIntegration = new WorkforceIntegration();
workforceIntegration.setDisplayName("ABCWorkforceIntegration");
workforceIntegration.setApiVersion(1);
workforceIntegration.setIsActive(true);
WorkforceIntegrationEncryption encryption = new WorkforceIntegrationEncryption();
encryption.setProtocol(WorkforceIntegrationEncryptionProtocol.SharedSecret);
encryption.setSecret("My Secret");
workforceIntegration.setEncryption(encryption);
workforceIntegration.setUrl("https://ABCWorkforceIntegration.com/Contoso/");
workforceIntegration.setSupportedEntities(EnumSet.of(WorkforceIntegrationSupportedEntities.Shift, WorkforceIntegrationSupportedEntities.SwapRequest));
workforceIntegration.setEligibilityFilteringEnabledEntities(EnumSet.of(EligibilityFilteringEnabledEntities.SwapRequest));
WorkforceIntegration result = graphClient.teamwork().workforceIntegrations().byWorkforceIntegrationId("{workforceIntegration-id}").patch(workforceIntegration);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
const options = {
authProvider,
};
const client = Client.init(options);
const workforceIntegration = {
displayName: 'ABCWorkforceIntegration',
apiVersion: 1,
isActive: true,
encryption: {
protocol: 'sharedSecret',
secret: 'My Secret'
},
url: 'https://ABCWorkforceIntegration.com/Contoso/',
supportedEntities: 'Shift,SwapRequest',
eligibilityFilteringEnabledEntities: 'SwapRequest'
};
await client.api('/teamwork/workforceIntegrations/{workforceIntegrationId}')
.update(workforceIntegration);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\WorkforceIntegration;
use Microsoft\Graph\Generated\Models\WorkforceIntegrationEncryption;
use Microsoft\Graph\Generated\Models\WorkforceIntegrationEncryptionProtocol;
use Microsoft\Graph\Generated\Models\WorkforceIntegrationSupportedEntities;
use Microsoft\Graph\Generated\Models\EligibilityFilteringEnabledEntities;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new WorkforceIntegration();
$requestBody->setDisplayName('ABCWorkforceIntegration');
$requestBody->setApiVersion(1);
$requestBody->setIsActive(true);
$encryption = new WorkforceIntegrationEncryption();
$encryption->setProtocol(new WorkforceIntegrationEncryptionProtocol('sharedSecret'));
$encryption->setSecret('My Secret');
$requestBody->setEncryption($encryption);
$requestBody->setUrl('https://ABCWorkforceIntegration.com/Contoso/');
$requestBody->setSupportedEntities(new WorkforceIntegrationSupportedEntities('shift,SwapRequest'));
$requestBody->setEligibilityFilteringEnabledEntities(new EligibilityFilteringEnabledEntities('swapRequest'));
$result = $graphServiceClient->teamwork()->workforceIntegrations()->byWorkforceIntegrationId('workforceIntegration-id')->patch($requestBody)->wait();
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
Import-Module Microsoft.Graph.Teams
$params = @{
displayName = "ABCWorkforceIntegration"
apiVersion = 1
isActive = $true
encryption = @{
protocol = "sharedSecret"
secret = "My Secret"
}
url = "https://ABCWorkforceIntegration.com/Contoso/"
supportedEntities = "Shift,SwapRequest"
eligibilityFilteringEnabledEntities = "SwapRequest"
}
Update-MgTeamworkWorkforceIntegration -WorkforceIntegrationId $workforceIntegrationId -BodyParameter $params
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.workforce_integration import WorkforceIntegration
from msgraph.generated.models.workforce_integration_encryption import WorkforceIntegrationEncryption
from msgraph.generated.models.workforce_integration_encryption_protocol import WorkforceIntegrationEncryptionProtocol
from msgraph.generated.models.workforce_integration_supported_entities import WorkforceIntegrationSupportedEntities
from msgraph.generated.models.eligibility_filtering_enabled_entities import EligibilityFilteringEnabledEntities
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = WorkforceIntegration(
display_name = "ABCWorkforceIntegration",
api_version = 1,
is_active = True,
encryption = WorkforceIntegrationEncryption(
protocol = WorkforceIntegrationEncryptionProtocol.SharedSecret,
secret = "My Secret",
),
url = "https://ABCWorkforceIntegration.com/Contoso/",
supported_entities = WorkforceIntegrationSupportedEntities.Shift | WorkforceIntegrationSupportedEntities.SwapRequest,
eligibility_filtering_enabled_entities = EligibilityFilteringEnabledEntities.SwapRequest,
)
result = await graph_client.teamwork.workforce_integrations.by_workforce_integration_id('workforceIntegration-id').patch(request_body)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
响应
以下示例显示了相应的响应。
注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-type: application/json
{
"id": "c5d0c76b-80c4-481c-be50-923cd8d680a1",
"displayName": "ABCWorkforceIntegration",
"apiVersion": 1,
"isActive": true,
"encryption": {
"protocol": "sharedSecret",
"secret": null
},
"url": "https://abcWorkforceIntegration.com/Contoso/",
"supportedEntities": "Shift,SwapRequest",
"eligibilityFilteringEnabledEntities": "SwapRequest"
}
通过劳动力管理系统 (WFM) 规则筛选资格的 WorkforceIntegration 实体的示例用例
用例:替换现有 WorkforceIntegration 以启用 SwapRequest 进行资格筛选
请求
以下示例显示了一个请求。
PATCH https://graph.microsoft.com/v1.0/teamwork/workforceIntegrations/{workforceIntegrationid}
{
"displayName": "ABCWorkforceIntegration",
"apiVersion": 1,
"isActive": true,
"encryption": {
"protocol": "sharedSecret",
"secret": "My Secret"
},
"url": "https://abcWorkforceIntegration.com/Contoso/",
"supportedEntities": "Shift,SwapRequest",
"eligibilityFilteringEnabledEntities": "SwapRequest"
}
响应
以下示例显示了相应的响应。
HTTP/1.1 200 OK
Content-type: application/json
{
"id": "c5d0c76b-80c4-481c-be50-923cd8d680a1",
"displayName": "ABCWorkforceIntegration",
"apiVersion": 1,
"isActive": true,
"encryption": {
"protocol": "sharedSecret",
"secret": null
},
"url": "https://abcWorkforceIntegration.com/Contoso/",
"supportedEntities": "Shift,SwapRequest",
"eligibilityFilteringEnabledEntities": "SwapRequest"
}
若要了解如何为资格筛选启用 SwapRequest 创建新的 workforceIntegration,请参阅 Create。
当 SwapRequest 包含在 eligibilityFilteringEnabledEntities 中时提取合格班次的示例
Shifts 应用与劳动力集成终结点之间的交互遵循现有模式。
请求
以下示例显示了排班人向劳动力集成终结点发出的请求,请求提取交换请求的合格班次。
POST https://abcWorkforceIntegration.com/Contoso/{apiVersion}/team/{teamId}/read
Accept-Language: en-us
{
"requests": [
{
"id": "{shiftId}",
"method": "GET”,
"url": “/shifts/{shiftId}/requestableShifts?requestType={requestType}&startDateTime={startDateTime}&endDateTime={endDateTime}”
}]
}
响应
以下示例显示了劳动力集成服务的响应。
HTTP/1.1 200 OK
{
"responses": [
"id": "{shiftId}",
"status: 200,
"body": {
"data": [{shiftId}, {shiftId}...]
"error": null
}
]
}