Get in and out connections between shapes in a Diagram using Aspose.Diagram for .NET

Hi,
I am trying to access shapes Id in a visio file sampleVisio.png (42.2 KB)
which are connected using a dynamic connector.
For eg I am trying to see to which other shapes is my first shape connected to
I am reading all the shapes and saving there ID with the following code

foreach (Aspose.Diagram.Shape shape in vsdDiagram.Pages[0].Shapes)
            {
                // Display information about the shapes
                Console.WriteLine("\nShape ID : " + shape.ID);
                Console.WriteLine("Name : " + shape.Name);
               // Console.WriteLine("Master Shape : " + shape.Master.Name);
            }

and connection info using

foreach (Aspose.Diagram.Connect connector in vdxDiagram.Pages[0].Connects)
            {
                
                // Display information about the Connectors
                Console.WriteLine("\nFrom Shape ID : " + connector.FromSheet);
                Console.WriteLine("To Shape ID : " + connector.ToSheet);
            }

However the connection Id’s don’t match

@rohit8190

Thanks for contacting support.

Please try to use following code snippet to retrieve connections or Shape IDs from all incoming and outgoing nodes:

// Call a Diagram class constructor to load the VSDX diagram
Aspose.Diagram.Diagram diagram = new Aspose.Diagram.Diagram(dataDir + "Example.vsdx");
// Get page by name
Aspose.Diagram.Page page = diagram.Pages.GetPage("Page-1");
foreach(Aspose.Diagram.Shape s in page.Shapes)
{
 long[] In_connectedShapeIds = s.ConnectedShapes(Aspose.Diagram.ConnectedShapesFlags.ConnectedShapesIncomingNodes, null);
 long[] Out_connectedShapeIds = s.ConnectedShapes(Aspose.Diagram.ConnectedShapesFlags.ConnectedShapesOutgoingNodes, null);
}