how to use GetLine and UpdateLine in C#?

Version 1
    This document was generated from CDN thread

    Created by: sujit pillai on 10-06-2009 01:47:41 PM
    Can anyone help me to findout line information using GetLine function?
    how to update calling search space, alerting name, display of line using UpdateLine?
    I am able to retrive information of line using GetPhone() and try to use the line information (UUID) in GetLine but its not working can any one resolved this issue
     
     
    Thanks
     
     
     

    Subject: RE: how to use GetLine and UpdateLine in C#?
    Replied by: Randy Richardson on 25-06-2009 03:17:50 PM
    I'm using C# and I'm also having the same problem.
     
    When using the getLine method, it get an error saying "The specified Line was not found." For the GetLine method, I used the uuid i got directly from a ListPhoneResponsePhone object.
     
    Also trying to use UpdateLine to change the callfoward settings and I get a "PKId is not correct" message.
     
    Anyone have some insight into this?

    Subject: RE: how to use GetLine and UpdateLine in C#?
    Replied by: Alex Arwine on 25-06-2009 06:38:14 PM
    Was trying to grab the XML that I'm sending for the getline, but it doesn't look like I've implemented it yet.
     
    I do have an example updateline here if you'd like to compare the XML.

    http://www.geeknook.org/paste.php?id=48




     -alex

    Subject: RE: how to use GetLine and UpdateLine in C#?
    Replied by: David Staudt on 25-06-2009 08:49:32 PM
    Note that the UUID you want is the one in the <dirn> element, not the <line> element itself (which is the UUID of the line _appearance_.)
     
    http://developer.cisco.com/web/axl/forums/-/message_boards/message/1410097

    Subject: RE: how to use GetLine and UpdateLine in C#?
    Replied by: Randy Richardson on 06-07-2009 01:32:23 PM
    I've tried some of the suggestions above but still not having any luck. Even when using the UUID of the line element, I'm still getting the error message "The specified Line was not found"
     
    Here's my code so far in C#. My end goal is to be able to change the callfwd number.
     

           ListPhoneByNameReq listphones = new ListPhoneByNameReq();
                listphones.searchString = "SEP001E13AFEA5A";
     
                ListPhoneResponsePhone[] phones = axlService.listPhoneByName(listphones).@return;
                foreach (ListPhoneResponsePhone phone in phones)
                {
                    System.Console.WriteLine(phone.name + " " + phone.model + " " + phone.uuid);
     
     
                    GetPhoneReq getphone = new GetPhoneReq();
                    getphone.ItemElementName = ItemChoiceType29.phoneName;
                    getphone.Item = phone.name;
     
     
                    foreach (XLine line in axlService.getPhone(getphone).@return.device.lines.Items)
                    {
                        Console.WriteLine(line.uuid);
     
                        GetLineReq getline = new GetLineReq();
                        getline.uuid = line.uuid;
                        GetLineResReturn phoneLine = axlService.getLine(getline).@return;
                        System.Console.WriteLine(phoneLine.directoryNumber.callForwardAll);
                    }
     
                 }   

     
    This works till the point of writing out the UUID for the XLine object.

    Subject: RE: how to use GetLine and UpdateLine in C#?
    Replied by: David Staudt on 06-07-2009 04:50:26 PM
    It's confusing, but you're still attempting to use the UUID of the <line> element. 
     
                        getline.uuid = line.uuid;
     
    You need to use the UUID of the <line><dirn> element.  I'm not precisely sure how it would look in C#, but maybe something like:
     
                        getline.uuid = line.dirn.uuid;

    Subject: RE: how to use GetLine and UpdateLine in C#?
    Replied by: Randy Richardson on 16-07-2009 01:58:16 PM
    I was finally able to get this to work. 
     
    For anyone else who comes across this using C# .NET, I was able to use GetLine and UpdateLine as shown below. We have Call Manager 6.1
     
    // GetLine
    GetLineReq getLine = new GetLineReq();

    getLine.pattern = "1234"; //extension
    GetLineRes line = axlService.getLine(getLine);

     
    // UpdateLine

    UpdateLineReq updateLine = new UpdateLineReq();
    updateLine.pattern = "1234"; //extension
    //setting the call forward info            
    XCallForwardInfo info = new XCallForwardInfo();
    info.destination = "4567"; // foward to this number
    info.duration = -1;
    updateLine.callForwardAll = info;
    axlService.updateLine(updateLine);

     
    axlService is an instance of AXLAPIService.