ダイレクトアクセスキーを使用してデータを更新する場合のC# .NETの使用例を示します。
更新するデータ
| <course>
  <id>0001</id>
  <name>Business negotiation</name>
  <instructor>
    <first-name>Max</first-name>
    <last-name>cameron</last-name>
  </instructor>
  <capacity>40</capacity>
  <current-auditors>30</current-auditors>
</course> | 
定義したダイレクトアクセスキー
key /course/id/text()
APIの使用例
以下にC# .NETを使用したプログラミング例を示します。
| using System;
using Fujitsu.Shunsaku;
class SampleDirectAccessUpdate {
  static public void Main( string[] args ) {
    ShunService service = null;
    try {
      // ShunService の作成
      service = new ShunService();
      // ホスト名 ポート番号を指定して Shunsaku に接続
      service.Host = "DirSvr1";
      service.Port = 23101;
      service.ShunsakuFile = "shunsakuFile1";
      service.Connect();
      // 更新用の ShunKeyRequirement オブジェクトを作成
      ShunKeyRequirement keyReq = new ShunKeyRequirement();
      keyReq.KeyName = "key";
      // 更新対象のキーを追加
      keyReq.Records.Add( new ShunRecord() );
      keyReq.Records[0].Key = "0001";
      // 更新データを設定
      keyReq.Records[0].Data = String.Concat(
        "<course>",
        "  <id>0001</id>",
        "  <name>Business negotiation</name>",
        "  <instructor>",
        "    <first-name>Max</first-name>",
        "    <last-name>cameron</last-name>",
        "  </instructor>",
        "  <capacity>40</capacity>",
        "  <current-auditors>31</current-auditors>",
        "</course>" );
      //コース情報の更新
      service.UpdateByKey( keyReq );
      Console.WriteLine( "更新終了" );
      // Shunsaku から切断
      service.Disconnect();
    }
    catch ( ShunContinuousException e ) {
      // ShunContinuousExceptionが発生した場合の処理を記述
      try {
        if( service != null && service.State == ShunConnectionState.Open ) {
          service.Disconnect();
        }
      }
      catch ( ShunException ex ) {
        Console.WriteLine("エラーメッセージ : {0}", ex.Message );
      }
      Console.WriteLine("エラーメッセージ : {0}", e.Message );
    }
    catch ( ShunConnectionTerminatedException e ) {
      // ShunConnectionTerminatedExceptionが発生した場合の処理を記述
      Console.WriteLine("エラーメッセージ : {0}", e.Message );
    }
  }
} | 
実行結果
更新終了