The view id returned is determined by the same rules associated with the Revit tool “Go to Floor Plan”. Many levels may actually have more than one associated floor plan id and this routine will only return the first one found. If no associated view is found, InvalidElementId is returned.