ReportingService2010.CreateRole(String, String, String[]) ReportingService2010.CreateRole(String, String, String[]) ReportingService2010.CreateRole(String, String, String[]) Method


Adds a new role to the report server database. This method only applies to native mode.

 void CreateRole(System::String ^ Name, System::String ^ Description, cli::array <System::String ^> ^ TaskIDs);
[System.Web.Services.Protocols.SoapDocumentMethod("", ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, RequestNamespace="", ResponseNamespace="", Use=System.Web.Services.Description.SoapBindingUse.Literal)]
[System.Web.Services.Protocols.SoapHeader("ServerInfoHeaderValue", Direction=System.Web.Services.Protocols.SoapHeaderDirection.Out)]
public void CreateRole (string Name, string Description, string[] TaskIDs);
Public Sub CreateRole (Name As String, Description As String, TaskIDs As String())
String String String

The name of the new role. The value of this parameter must be between 1 and 260 characters long.

String String String

A description of the new role. The value of this parameter must be between 1 and 512 characters long.


An array of task IDs that represent the tasks to set for the role.


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  

         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    

         rs.CreateRole(name, desc, taskIDs.ToArray())  
      Catch e As SoapException  
      End Try  
   End Sub 'Main  
End Class 'Sample  
using System;  
using System.Web.Services.Protocols;  

class Sample  
   public static void Main()  
     ReportingService2010 rs = new ReportingService2010();  
      rs.Credentials = System.Net.CredentialCache.DefaultCredentials;  

         string name = "Report Browser";  
       string desc = "View folders and reports.";  

         Task[] tasks = rs.ListTasks("All");  
         List<string> taskIDs = new List<string>();  

         foreach (Task t in tasks)  

         rs.CreateRole(name, desc, taskIDs.ToArray());  
      catch (SoapException e)  


The table below shows header and permissions information on this operation.

SOAP Header Usage (In) TrustedUserHeaderValue

(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 null (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.

Applies to