Link to home
Start Free TrialLog in
Avatar of iDOTNETCoder
iDOTNETCoder

asked on

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.
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();
            }
          }
         }

Open in new window

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();
            }
          }
         }

Open in new window

Avatar of techExtreme
techExtreme
Flag of India image

row[key)]   is this correct? where are you running this code? in sps 2010 event handler ? or moss 2007
ASKER CERTIFIED SOLUTION
Avatar of iDOTNETCoder
iDOTNETCoder

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial