今天发现在slide文档库中使用代码保存数据的时候,出现了一个错误:
错误信息为:"This file is not a valid presentation file or contains multiple slides. Only single slides can be stored in a Slide Library. To publish a file with multiple slides, click Upload on the Slide Library, and then click Publish Slides."
保存的代码很简单:
file = folder.Files.Add(fileName, data, true);
folder.Update();
这是因为slide文档库比较特殊,只能保存特定类型的文件
经过尝试,发现可以保存j二进制格式的文件,所以可以把数据保存为二进制格式就可以解决这个问题了:
file = folder.Files.Add(fileName, SPTemplateFileType.FormPage);
file.SaveBinary(data);