Author Topic: Does anyone know how to set parameter to userData in RequestUpdateUserData ?  (Read 5275 times)

nui

  • Guest
Now, I am trying to make simple softphone using .net sdk with c#.net and I think I also need to attach data from my program but I am did not know how to set parameber into userData(KeyValueCollection ) and does .net sdk support this or not ?

below is some neccessary and source code :

using Genesyslab.Platform.Voice.Protocols.TServer.Requests.Userdata;
using Genesyslab.Platform.Commons.Collections;
^
^
Does reference is enough for coding ?

public static bool UserAttachData(TServerProtocol protocol)
        {
            IMessage response;
            try
            {
                KeyValueCollection userData=null; <<< If I need to set key = "test", values="FirstTime" , Do you know how to set it to userData ?
               
                RequestUpdateUserData reqUpdateuserData = RequestUpdateUserData.Create(
                                                                thisDN,
                                                                connId,
                                                                userData
                                                                );
                response = protocol.Request(reqUpdateuserData);
                Debug.Print(response.ToString());
                return true;
            }
            catch (Exception e)
            {
                return false;
            }
        }

Please give me suggestions, I am very new with genesys, just start learning basic concept.

Nui

Offline René

  • Administrator
  • Hero Member
  • *****
  • Posts: 1832
  • Karma: 62
Hi,

Try this piece of code:

[code]KeyValueCollection userData= new KeyValueCollection();
userData.Add("key","value");
[/code]

The method Add has several overloads. Please check Platform SDK documentation for more information.

René

Marked as best answer by on Today at 01:12:39 PM

nui

  • Guest
Thank you , René for your code

I did not realize about it.  ;D