Hi Michael,
To create the ports collection, use the following syntax:
shape.CreateShapeElements(ShapeElementsMask.Ports);