Metoda ITokenDataExtension.SetUserToken
Ustawia tokenu użytkownika programu SharePoint.Ta metoda jest używana przez serwer raportów wysłać tokenu użytkownika programu SharePoint do rozszerzenie przetwarzania danych.
Przestrzeń nazw: Microsoft.ReportingServices.DataProcessing
Zestawy: Microsoft.ReportingServices.Interfaces (w Microsoft.ReportingServices.Interfaces.dll)
Microsoft.ReportingServices.SharePoint.UI.WebParts (w Microsoft.ReportingServices.SharePoint.UI.WebParts.dll)
Składnia
'Deklaracja
Sub SetUserToken ( _
UserToken As Byte() _
)
'Użycie
Dim instance As ITokenDataExtension
Dim UserToken As Byte()
instance.SetUserToken(UserToken)
void SetUserToken(
byte[] UserToken
)
void SetUserToken(
array<unsigned char>^ UserToken
)
abstract SetUserToken :
UserToken:byte[] -> unit
function SetUserToken(
UserToken : byte[]
)
Parametry
- UserToken
Typ: array<System.Byte[]
Tablica bajt reprezentująca dane tokenu.
Uwagi
Token użytkownika jest prawie zawsze zalogowanego użytkownika.W przypadek dostawy subskrypcja jest token twórca subskrypcja.Jeśli serwer raportów nie można uzyskać tokenu użytkownika, tworzy token SharePoint konta wykonanie instalacji nienadzorowanej.Aby uzyskać więcej informacji, zobacz temat Konfigurowanie konta wykonanie instalacji nienadzorowanej.
Przykłady
Poniższy kod ilustruje sposób tworzenia Implementacja klasy połączenia IDbConnection interfejs, który można połączyć się z danych programu SharePoint źródło z tokenu użytkownika programu 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
Zobacz także