tags:

views:

22

answers:

0

I'm writing a user provisioning Windows fat client application and am running into problems when I try to create an account for the user on LCS. My code looks like this:

        /// <summary>
    /// Creates a user account on the Live Communications Server.
    /// </summary>
    /// <param name="Alias">The person's address in the form of [email protected].</param>
    /// <param name="DistinguishedName">The user's distinguished name.</param>
    /// <returns></returns>
    public bool CreateUser(string Alias, string DistinguishedName)
    {
        bool isCreated = false;
        // OU=User Accounts,DC=dom1,DC=blah,DC=edu


        try
        {
            using (ManagementClass UserClass = new ManagementClass(@"\\blah.dom1.blah.edu\root\cimv2", "MSFT_SIPESUserSetting", null))
            {
                //SIP Enable
                ManagementObject LCSSettings = UserClass.CreateInstance();

                LCSSettings["PrimaryUri"] = string.Format("sip:{0}@blah.edu", Alias);

                LCSSettings["Enabled"] = true;

                LCSSettings["HomeServerDN"] = "blah.dom1.blah.edu";

                LCSSettings["UserDN"] = DistinguishedName;

                PutOptions opt = new PutOptions();
                opt.Type = PutType.CreateOnly;

                LCSSettings.Put();

                isCreated = true;
            }
        }
        catch (Exception ex)
        {
            throw new Exception(String.Format("LCS Account could not be created. {0}", ex.Message));
        }

        return isCreated;

    }

On the LCSSettings.Put, I'm throwing an exception with a wonderful error message - blank. If I put in LCSSettings.Put(opt) I get an error of "Provider is not capable of the attempted operation."

Anyone gotten around this before?