我有一个指向SharePoint 2013 Office 365的Web服务,使用客户端对象模型。我试图更新存储在其中的四个附件的XML文件。当我在XML文件中有大的二进制数据时进行此操作,会出现以下错误:
信息:
请求消息太大。服务器不允许大于2097152字节的消息。
我意识到我可能需要将附件从XML文件中分离出来,但目前我的InfoPath表单将它们存储在那里。有没有办法可以增加请求长度或者分块保存之类的操作?我只是想修改一个节点,但是如果我不更新XML文件,它就无法正常工作。谢谢。以下是我的代码:
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();