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"); } }
/// <remarks/> public void searchGroupsAsync(SearchRequestType searchRequest, object userState) { if ((this.searchGroupsOperationCompleted == null)) { this.searchGroupsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnsearchGroupsOperationCompleted); } this.InvokeAsync("searchGroups", new object[] { searchRequest}, this.searchGroupsOperationCompleted, userState); }
/// <remarks/> public void searchGroupsAsync(SearchRequestType searchRequest) { this.searchGroupsAsync(searchRequest, null); }