Export (0) Print
Expand All
Expand Minimize

ReportingService2005.CreateRole Method

SQL Server 2005

Adds a new role to the report server database.

Namespace: Microsoft.WSSUX.ReportingServicesWebService.RSManagementService2005
Assembly: ReportService2005 (in reportingservice2005.dll)

[SoapHeaderAttribute("BatchHeaderValue")] 
[SoapDocumentMethodAttribute("http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/CreateRole", RequestNamespace="http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", ResponseNamespace="http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)] 
[SoapHeaderAttribute("ServerInfoHeaderValue", Direction=SoapHeaderDirection.Out)] 
public void CreateRole (
	string Name,
	string Description,
	Task[] Tasks
)
/** @attribute SoapHeaderAttribute("BatchHeaderValue") */ 
/** @attribute SoapDocumentMethodAttribute("http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/CreateRole", RequestNamespace="http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", ResponseNamespace="http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped) */ 
/** @attribute SoapHeaderAttribute("ServerInfoHeaderValue", Direction=SoapHeaderDirection.Out) */ 
public void CreateRole (
	String Name, 
	String Description, 
	Task[] Tasks
)
SoapHeaderAttribute("BatchHeaderValue") 
SoapDocumentMethodAttribute("http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/CreateRole", RequestNamespace="http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", ResponseNamespace="http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped) 
SoapHeaderAttribute("ServerInfoHeaderValue", Direction=SoapHeaderDirection.Out) 
public function CreateRole (
	Name : String, 
	Description : String, 
	Tasks : Task[]
)

Parameters

Name

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

Description

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

Tasks

An array of Task objects that represents the tasks to set for the role. Only the TaskID property of the Task object is submitted to create a role.

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 in Reporting Services.


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:

using System;
using System.Web.Services.Protocols;

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

      string name = "Report Browser";
      string desc = "View folders and reports.";
      Task[] setTasks = new Task[3];
      setTasks[0] = new Task();
      setTasks[1] = new Task();
      setTasks[2] = new Task();

      try
      {
         Task[] returnedTasks = rs.ListTasks();

         foreach( Task t in returnedTasks )
         {
            if ( t.Name == "View reports" )
            {
               setTasks[0] = t;
            }

            else if ( t.Name == "View folders" )
            {
               setTasks[1] = t;
            }

            else if ( t.Name == "View resources" )
            {
               setTasks[2] = t;
            }
         }

         rs.CreateRole( name, desc, setTasks );
      }

      catch ( SoapException e )
      {
         Console.WriteLine( e.Detail.InnerXml.ToString() );
      }
   }
}

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

Target Platforms

Community Additions

ADD
Show:
© 2014 Microsoft