Espace de noms: microsoft.graph
Importante
Les API sous la version /beta dans Microsoft Graph sont susceptibles d’être modifiées. L’utilisation de ces API dans des applications de production n’est pas prise en charge. Pour déterminer si une API est disponible dans v1.0, utilisez le sélecteur Version .
Utilisez cette API pour créer un graphique.
Cette API est disponible dans les déploiements de cloud national suivants.
| Service global |
Gouvernement des États-Unis L4 |
Us Government L5 (DOD) |
Chine gérée par 21Vianet |
| ✅ |
✅ |
✅ |
❌ |
Autorisations
Choisissez l’autorisation ou les autorisations marquées comme moins privilégiées pour cette API. Utilisez une autorisation ou des autorisations privilégiées plus élevées uniquement si votre application en a besoin. Pour plus d’informations sur les autorisations déléguées et d’application, consultez Types d’autorisations. Pour en savoir plus sur ces autorisations, consultez les informations de référence sur les autorisations.
| Type d’autorisation |
Autorisations avec privilèges minimum |
Autorisations privilégiées plus élevées |
| Déléguée (compte professionnel ou scolaire) |
Files.ReadWrite |
Non disponible. |
| Déléguée (compte Microsoft personnel) |
Files.ReadWrite |
Non disponible. |
| Application |
Non prise en charge. |
Non prise en charge. |
Requête HTTP
POST /me/drive/items/{id}/workbook/worksheets/{id|name}/charts/
POST /me/drive/root:/{item-path}:/workbook/worksheets/{id|name}/charts/
| Nom |
Description |
| Autorisation |
Porteur {token}. Obligatoire. En savoir plus sur l’authentification et l’autorisation. |
| Workbook-Session-Id |
ID de session d’un classeur qui détermine si les modifications sont permanentes ou non. Facultatif. |
Corps de la demande
Dans le corps de la demande, fournissez une représentation JSON de l’objet workbookChart .
Réponse
Si elle réussit, cette méthode renvoie 201 Created le code de réponse et l’objet workbookChart dans le corps de la réponse.
Exemple
Demande
L’exemple suivant illustre une demande.
POST https://graph.microsoft.com/beta/me/drive/items/{id}/workbook/worksheets/{id|name}/charts
Content-type: application/json
{
"id": "id-value",
"height": 99,
"left": 99
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new WorkbookChart
{
Id = "id-value",
Height = 99d,
Left = 99d,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Drives["{drive-id}"].Items["{driveItem-id}"].Workbook.Worksheets["{workbookWorksheet-id}"].Charts.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"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewWorkbookChart()
id := "id-value"
requestBody.SetId(&id)
height := float64(99)
requestBody.SetHeight(&height)
left := float64(99)
requestBody.SetLeft(&left)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
charts, err := graphClient.Drives().ByDriveId("drive-id").Items().ByDriveItemId("driveItem-id").Workbook().Worksheets().ByWorkbookWorksheetId("workbookWorksheet-id").Charts().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
WorkbookChart workbookChart = new WorkbookChart();
workbookChart.setId("id-value");
workbookChart.setHeight(99d);
workbookChart.setLeft(99d);
WorkbookChart result = graphClient.drives().byDriveId("{drive-id}").items().byDriveItemId("{driveItem-id}").workbook().worksheets().byWorkbookWorksheetId("{workbookWorksheet-id}").charts().post(workbookChart);
const options = {
authProvider,
};
const client = Client.init(options);
const workbookChart = {
id: 'id-value',
height: 99,
left: 99
};
await client.api('/me/drive/items/{id}/workbook/worksheets/{id|name}/charts')
.version('beta')
.post(workbookChart);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\WorkbookChart;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new WorkbookChart();
$requestBody->setId('id-value');
$requestBody->setHeight(99);
$requestBody->setLeft(99);
$result = $graphServiceClient->drives()->byDriveId('drive-id')->items()->byDriveItemId('driveItem-id')->workbook()->worksheets()->byWorkbookWorksheetId('workbookWorksheet-id')->charts()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.workbook_chart import WorkbookChart
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = WorkbookChart(
id = "id-value",
height = 99,
left = 99,
)
result = await graph_client.drives.by_drive_id('drive-id').items.by_drive_item_id('driveItem-id').workbook.worksheets.by_workbook_worksheet_id('workbookWorksheet-id').charts.post(request_body)
Dans le corps de la demande, fournissez une représentation JSON de l’objet workbookChart .
Réponse
L’exemple suivant illustre la réponse. Remarque : l’objet de réponse affiché ci-après peut être raccourci pour plus de lisibilité.
HTTP/1.1 201 Created
Content-type: application/json
{
"id": "id-value",
"height": 99,
"left": 99
}