ReportingService2010.CreateRole Method
Adds a new role to the report server database. This method only applies to native mode.
Assembly: ReportService2010 (in ReportService2010.dll)
'Declaration <SoapDocumentMethodAttribute("http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateRole", RequestNamespace := "http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", _ ResponseNamespace := "http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", _ Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _ <SoapHeaderAttribute("ServerInfoHeaderValue", Direction := SoapHeaderDirection.Out)> _ <SoapHeaderAttribute("TrustedUserHeaderValue")> _ Public Sub CreateRole ( _ Name As String, _ Description As String, _ TaskIDs As String() _ ) 'Usage Dim instance As ReportingService2010 Dim Name As String Dim Description As String Dim TaskIDs As String() instance.CreateRole(Name, Description, _ TaskIDs)
Parameters
- Name
- Type: System.String
The name of the new role. The value of this parameter must be between 1 and 260 characters long.
- Description
- Type: System.String
A description of the new role. The value of this parameter must be between 1 and 512 characters long.
- TaskIDs
- Type: System.String()
An array of task IDs that represent the tasks to set for the role.
The table below shows header and permissions information on this operation.
SOAP Header Usage | (Out) ServerInfoHeaderValue |
Native Mode Required Permissions | CreateRoles (System) |
SharePoint Mode Required Permissions | Not supported |
This method throws an OperationNotSupportedSharePointMode exception when invoked in SharePont mode.
The Name and Description parameters are required and should not be set to Nothing (Nothing in Visual Basic). The value for Name must be unique.
You must assign at least one task to the role. You cannot combine system-level and item-level tasks within a single role. For more information about tasks, see Tasks and Permissions.
To compile this code example, you must reference the Reporting Services WSDL and import certain namespaces. For more information, see Compiling and Running Code Examples. The following code example uses the CreateRole method to create a user role that has permissions to view folders and reports:
Imports System Imports System.Web.Services.Protocols Class Sample Public Shared Sub Main() Dim rs As New ReportingService2010() rs.Credentials = System.Net.CredentialCache.DefaultCredentials Try Dim name As String = "Report Browser" Dim desc As String = "View folders and reports." Dim tasks As Task() = rs.ListTasks("All") Dim taskIDs As New List(Of String)() For Each t As Task In tasks taskIDs.Add(t.TaskID) Next rs.CreateRole(name, desc, taskIDs.ToArray()) Catch e As SoapException Console.WriteLine(e.Detail.InnerXml.ToString()) End Try End Sub 'Main End Class 'Sample
