//This method connects to the RS instance based on the RS instance url, and get the permissions for the //specified path. public void GetExistingPermissions(String rsUrl, String path) { try { if (path == "Home") { m_strPath = "/"; } else { m_strPath = path; } //Connects the RS Instance m_rs = new ReportingService2010(); m_rs.Credentials = System.Net.CredentialCache.DefaultCredentials; m_soapUrl = rsUrl + m_wsdl; m_rs.Url = m_soapUrl; //Add the columns based on the Roles defined AddColumnsToGrid(); //Displays the permissions for the Users ShowPermissions(); this.Text = "Permissions on the Report item : " + m_strPath; } catch (UriFormatException ex) { MessageBox.Show("Not connected to any Reportserver instance."); this.Close(); } }
//The method used to connect to an RS instance specified in the strReportserverurl private void InvokeRSInstance(String strReportserverurl) { try { if (strReportserverurl == string.Empty || strReportserverurl == null) { return; } m_path = strReportserverurl; m_rs = new ReportingService2010(); m_rs.Credentials = System.Net.CredentialCache.DefaultCredentials; m_soapUrl = m_path + m_wsdl; m_rs.Url = m_soapUrl; //This method loads the Catalog contents to the Treeview LoadObjectExplorer(); lvChildren.Columns.Clear(); lvChildren.Columns.Add("Name"); lblMessage.Text = "Report Server instance : " + strReportserverurl.ToString(); lblMessage.TextAlign = ContentAlignment.BottomCenter; } //Catch the invalid URI format exception catch (UriFormatException uriEx) { MessageBox.Show(uriEx.Message.ToString() + " Please check the Reportserver URL"); } //Catch the report server connectivity exception catch (System.Net.WebException webEx) { MessageBox.Show(webEx.Message.ToString()); } }