以编程方式移动并签入本地文件到Sharepoint C#

下面是我正在使用代码将本地文件从D:移动到共享点库的代码。 我能够移动文件,但它不检查文件到共享点。 我不确定如何检查此文件。有没有人有类似的问题与SharePoint的? 谢谢。

这里是我的代码,我没有使用确切的目标和源URL,所以忽略。 它编译和运行良好,它可以用来移动一个文件,让我们说D:到我的文档,它只是不检查文件到共享点。

此外,我正在检查一个Excel表格,根据每天更新的数据进行一些计算。 计算是通过一个macros来完成的。 是否有可能写一个macros自动上传到共享点库和检查? 如果是的话,我可以添加这个macros已经到位,而不是使用C#。 谢谢。

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; using Microsoft.SharePoint.WorkflowServices; using Microsoft.SharePoint.Client; using Microsoft.SharePoint; using System.Net; namespace defectUpload { class Program { static void Main(string[] args) { string fileName = "WS2016.xlsm"; string sourcePath = @ source path ""; string targetPath = @ destination path "" ; // Use Path class to manipulate file and directory paths. string sourceFile = System.IO.Path.Combine(sourcePath, fileName); string destFile = System.IO.Path.Combine(targetPath, fileName); // To copy a folder's contents to a new location: // Create a new target folder, if necessary. if (!System.IO.Directory.Exists(targetPath)) { System.IO.Directory.CreateDirectory(targetPath); } System.IO.File.Move(sourceFile, destFile); } } } 

这已经解决了这个posthttps://sharepoint.stackexchange.com/questions/133197/excel-vba-code-to-upload-document-into-sharepoint-online-2013

 Dim SharepointAddress As String Dim LocalAddress As String Dim objNet As Object Dim FS As Object ' Where you will enter Sharepoint location path SharepointAddress = "\\sharepoint path to document library" & "\" ' Where you will enter the file path, ex: Excel file LocalAddress = "your file path" Set objNet = CreateObject("WScript.Network") Set FS = CreateObject("Scripting.FileSystemObject") If FS.FileExists(LocalAddress) Then FS.CopyFile LocalAddress, SharepointAddress End If Set objNet = Nothing Set FS = Nothing 

此外,关于此主题的MSDN上的一篇很好的文章将Microsoft Windows SharePoint Services与Microsoft Office System配合使用 。

当谷歌例如“vba上传到分享点”也有很多样本…