ReportingService2010.CreateRole Method (String, String, String )
Applies To: SQL Server 2016 Preview
Adds a new role to the report server database. This method only applies to native mode.
Namespace: ReportService2010
Assembly: ReportService2010 (in ReportService2010.dll)
Syntax
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateRole",
RequestNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer",
ResponseNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer",
Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
[SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)]
[SoapHeaderAttribute("TrustedUserHeaderValue")]
public void CreateRole(
string Name,
string Description,
string[] TaskIDs
)
public:
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateRole",
RequestNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer",
ResponseNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer",
Use = SoapBindingUse::Literal, ParameterStyle = SoapParameterStyle::Wrapped)]
[SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection::Out)]
[SoapHeaderAttribute("TrustedUserHeaderValue")]
void CreateRole(
String^ Name,
String^ Description,
array<String^>^ TaskIDs
)
[<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateRole",
RequestNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer",
ResponseNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer",
Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)>]
[<SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)>]
[<SoapHeaderAttribute("TrustedUserHeaderValue")>]
member CreateRole :
Name:string *
Description:string *
TaskIDs:string[] -> unit
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateRole",
RequestNamespace := "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer",
ResponseNamespace := "https://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()
)
Parameters
Name
Type: System.StringThe name of the new role. The value of this parameter must be between 1 and 260 characters long.
Description
Type: System.StringA 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.
Remarks
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 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.
Examples
Legacy Code Example
To compile this code example, you must reference the Reporting Services WSDL and import certain namespaces. For more information, see . The following code example uses the CreateRole method to create a user role that has permissions to view folders and reports:Unable to find linked topic '317946aa-8e95-4f0b-8170-394c9d5e184e'.
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
using System;
using System.Web.Services.Protocols;
class Sample
{
public static void Main()
{
ReportingService2010 rs = new ReportingService2010();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
try
{
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)
{
taskIDs.Add(t.TaskID);
}
rs.CreateRole(name, desc, taskIDs.ToArray());
}
catch (SoapException e)
{
Console.WriteLine(e.Detail.InnerXml.ToString());
}
}
}
See Also
ReportingService2010 Class
ReportService2010 Namespace
Return to top