In the request body, supply the values for relevant fields that should be updated. Existing properties that are not included in the request body will maintain their previous values or be recalculated based on changes to other property values. For best performance, don't include existing values that haven't changed.
You must specify the @odata.type as #microsoft.graph.countryNamedLocation.
Property
Type
Description
countriesAndRegions
String collection
List of countries and/or regions in two-letter format specified by ISO 3166-2.
displayName
String
Human-readable name of the location.
includeUnknownCountriesAndRegions
Boolean
The value is true if IP addresses that don't map to a country or region should be included in the named location.
Response
If successful, this method returns a 204 No Content response code. It does not return anything in the response body.
PATCH https://graph.microsoft.com/v1.0/identity/conditionalAccess/namedLocations/1c4427fd-0885-4a3d-8b23-09a899ffa959
Content-type: application/json
{
"@odata.type": "#microsoft.graph.countryNamedLocation",
"displayName": "Updated named location without unknown countries and regions",
"countriesAndRegions": [
"CA",
"IN"
],
"includeUnknownCountriesAndRegions": false
}
// Code snippets are only available for the latest version. Current version is 5.x
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new CountryNamedLocation
{
OdataType = "#microsoft.graph.countryNamedLocation",
DisplayName = "Updated named location without unknown countries and regions",
CountriesAndRegions = new List<string>
{
"CA",
"IN",
},
IncludeUnknownCountriesAndRegions = false,
};
var result = await graphClient.Identity.ConditionalAccess.NamedLocations["{namedLocation-id}"].PatchAsync(requestBody);
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc identity conditional-access named-locations patch --named-location-id {namedLocation-id} --body '{\
"@odata.type": "#microsoft.graph.countryNamedLocation",\
"displayName": "Updated named location without unknown countries and regions",\
"countriesAndRegions": [\
"CA",\
"IN"\
],\
"includeUnknownCountriesAndRegions": false\
}\
'
<?php
// THIS SNIPPET IS A PREVIEW VERSION OF THE SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new CountryNamedLocation();
$requestBody->setOdataType('#microsoft.graph.countryNamedLocation');
$requestBody->setDisplayName('Updated named location without unknown countries and regions');
$requestBody->setCountriesAndRegions(['CA', 'IN', ]);
$requestBody->setIncludeUnknownCountriesAndRegions(false);
$result = $graphServiceClient->identity()->conditionalAccess()->namedLocations()->byNamedLocationId('namedLocation-id')->patch($requestBody)->wait();
# THE PYTHON SDK IS IN PREVIEW. FOR NON-PRODUCTION USE ONLY
graph_client = GraphServiceClient(request_adapter)
request_body = CountryNamedLocation(
odata_type = "#microsoft.graph.countryNamedLocation",
display_name = "Updated named location without unknown countries and regions",
countries_and_regions = [
"CA",
"IN",
]
include_unknown_countries_and_regions = False,
)
result = await graph_client.identity.conditional_access.named_locations.by_named_location_id('namedLocation-id').patch(body = request_body)