我正在尝试将文档从本地驱动器上传到SharePoint。我的代码正在正确调试,但该文件未在SharePoint中上传。
我收到此错误消息:
无法在请求的目的地创建项目。验证该文件夹是否存在以及您是否有权在其中进行编辑。
代码:
public void scantosharepoint()
{
String source = "D:\\sharepoint.pdf";
String[] destination = { "https://ms-shre2010/Shared Documents/adithyan_folder/" };
ScanDocumentRef.FieldInformation fieldinfo = new ScanDocumentRef.FieldInformation();
fieldinfo.DisplayName = "learn about sharepoint";
fieldinfo.Type = ScanDocumentRef.FieldType.Text;
fieldinfo.Value = "SharePoint";
ScanDocumentRef.FieldInformation[] fieldinfoarray = { fieldinfo };
ScanDocumentRef.CopyResult copyres = new ScanDocumentRef.CopyResult();
ScanDocumentRef.CopyResult[] copyresarray = { copyres };
certificat();
FileStream stream = new FileStream(source, FileMode.Open, FileAccess.Read);
byte[] fileContents = new byte[stream.Length];
byte[] r = new Byte[stream.Length];
int ia = stream.Read(fileContents, 0, Convert.ToInt32(stream.Length));
stream.Close();
//String data = Convert.ToBase64String(bytearray);
//uint getuint = scanDoc.GetItem(source, out fieldinfoarray, out bytearray);
uint scanresult = scanDoc.CopyIntoItems(source, destination, fieldinfoarray, fileContents, out copyresarray);
}