我正在使用InfoPath 2012,VIsual studio 2012和SharePoint在线。 我在infopath中创建了可以将文件保存到SP库的表单,我发现这篇文章http://www.bizsupportonline.net/blog/2010/upload-document-sharepoint-infopath-form.htm,我在本文中做了所有,但是我无法联系到SPSite,SPWeb, SPFolder。 这是产生错误的代码:
// Add the file to a document library
using (SPSite site = new SPSite("https://contoso.sharepoint.com/Blog/Shared%20Documents"))
{
using (SPWeb web = site.OpenWeb())
{
web.AllowUnsafeUpdates = true;
SPFolder docLib = web.Folders["Documents"];
docLib.Files.Add(fileName, data);
web.AllowUnsafeUpdates = false;
web.Close();
}
site.Close();
}
Mayby有人有什么想法吗? 我已经下载了dll库,但它没有帮助 https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM/
答案 0 :(得分:0)
您无法在SharePoint上的InfoPath表单中运行代码。您不应该在SharePoint Online中完全使用InfoPath。