Metodo CreateRole

Aggiunge un nuovo ruolo al database del server di report. Questo metodo può essere applicato solo in modalità nativa.

Spazio dei nomi  ReportService2010
Assembly:  ReportService2010 (in ReportService2010.dll)

Sintassi

'Dichiarazione
<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() _
)
'Utilizzo
Dim instance As ReportingService2010
Dim Name As String
Dim Description As String
Dim TaskIDs As String()

instance.CreateRole(Name, Description, _
    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")]
public void CreateRole(
    string Name,
    string Description,
    string[] TaskIDs
)
[SoapDocumentMethodAttribute(L"https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateRole", RequestNamespace = L"https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    ResponseNamespace = L"https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    Use = SoapBindingUse::Literal, ParameterStyle = SoapParameterStyle::Wrapped)]
[SoapHeaderAttribute(L"ServerInfoHeaderValue", Direction = SoapHeaderDirection::Out)]
[SoapHeaderAttribute(L"TrustedUserHeaderValue")]
public:
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 
public function CreateRole(
    Name : String, 
    Description : String, 
    TaskIDs : String[]
)

Parametri

  • Name
    Tipo: System. . :: . .String
    Nome del nuovo ruolo. Il valore di questo parametro deve essere composto da un minimo di 1 a un massimo di 260 caratteri.
  • Description
    Tipo: System. . :: . .String
    Descrizione del nuovo ruolo. Il valore di questo parametro deve essere composto da un minimo di 1 a un massimo di 512 caratteri.
  • TaskIDs
    Tipo: array<System. . :: . .String> [] () [] []
    Matrice di ID attività che rappresentano le attività da impostare per il ruolo.

Osservazioni

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 nullptr unit riferimento Null (Nothing in Visual Basic). (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 Attività e autorizzazioni.

Esempi

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