Hi Everyone,
I am new to programming ArcGIS Pro SDK with C# but have over 10 years experience in ArcObjects (ArcMap 10.X) with C# and am trying to convert one of our C# scripts that creates maps automatically. I have converted each function from the original code to Pro SDK functions. The code reads a text file to get a permit number and creates a map for that permit. Everything works great on the first permit but as soon as it goes to do the second permit, the code loses its reference to the MapView.
Using the first example from this ESRI GetMapView Method—ArcGIS Pro example, I created this function
public static MapView SetActiveMapView(Layout pageLayout)
{
LayoutView lytView = LayoutView.Active;
MapFrame mf_bmp = pageLayout.FindElement("LWDD Documents Map") as MapFrame;
MapView mv_bmp = mf_bmp.GetMapView(lytView);
return mv_bmp;
}
The code crashes with a "ACCESS DENIED" error on line MapView mv_bmp = mf_bmp.GetMapView(lytView);
It's probably something simple since I'm new to ArcGIS Pro SDK but I have been spinning my wheels on this for a couple of weeks and can't get past it. Can anyone point me in the right direction?