C# Adding a Route Partition to a Line

Version 1
    This document was generated from CDN thread

    Created by: Chris Bertrand on 15-03-2010 02:05:06 PM
    I am able to set up a line however i cannot seem to associate the line to a route partition. Using the CCM i simply select the correct one from the drop down. How would i accomplish this in .NET?
    I have tried creating an XroutePartition object and setting this up to go into the XNPDirectoryNumber.Item however i think this may be the wrong location. I have looked at lines that already have an associated route partition but i cannot seem to find how they are linked. I am using 7.1
    Can anyone shed any light on this?

    Subject: RE: C# Adding a Route Partition to a Line
    Replied by: Chris Bertrand on 17-03-2010 10:20:31 AM
    Once again no responses, oh well. Here's the way if anyones interested.

    XRoutePartition part = new XRoutePartition();
    part.description = description;
    part.partitionUsage = XPartitionUsage.General;
    part.ItemElementName = ItemChoiceType.timeScheduleId;
    part.timeZone = timezone;
    part.name = partitionName;
    GetRoutePartitionReq getR = new GetRoutePartitionReq();
    getR.ItemElementName = ItemChoiceType51.partitionName;
    getR.Item = partitionName
    GetRoutePartitionRes res = axlService.getRoutePartition(getR);
    GetRoutePartitionResReturn result = res.@return;
    part.uuid = result.routepartition.uuid;  // The important line, otherwise will not WORK!!!
    then you have to use the partition element in XNPDirectoryNumber element: field: Item

    newnum.Item = part;