Dans le corps de la demande, fournissez une représentation JSON de l’objet browserSharedCookie .
Vous pouvez spécifier les propriétés suivantes lorsque vous créez un browserSharedCookie.
Propriété
Type
Description
comment
Chaîne
Commentaire du cookie. Obligatoire.
displayName
Chaîne
Nom du cookie. Obligatoire.
hostOnly
Valeur booléenne
Détermine si un cookie est un cookie hôte uniquement ou un cookie de domaine. Obligatoire.
hostOrDomain
Chaîne
URL du cookie. Obligatoire.
chemin
Chaîne
Chemin d’accès du cookie. Obligatoire.
sourceEnvironment
browserSharedCookieSourceEnvironment
Spécifie la façon dont les cookies sont partagés entre Microsoft Edge et Internet Explorer. Les valeurs possibles sont : microsoftEdge, internetExplorer11, both, unknownFutureValue. Obligatoire.
Réponse
Si elle réussit, cette méthode renvoie un 201 Created code de réponse et un objet browserSharedCookie dans le corps de la réponse.
POST https://graph.microsoft.com/v1.0/admin/edge/internetExplorerMode/siteLists/e370d818-f650-5ab1-499e-5915e83f4573/sharedCookies
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.browserSharedCookie",
"hostOrDomain": "www.microsoft.com",
"sourceEnvironment": "InternetExplorer11",
"displayName": "Microsoft Cookie",
"hostOnly": true,
"comment": "A cookie for microsoft.com",
"path": "/"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new BrowserSharedCookie
{
OdataType = "#microsoft.graph.browserSharedCookie",
HostOrDomain = "www.microsoft.com",
SourceEnvironment = BrowserSharedCookieSourceEnvironment.InternetExplorer11,
DisplayName = "Microsoft Cookie",
HostOnly = true,
Comment = "A cookie for microsoft.com",
Path = "/",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Admin.Edge.InternetExplorerMode.SiteLists["{browserSiteList-id}"].SharedCookies.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
BrowserSharedCookie browserSharedCookie = new BrowserSharedCookie();
browserSharedCookie.setOdataType("#microsoft.graph.browserSharedCookie");
browserSharedCookie.setHostOrDomain("www.microsoft.com");
browserSharedCookie.setSourceEnvironment(BrowserSharedCookieSourceEnvironment.InternetExplorer11);
browserSharedCookie.setDisplayName("Microsoft Cookie");
browserSharedCookie.setHostOnly(true);
browserSharedCookie.setComment("A cookie for microsoft.com");
browserSharedCookie.setPath("/");
BrowserSharedCookie result = graphClient.admin().edge().internetExplorerMode().siteLists().byBrowserSiteListId("{browserSiteList-id}").sharedCookies().post(browserSharedCookie);
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultez https://aka.ms/ContentUserFeedback.