SharePoint Online 找不到 SPSite、SPWeb、SPFolder

SharePoint online can't find SPSite, SPWeb, SPFolder

我正在使用 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();
                }

也许有人有什么想法? 我已经下载了dll库,但没有帮助 https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM/

您不能 运行 在 SharePoint Online 的 InfoPath 表单中隐藏代码。您根本不应在 SharePoint Online 中使用 InfoPath。

检查这个:https://sharepoint.stackexchange.com/questions/56617/can-i-use-infopath-code-behind-in-sharepoint-online