I have web service that point to sharepoint 2013 Office 365. I use the client object model. I am trying to update the xml file which stores 4 attachments in it. When I do this when I have large binary data in the xml file I get the following error :
Message
The request message is too big. The server does not allow messages larger than 2097152 bytes.
I realize I am probably going to have to seperate the attachments from the xml file but currently my infopath form stores them there. Is there a way I can increase the request length or maybe chunk up saving or something. I really just modifying one node and it won't work unless I update the xml. Thanks . Code Below.
My Code:
ListItem docReq = GetDocRequestLight(docRequestID, businessID);
string fPath = (string)docReq["FileRef"];
using (FileInformation fInfo = Microsoft.SharePoint.Client.File.OpenBinaryDirect(ctx, fPath))
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(fInfo.Stream);
XmlNamespaceManager xmlNameSpaceMgr = new XmlNamespaceManager(xmlDoc.NameTable);
xmlNameSpaceMgr.AddNamespace("my", DocReqXmlNameSpace);
// Get Parent Node
XmlNode node = xmlDoc.SelectSingleNode(GetXPathFromItemKey(velmaKey), xmlNameSpaceMgr);
DateTime outDate;
bool outBool;
if (DateTime.TryParse(newValue, out outDate))
node.InnerText = outDate.ToString("yyyy-MM-dd");
if (Boolean.TryParse(newValue, out outBool))
node.InnerText = newValue;
// Update Statuses
XmlNode statusIDNode = xmlDoc.SelectSingleNode(DocReqStatusIDFieldXPath, xmlNameSpaceMgr);
statusIDNode.InnerText = updatedStatus.ID.ToString();
XmlNode statusNode = xmlDoc.SelectSingleNode(DocReqStatusFieldXPath, xmlNameSpaceMgr);
statusNode.InnerText = updatedStatus.Name.ToString();
// Save File
docReq.File.SaveBinary(new FileSaveBinaryInformation()
{
Content = Encoding.UTF8.GetBytes(xmlDoc.OuterXml),
});
ctx.ExecuteQuery();