Exemplo n.º 1
0
        /// <summary>
        /// Send string request of Provision command to the server and get the Provision response.
        /// </summary>
        /// <param name="provisionRequest">The string request of Provision command.</param>
        /// <returns>The response of Provision command.</returns>
        public ProvisionResponse SendProvisionStringRequest(string provisionRequest)
        {
            SendStringResponse provisionStringResponse = this.activeSyncClient.SendStringRequest(CommandName.Provision, null, provisionRequest);

            Site.Assert.IsNotNull(provisionStringResponse, "The SendStringRequest response returned from server should not be null.");

            // Convert the SendStringResponse to ProvisionResponse.
            ProvisionResponse provisionResponse = new ProvisionResponse
            {
                ResponseDataXML = provisionStringResponse.ResponseDataXML
            };

            provisionResponse.DeserializeResponseData();

            return(provisionResponse);
        }
        /// <summary>
        /// Get policy key from Provision string response.
        /// </summary>
        /// <param name="provisionResponseString">The SendStringResponse instance of Provision command.</param>
        /// <returns>The policy key of the policy.</returns>
        public static string GetPolicyKeyFromSendString(ActiveSyncResponseBase<object> provisionResponseString)
        {
            ProvisionResponse provisionResponse = new ProvisionResponse
            {
                ResponseDataXML = provisionResponseString.ResponseDataXML
            };

            if (!string.IsNullOrEmpty(provisionResponse.ResponseDataXML))
            {
                provisionResponse.DeserializeResponseData();

                if (provisionResponse.ResponseData.Policies != null)
                {
                    Response.ProvisionPoliciesPolicy policyInResponse = provisionResponse.ResponseData.Policies.Policy;
                    if (policyInResponse != null)
                    {
                        return policyInResponse.PolicyKey;
                    }
                }
            }

            return string.Empty;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Get policy key from Provision string response.
        /// </summary>
        /// <param name="provisionResponseString">The SendStringResponse instance of Provision command.</param>
        /// <returns>The policy key of the policy.</returns>
        public static string GetPolicyKeyFromSendString(ActiveSyncResponseBase <object> provisionResponseString)
        {
            ProvisionResponse provisionResponse = new ProvisionResponse
            {
                ResponseDataXML = provisionResponseString.ResponseDataXML
            };

            if (!string.IsNullOrEmpty(provisionResponse.ResponseDataXML))
            {
                provisionResponse.DeserializeResponseData();

                if (provisionResponse.ResponseData.Policies != null)
                {
                    Response.ProvisionPoliciesPolicy policyInResponse = provisionResponse.ResponseData.Policies.Policy;
                    if (policyInResponse != null)
                    {
                        return(policyInResponse.PolicyKey);
                    }
                }
            }

            return(string.Empty);
        }
        /// <summary>
        /// Send string request of Provision command to the server and get the Provision response.
        /// </summary>
        /// <param name="provisionRequest">The string request of Provision command.</param>
        /// <returns>The response of Provision command.</returns>
        public ProvisionResponse SendProvisionStringRequest(string provisionRequest)
        {
            SendStringResponse provisionStringResponse = this.activeSyncClient.SendStringRequest(CommandName.Provision, null, provisionRequest);
            Site.Assert.IsNotNull(provisionStringResponse, "The SendStringRequest response returned from server should not be null.");

            // Convert the SendStringResponse to ProvisionResponse.
            ProvisionResponse provisionResponse = new ProvisionResponse
            {
                ResponseDataXML = provisionStringResponse.ResponseDataXML
            };
            provisionResponse.DeserializeResponseData();

            return provisionResponse;
        }