ArcGIS Pro 2.9 API Reference Guide
SetBasemapLayers(Item) Method

ArcGIS.Desktop.Mapping Namespace > Map Class > SetBasemapLayers Method : SetBasemapLayers(Item) Method
The local basemap whose layers will be used as basemap content
Sets the current basemap layers in the map. This method must be called on the MCT. Use QueuedTask.Run
Syntax
public void SetBasemapLayers( 
   Item baseMapItem
)
Public Overloads Sub SetBasemapLayers( _
   ByVal baseMapItem As Item _
) 

Parameters

baseMapItem
The local basemap whose layers will be used as basemap content
Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
The exception that is thrown when one of the arguments provided to a method is not valid.
Remarks
Use this flavor of SetBasemapLayers with either:
o A base map PortalItem retrieved from your portal or organization (ArcGIS.Desktop.Core.ArcGISPortalExtensions.GetBasemapsAsync)
o A local base map MapProjectItem within your project (created either via the UI or via the API MapFactory.CreateLocalBasemap)
Attempting to use any other kind of item will result in an System.ArgumentException
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

See Also

Reference

Map Class
Map Members
Overload List