Dans le corps de la demande, fournissez une représentation JSON de l’objet itemAddress .
Le tableau suivant indique les propriétés qu’il est possible de définir lors de la création d’un objet itemAddress dans le profil d’un utilisateur.
Propriété
Type
Description
allowedAudiences
Chaîne
Audiences qui peuvent voir les valeurs contenues dans l’entité. Hérité de itemFacet. Les valeurs possibles sont les suivantes : me, family, contacts, groupMembers, organization, federatedOrganizations, everyone et unknownFutureValue.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new ItemAddress
{
DisplayName = "Home",
Detail = new PhysicalAddress
{
Type = PhysicalAddressType.Home,
PostOfficeBox = null,
Street = "221B Baker Street",
City = "London",
State = null,
CountryOrRegion = "United Kingdom",
PostalCode = "E14 3TD",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.Profile.Addresses.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.NewItemAddress()
displayName := "Home"
requestBody.SetDisplayName(&displayName)
detail := graphmodels.NewPhysicalAddress()
type := graphmodels.HOME_PHYSICALADDRESSTYPE
detail.SetType(&type)
postOfficeBox := null
detail.SetPostOfficeBox(&postOfficeBox)
street := "221B Baker Street"
detail.SetStreet(&street)
city := "London"
detail.SetCity(&city)
state := null
detail.SetState(&state)
countryOrRegion := "United Kingdom"
detail.SetCountryOrRegion(&countryOrRegion)
postalCode := "E14 3TD"
detail.SetPostalCode(&postalCode)
requestBody.SetDetail(detail)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
addresses, err := graphClient.Me().Profile().Addresses().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
ItemAddress itemAddress = new ItemAddress();
itemAddress.setDisplayName("Home");
PhysicalAddress detail = new PhysicalAddress();
detail.setType(PhysicalAddressType.Home);
detail.setPostOfficeBox(null);
detail.setStreet("221B Baker Street");
detail.setCity("London");
detail.setState(null);
detail.setCountryOrRegion("United Kingdom");
detail.setPostalCode("E14 3TD");
itemAddress.setDetail(detail);
ItemAddress result = graphClient.me().profile().addresses().post(itemAddress);
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.item_address import ItemAddress
from msgraph_beta.generated.models.physical_address import PhysicalAddress
from msgraph_beta.generated.models.physical_address_type import PhysicalAddressType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = ItemAddress(
display_name = "Home",
detail = PhysicalAddress(
type = PhysicalAddressType.Home,
post_office_box = None,
street = "221B Baker Street",
city = "London",
state = None,
country_or_region = "United Kingdom",
postal_code = "E14 3TD",
),
)
result = await graph_client.me.profile.addresses.post(request_body)