The new ArcGIS Pro SDK for .NET is currently in beta for ArcGIS Pro 1.1, and I'm having trouble with map/project objects.

I can add layers to an existing map, but I can't seem to figure out how to add a new map to the project:

public async void AddMapToProject()
    //create new map and set basemap layer
    Map mymap = new Map("MapName");
    //there's also Map.Create("MapName"), not sure which to use

    //access current project
    Project myproject = Project.Current;
    //this doesn't work
    await myproject.AddAsync(mymap);

    //project has AddAsync(Item item) method, but I don't think 
    //this is for adding maps as it doesn't accept a map object and
    //ArcGIS.Desktop.Core.Item.Create(map.uri) doesn't work

Any ideas? Can't seem to find an example or the correct method anywhere. The API reference for the SDK is here but doesn't offer many examples. Couldn't find much in the github samples / community samples either.

  • Don't know if this will help but I followed your link and ended up on GitHub, they have some sample code here which may have an example of the code you require? Have to admit I could not see an obvious route for adding Maps but then I've never used the object model of ArcGIS Pro.
    – Hornbydd
    Jul 6, 2015 at 13:35
  • Yeah unfortunately I've gone through all the sample code already and couldn't see what I needed. It seems like such a fundamental thing to do so I'm not quite sure why I'm having so much trouble finding anything. Perhaps it doesn't exist yet in beta...
    – pvdev
    Jul 6, 2015 at 14:31

1 Answer 1


I think the beta doc might be a little out of date. I was told to look at the factory methods. (MapFactory.Create, ItemFactory.Create, etc which will be the way to go when the SDK is released at 1.1)

Try this: (note, the map is created in the projectpane, but is not automatically opened)

protected override void OnClick()
  var map = AddMap("myMap");  

private Task<Map> AddMap(string mapName)
    return QueuedTask.Run(() =>
        var map = MapFactory.CreateMap(mapName);
        return map;                

Actually, try this nicer code snippet that opens the new map:

private async Task<Map> CreateAndOpen(string mapName)
    await QueuedTask.Run(() =>
        var map = MapFactory.CreateMap(mapName, basemap: Basemap.ProjectDefault);
        return map;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.