Namespace: microsoft.graph
Wichtig
Die APIs unter der /beta Version in Microsoft Graph können sich ändern. Die Verwendung dieser APIs in Produktionsanwendungen wird nicht unterstützt. Um festzustellen, ob eine API in v1.0 verfügbar ist, verwenden Sie die Version Selektor.
Legen Sie das manuelle Arbeitsortsignal für einen Benutzer fest. Der von einem Benutzer oder einem autorisierten Kunden gewählte explizite Wert überschreibt alle automatisch erkannten oder geplanten Arbeitszeiten und Standorte.
- Rangfolge: manuell > automatisch > geplant
- Präzision (innerhalb derselben Ebene): präzisere Ergebnisse (z. B. Büro + Gebäudebüro > )
- Wenn ein manueller Speicherort festgelegt ist, werden sowohl die automatischen als auch die geplanten Einstellungen außer Kraft gesetzt.
Diese API ist in den folgenden nationalen Cloudbereitstellungen verfügbar.
| Weltweiter Service |
US Government L4 |
US Government L5 (DOD) |
China, betrieben von 21Vianet |
| ✅ |
❌ |
❌ |
❌ |
Berechtigungen
Wählen Sie die Berechtigungen aus, die für diese API als am wenigsten privilegiert markiert sind. Verwenden Sie eine höhere Berechtigung oder Berechtigungen nur, wenn Ihre App dies erfordert. Ausführliche Informationen zu delegierten Berechtigungen und Anwendungsberechtigungen finden Sie unter Berechtigungstypen. Weitere Informationen zu diesen Berechtigungen finden Sie in der Berechtigungsreferenz.
| Berechtigungstyp |
Berechtigung mit den geringsten Berechtigungen |
Berechtigungen mit höheren Berechtigungen |
| Delegiert (Geschäfts-, Schul- oder Unikonto) |
Presence.ReadWrite |
Nicht verfügbar. |
| Delegiert (persönliches Microsoft-Konto) |
Nicht unterstützt |
Nicht unterstützt |
| Application |
Nicht unterstützt |
Nicht unterstützt |
HTTP-Anforderung
POST /me/presence/setManualLocation
Anforderungstext
Geben Sie im Anforderungstext eine JSON-Darstellung der Parameter an.
In der folgenden Tabelle sind die Parameter aufgeführt, die erforderlich sind, wenn Sie diese Aktion aufrufen.
| Parameter |
Typ |
Beschreibung |
| placeId |
Zeichenfolge |
Bezeichner des Ortes, falls zutreffend. |
| workLocationType |
workLocationType |
Semantischer Typ des Standorts. Unterstützt eine Teilmenge der Werte für workLocationType. Die möglichen Werte sind: office, remote, timeOff. |
Antwort
Wenn die Aktion erfolgreich verläuft, wird der Antwortcode 200 OK zurückgegeben. Sie gibt nichts im Antworttext zurück.
Beispiele
Anforderung
Das folgende Beispiel zeigt eine Anfrage.
POST https://graph.microsoft.com/beta/me/presence/setManualLocation
Content-Type: application/json
{
"workLocationType": "office",
"placeId": "eb706f15-137e-4722-b4d1-b601481d9251"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Me.Presence.SetManualLocation;
using Microsoft.Graph.Beta.Models;
var requestBody = new SetManualLocationPostRequestBody
{
WorkLocationType = WorkLocationType.Office,
PlaceId = "eb706f15-137e-4722-b4d1-b601481d9251",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Me.Presence.SetManualLocation.PostAsync(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"
graphusers "github.com/microsoftgraph/msgraph-beta-sdk-go/users"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphusers.NewItemSetManualLocationPostRequestBody()
workLocationType := graphmodels.OFFICE_WORKLOCATIONTYPE
requestBody.SetWorkLocationType(&workLocationType)
placeId := "eb706f15-137e-4722-b4d1-b601481d9251"
requestBody.SetPlaceId(&placeId)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Me().Presence().SetManualLocation().Post(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.users.item.presence.setmanuallocation.SetManualLocationPostRequestBody setManualLocationPostRequestBody = new com.microsoft.graph.beta.users.item.presence.setmanuallocation.SetManualLocationPostRequestBody();
setManualLocationPostRequestBody.setWorkLocationType(WorkLocationType.Office);
setManualLocationPostRequestBody.setPlaceId("eb706f15-137e-4722-b4d1-b601481d9251");
graphClient.me().presence().setManualLocation().post(setManualLocationPostRequestBody);
const options = {
authProvider,
};
const client = Client.init(options);
const setManualLocation = {
workLocationType: 'office',
placeId: 'eb706f15-137e-4722-b4d1-b601481d9251'
};
await client.api('/me/presence/setManualLocation')
.version('beta')
.post(setManualLocation);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Users\Item\Presence\SetManualLocation\SetManualLocationPostRequestBody;
use Microsoft\Graph\Beta\Generated\Models\WorkLocationType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new SetManualLocationPostRequestBody();
$requestBody->setWorkLocationType(new WorkLocationType('office'));
$requestBody->setPlaceId('eb706f15-137e-4722-b4d1-b601481d9251');
$graphServiceClient->me()->presence()->setManualLocation()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.CloudCommunications
$params = @{
workLocationType = "office"
placeId = "eb706f15-137e-4722-b4d1-b601481d9251"
}
# A UPN can also be used as -UserId.
Set-MgBetaUserPresenceManualLocation -UserId $userId -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.users.item.presence.set_manual_location.set_manual_location_post_request_body import SetManualLocationPostRequestBody
from msgraph_beta.generated.models.work_location_type import WorkLocationType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = SetManualLocationPostRequestBody(
work_location_type = WorkLocationType.Office,
place_id = "eb706f15-137e-4722-b4d1-b601481d9251",
)
await graph_client.me.presence.set_manual_location.post(request_body)
Antwort
Das folgende Beispiel zeigt die Antwort.
HTTP/1.1 200 OK