Question : Caml Query on Item versiion History

I am gettig the following error from the code below:

"The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Too many parameters were provided in this RPC request. The maximum is 2100."

The error occurs as soon as it hits the foreach loop and fails when it gets the item versions information.

I would like to fix this issue using a Caml query or some how using Linq queries.
Can someone show me how to create a caml query or Linq query from the code below.

Or are there any other suggestions besides a hot fix from Microsoft. A hot fix can not be installed on the enviroment this code will be used on.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
var sb = new StringBuilder();

foreach (SPListItemVersion itemVersion in  
         item.Web.Lists[item.ParentList.ID]
         .Items[item.UniqueId].Versions)
         {
          SPFieldMultiLineText field =
          itemVersion .Fields[key] 
          as SPFieldMultiLineText;

        if (field != null)
         {
           string comment = field.GetFieldValueAsText
           (itemVersion .Fields[key]);
                                      
            if (comment != null &&
                comment.Trim() != string.Empty)
              {
                sb.Append("\n\r");
                sb.Append(itemVersion .CreatedBy.User.Name)
                .Append("(");
                sb.Append(itemVersion .Created.ToString
               ("MM/dd/yyyy hh:mm tt"));
               sb.Append(")");
               sb.Append(comment);
               row[key)] = sb.ToString();
            }
          }
         }
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
var sb = new StringBuilder();

foreach (SPListItemVersion itemVersion in  
         item.Web.Lists[item.ParentList.ID]
         .Items[item.UniqueId].Versions)
         {
          SPFieldMultiLineText field =
          itemVersion .Fields[key] 
          as SPFieldMultiLineText;

        if (field != null)
         {
           string comment = field.GetFieldValueAsText
           (itemVersion .Fields[key]);
                                      
            if (comment != null &&
                comment.Trim() != string.Empty)
              {
                sb.Append("\n\r");
                sb.Append(itemVersion .CreatedBy.User.Name)
                .Append("(");
                sb.Append(itemVersion .Created.ToString
               ("MM/dd/yyyy hh:mm tt"));
               sb.Append(")");
               sb.Append(comment);
               row[key)] = sb.ToString();
            }
          }
         }

Answer : Caml Query on Item versiion History

Hi techExtreme,

No the answer was I have to install service pack two on all boxes, which is a bad answer on SharePoints end.
Random Solutions  
 
programming4us programming4us