Lingua

ITokenDataExtension.SetUserToken(Byte[]) Metodo

Definizione

Imposta il token utente di SharePoint. Questo metodo viene utilizzato dal server di report per inviare il token utente SharePoint all'estensione per l'elaborazione dati.

public:
 void SetUserToken(cli::array <System::Byte> ^ UserToken);
public void SetUserToken(byte[] UserToken);
abstract member SetUserToken : byte[] -> unit
Public Sub SetUserToken (UserToken As Byte())

Parametri

UserToken
Byte[]

Un array di byte questo rappresenta i dati del token.

Esempio

Il seguente codice dimostra come creare una classe di connessione per implementare un'interfaccia IDbConnection che possa connettersi a una sorgente dati SharePoint con un token utente SharePoint.

using System.Microsoft.ReportingServices.DataProcessing;  
using Microsoft.SharePoint;  

public class SPConnection : ITokenDataExtension, IDbConnection  
{  
   private SPUserToken token = null;  
   private SPSite site = null;  
   ...  
   // Implement the SetUserToken method in ITokenDataExtension  
   public void SetUserToken(byte[] UserToken)  
   {  
      token = new SPUserToken(UserToken);  
   }  

   // Implement the Open method in IDbConnection  
   public void Open()  
   {  
      // Connect to a site collection using the token.  
      // To use a variable for site URL, implement the   
      // IDbConnection.ConnectionString property accordingly.  
      site = new SPSite(  
            "http://contoso/sites/salesdata/thisyear/default.aspx",   
            token);  
      ...  
   }  

   //Implement the other methods and properties in IDbConnection  
   ...  
}  
Imports System.Microsoft.ReportingServices.DataProcessing  
Imports Microsoft.SharePoint  

Public Class SPConnection  
   Implements ITokenDataExtension  
   Implements IDbConnection  
   Private token As SPUserToken = Nothing  
   Private site As SPSite = Nothing  
   ...   ' Implement the SetUserToken method in ITokenDataExtension  
   Public Sub SetUserToken(ByVal UserToken As Byte())  
      token = New SPUserToken(UserToken)  
   End Sub  

   ' Implement the Open method in IDbConnection  
   Public Sub Open()  
      ' Connect to a site collection using the token.  
      ' To use a variable for site URL, implement the   
      ' IDbConnection.ConnectionString property accordingly.  
      site = New SPSite(_  
            "http://contoso/sites/salesdata/thisyear/default.aspx",_  
            token)  
   End Sub  

   'Implement the other methods and properties in IDbConnection  
   ...  
End Class  

Commenti

Il token utente è quasi sempre l'utente effettuato l'accesso. Nel caso della consegna dell'abbonamento, questo è il token del creatore dell'abbonamento. Se il server di report non riesce a ottenere un token utente, crea un token SharePoint dell'account di esecuzione non supervisionato. Per ulteriori informazioni, vedi Configura l'Account di Esecuzione Non Supervisionata (SSRS Gestione configurazione).

Si applica a