다음을 통해 공유


CreateRole 메서드

보고서 서버 데이터베이스에 새 역할을 추가합니다.

네임스페이스:  ReportService2005
어셈블리:  ReportService2005(ReportService2005.dll)

구문

‘선언
<SoapHeaderAttribute("ServerInfoHeaderValue", Direction := SoapHeaderDirection.Out)> _
<SoapHeaderAttribute("BatchHeaderValue")> _
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/CreateRole", RequestNamespace := "https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices",  _
    ResponseNamespace := "https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Sub CreateRole ( _
    Name As String, _
    Description As String, _
    Tasks As Task() _
)
‘사용 방법
Dim instance As ReportingService2005
Dim Name As String
Dim Description As String
Dim Tasks As Task()

instance.CreateRole(Name, Description, _
    Tasks)
[SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)]
[SoapHeaderAttribute("BatchHeaderValue")]
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/CreateRole", RequestNamespace = "https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", 
    ResponseNamespace = "https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public void CreateRole(
    string Name,
    string Description,
    Task[] Tasks
)
[SoapHeaderAttribute(L"ServerInfoHeaderValue", Direction = SoapHeaderDirection::Out)]
[SoapHeaderAttribute(L"BatchHeaderValue")]
[SoapDocumentMethodAttribute(L"https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/CreateRole", RequestNamespace = L"https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", 
    ResponseNamespace = L"https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", 
    Use = SoapBindingUse::Literal, ParameterStyle = SoapParameterStyle::Wrapped)]
public:
void CreateRole(
    String^ Name, 
    String^ Description, 
    array<Task^>^ Tasks
)
[<SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)>]
[<SoapHeaderAttribute("BatchHeaderValue")>]
[<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/CreateRole", RequestNamespace = "https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", 
    ResponseNamespace = "https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)>]
member CreateRole : 
        Name:string * 
        Description:string * 
        Tasks:Task[] -> unit 
public function CreateRole(
    Name : String, 
    Description : String, 
    Tasks : Task[]
)

매개 변수

  • Name
    유형: System. . :: . .String
    새 역할의 이름입니다. 이 매개 변수의 값은 1자에서 260자 사이여야 합니다.
  • Description
    유형: System. . :: . .String
    새 역할의 설명입니다. 이 매개 변수의 값은 1자에서 512자 사이여야 합니다.
  • Tasks
    유형: array<ReportService2005. . :: . .Task> [] () [] []
    역할에 대해 설정할 태스크를 나타내는 Task 개체의 배열입니다. Task 개체의 TaskID 속성만 역할을 만들기 위해 전송됩니다.

주의

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

SOAP Headers

(In) BatchHeaderValue

(Out) ServerInfoHeaderValue

Required Permissions

CreateRoles (System)

The Name and Description parameters are required and should not be set to null Nothing nullptr unit null 참조(Visual Basic에서는 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 태스크 및 권한.

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 ReportingService2005()
      rs.Credentials = System.Net.CredentialCache.DefaultCredentials

      Dim name As String = "Report Browser"
      Dim desc As String = "View folders and reports."
      Dim setTasks(2) As Task
      setTasks(0) = New Task()
      setTasks(1) = New Task()
      setTasks(2) = New Task()

      Try
         Dim returnedTasks As Task() = rs.ListTasks()

         Dim t As Task
         For Each t In  returnedTasks
            If t.Name = "View reports" Then
               setTasks(0) = t

            Else
               If t.Name = "View folders" Then
                  setTasks(1) = t

               Else
                  If t.Name = "View resources" Then
                     setTasks(2) = t
                  End If
               End If
            End If 
         Next t
         rs.CreateRole(name, desc, setTasks)

      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()
   {
      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() );
      }
   }
}