SAPIWS_Sample.SPMLSoapClient.SPML.search C# (CSharp) Method

search() private method

private search ( [ Namespace = "urn:oasis:names:tc:SPML:2:0:search")]SearchRequestTypesearchRequest ) : SearchResponseType
Namespace [
return SearchResponseType
        public SearchResponseType search([System.Xml.Serialization.XmlElementAttribute(Namespace="urn:oasis:names:tc:SPML:2:0:search")] SearchRequestType searchRequest) {
            object[] results = this.Invoke("search", new object[] {
                        searchRequest});
            return ((SearchResponseType)(results[0]));
        }
        

Usage Example

        private void button1_Click(object sender, EventArgs e)
        {
            var client = new SPMLSoapClient.SPML();

            // build the CoSign Logon Data
            var data = new SPMLSoapClient.CoSignLogonData();
            data.User = txtUsername.Text;
            data.Password = txtPassword.Text;

            // buils a search request
            var searchRequest = new SPMLSoapClient.SearchRequestType();
            searchRequest.CoSignLogonData = data;
            searchRequest.returnData = SPMLSoapClient.ReturnDataType.data;
            searchRequest.maxSelect = 20; // number of users to fetch
            searchRequest.maxSelectSpecified = true;

            SPMLSoapClient.SearchResponseType response;
            try
            {
                // make the call
                response = client.search(searchRequest);
                if (response.status != SPMLSoapClient.StatusCodeType.success)
                {
                    MessageBox.Show("Error on search: " + response.status + ", " + response.error + ", " + response.errorMessage[0], "Error");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
                return;
            }
            if (response.pso == null)
            {
                MessageBox.Show("No users!", "OK");
                return;
            }

            //populate the text box with the users from the response
            for (int i = 0; i < response.pso.Length; i++)
            {
                String usrs = (i + 1) + ": " + response.pso[i].psoID.ID + ", " + response.pso[i].UserRecord.UserCN +
                             "," + response.pso[i].UserRecord.EmailAddress + ", " + response.pso[i].UserRecord.RightsMask;
                richTextBox1.Text += (usrs + "\n");
            }
        }