![](/img/trans.png)
[英]Copying Sharepoint “list” from one Sharepoint Server (2007) to Another Server(2010) using c#
[英]C# Copying a file from one server to another with permissions
我编写了一个C#控制台应用程序,它将每天按计划将备份从一台服务器复制到另一台服务器。 如果我已经登录到共享文件夹并且对我的凭据进行了加密,那么这将非常有效,但是,如果我的凭据尚未在源服务器的共享中输入,那么我的代码就会出错。 我需要做的是让我的应用模拟到源共享文件夹的登录名,以便我可以抓取文件并将其移至目标位置。
public static void CopyNewestBackup()
{
string sourcePath = @"\\source";
string targetPath = @"\\destination";
FileInfo newestFile = GetNewestFile();
string sourceFile = Path.Combine(sourcePath, newestFile.Name);
string destFile = Path.Combine(targetPath, newestFile.Name);
Console.Write("Copying " + newestFile.Name + " from " + sourcePath + " to " + destFile);
FileSystem.CopyFile(sourceFile, destFile, UIOption.AllDialogs);
//File.Copy(sourceFile, destFile, true);
}
如何模拟登录到服务器的文件?
此MSDN文章对模拟提供了很好的看法: http : //msdn.microsoft.com/zh-cn/library/chf6fbt4.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.