Jump to content

programmatically create user failes


JensN
 Share


Recommended Posts

Hi all,

 

I want to manage groups and users in an ASP.NET UI.
 

I am using SWConfigDataClientLib.LibManager the following way:

 

using SWConfigDataClientLib;

 

private static LibManager _libManager = null;

private static LibManager libManager
{
            get
            {
                if (_libManager == null)
                {
                    _libManager = new LibManager()
                    {
                        BaseProtocol = SProxyObject.BaseProtocol.TCP,
                        Username = User,
                        Password = Password,
                        WSBaseUrl = Server,
                        AuthenticationMode = SProxyObject.AuthenticationMode.UsernamePassword
                    };
                }
                return _libManager;
            }
}

 

public static void CreateUser(string name)
{
            var usr = libManager.GetUserEnum();
            UserEntry newUser = new UserEntry()

            {
                Name = name
            };
            usr.PrimaryCollection.Add(newUser);
            usr.Update();
            usr.Clear();
            usr.FreeForReuse();

}

 

usr.Update() failes with the following exception:
 

[SSystemException: Der angegebene Schlüssel war nicht im Wörterbuch angegeben.]
   SWConfigDataClientLib.Proxies.Users.UserEnumBase.Update() in C:\vsts-agent1\_work\1174\s\Swyx.ConfigDataStoreClient.Managed\IpPbxCDSClientLib\Proxies\Users\UserEnumBase.cs:232
   SWConfigDataClientLib.Proxies.Users.UserEnum.Update() in C:\vsts-agent1\_work\1174\s\Swyx.ConfigDataStoreClient.Managed\IpPbxCDSClientLib\Proxies\Users\UserEnum.cs:1627
   agenos.SwyxRoundCall.DataAccess.data.CreateUser(string name) in J:\projects\Swyx\agenos.Swyx.RoundCall\agenos.SwyxRoundCall.DataAccess\data.cs:346
   agenos.SwyxRoundCall.Web.groups.LoadGroups() in J:\projects\Swyx\agenos.Swyx.RoundCall\agenos.SwyxRoundCall.Web\groups.aspx.cs:60
   agenos.SwyxRoundCall.Web.groups.Page_Load(Object sender, EventArgs e) in J:\projects\Swyx\agenos.Swyx.RoundCall\agenos.SwyxRoundCall.Web\groups.aspx.cs:21
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +52
   System.Web.UI.Control.OnLoad(EventArgs e) +97
   agenos.SwyxRoundCall.Web.BasePage.OnLoad(EventArgs e) in J:\projects\Swyx\agenos.Swyx.RoundCall\agenos.SwyxRoundCall.Web\App_Code\BasePage.cs:46
   System.Web.UI.Control.LoadRecursive() +61
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +693

Can anyone tell me, what's going wrong, please?

 

Btw. creating groups is working this way:

            var grp = libManager.GetGroupEnum();
            grp.PrimaryCollection.Add(new GroupEntry()
            {
                Comment = comment,
                Name = name,
                InternalName = "internal"
            });
            grp.Update();
            grp.Clear();
            grp.FreeForReuse();

 

Thanks in advance
Jens

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.