Importing a layout does not preserve Map frame-map connection

244
1
07-10-2020 09:12 AM
AnandhaSudhan
New Contributor II

Environment: ArcGIS Pro 2.5

ArcGIS Desktop Layout DLL version: 12.4.0.0

While trying to export and import the same layout, I am losing the map frame's map connection in the layout. If I export the layout and open it normally in ArcGIS Pro, the 'map frame - map' connection is preserved. But, when I do the same using the ArcGIS Pro SDK, the 'map frame-map' connection is lost.

//Export the layout
Layout.SaveAsFile(layoutFilePath) 

//Import the layout
Item importedProjectItem = ItemFactory.Instance.Create(layoutFilePath, ItemFactory.ItemType.PathItem);

List<LayoutProjectItem> layoutProjectItemsBeforeImport = Project.Current.GetItems<LayoutProjectItem>().ToList();

//Add the imported item to the current project
Project.Current.AddItem((IProjectItem)importedProjectItem);

//Find the newly added layout project item
LayoutProjectItem importedLayoutProjectItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => !layoutProjectItemsBeforeImport.Contains(item));

//Get the layout
newLayout = importedLayoutProjectItem.GetLayout();‍‍‍‍‍‍‍‍‍‍‍‍‍

The imported layout (newLayout) does not contain the 'map frame - map' connection. ie. the map frame is empty instead of pointing to the actual map. Is this a bug with the SDK or am I doing something wrong here? Any insight would be appreciated. Thank you!

0 Kudos
1 Reply
UmaHarano
Esri Regular Contributor

Hi Anandha,

I am not able to see this problem in ArcGIS Pro 2.6. ArcGIS Pro 2.6 is set to release end of this month. Can you please check on this version and see if you can reproduce the problem?

Thank you for reporting this!

Uma

0 Kudos