次の方法で共有


ITokenDataExtension.SetUserToken メソッド

SharePoint ユーザー トークンを設定します。 このメソッドはレポート サーバーで使用され、SharePoint ユーザー トークンをデータ処理拡張機能に送信します。

名前空間:  Microsoft.ReportingServices.DataProcessing
アセンブリ:   Microsoft.ReportingServices.SharePoint.UI.WebParts (Microsoft.ReportingServices.SharePoint.UI.WebParts.dll)
  Microsoft.ReportingServices.Interfaces (Microsoft.ReportingServices.Interfaces.dll)

構文

'宣言
Sub SetUserToken ( _
    UserToken As Byte() _
)
'使用
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[]
)

パラメーター

  • UserToken
    型: array<System.Byte[]
    トークン データを表すバイト配列。

説明

ユーザー トークンは、ほとんどの場合、現在ログオンしているユーザーです。 サブスクリプション配信の場合は、サブスクリプション作成者のトークンです。 レポート サーバーがユーザー トークンを取得できない場合、自動実行用アカウントの SharePoint トークンが作成されます。 詳細については、「自動実行アカウントの構成」を参照してください。

使用例

次の例は、SharePoint ユーザー トークンのある SharePoint データ ソースに接続できる IDbConnection インターフェイスである、接続クラス実装の作成方法を示しています。

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

関連項目

参照

ITokenDataExtension インターフェイス

Microsoft.ReportingServices.DataProcessing 名前空間