使用CopyTo时,PDF文件会自动检出 [英] PDF File automatically checked out when CopyTo used

查看:57
本文介绍了使用CopyTo时,PDF文件会自动检出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 

我有以下代码将文件从一个库复制到另一个库:

I have the following code that copies files from one library to another:


//文件夹 - 一个SPFolder

// url - 一个目标库的URL

// folder - an SPFolder
// url - a destination library's URL

foreach(文件夹中的SPFile文件。文件)

foreach (SPFile file in folder.Files)

推荐答案

嗨Leszek,

Hi Leszek,

在我的测试中,我使用下面的代码将文件从一个文档库复制到同一站点中的另一个文档库。它工作正常,PDF无法签出,请检查。

In my test, I use the code below to copy files from one document library to another in the same site. It working fine, the PDF can't checked out, please check it.

using (SPSite site = new SPSite("http://sp2013/sites/team"))
{
	using (SPWeb web = site.OpenWeb())
	{
		SPFileCollection allFiles = web.GetFolder("DL").Files;
		foreach(SPFile file in allFiles)
		{
			file.CopyTo("http://sp2013/sites/team/DL1/" + file.Name);
		}
	}
}

或者我们也可以使用下面的PowerShell将文件从一个文档库复制到另一个文档库。

Or we can also use the PowerShell below to copy files from one document library to another.

Add-PSSnapIn "Microsoft.SharePoint.PowerShell"

## 
#Set Static Variables 
##


SourceWebURL =" http:// WebAppURL / sites / team1"
SourceWebURL = "http://WebAppURL/sites/team1"


SourceLibraryTitle =" DocumentLibrary1"
SourceLibraryTitle = "DocumentLibrary1"


这篇关于使用CopyTo时,PDF文件会自动检出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆