SPFolder.CopyTo method
將資料夾和其內容複製到新的資料夾,在指定的 URL。
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
Public Sub CopyTo ( _
strNewUrl As String _
)
'用途
Dim instance As SPFolder
Dim strNewUrl As String
instance.CopyTo(strNewUrl)
public void CopyTo(
string strNewUrl
)
參數
strNewUrl
Type: System.String字串,指定新資料夾的 URL。
備註
CopyTo方法僅適用於單一站台的內容。
Examples
下列程式碼範例會將指定的子資料夾從 [共用文件的文件庫複製到新的子資料夾,在另一個文件庫。
Dim site As SPWeb = SPControl.GetContextWeb(Context)
If site.GetFolder("Shared Documents/Source_Subfolder_Name").Exists Then
Dim copyFolder As SPFolder = site.GetFolder
("Shared Documents/Source_Subfolder_Name")
copyFolder.CopyTo("DocLib_Name/Destination_Subfolder_Name")
End If
SPWeb oWebsite = SPContext.Current.Web;
if (oWebsite.GetFolder("Shared Documents/Source_Subfolder_Name").Exists)
{
SPFolder oFolderSrc = oWebsite.GetFolder("Shared Documents/Source_Subfolder_Name");
oFolderSrc.CopyTo("DocLib_Name/Destination_Subfolder_Name");
}