File.CopyTo 方法
將檔案複製到目的地 URL 中。如果 bOverwrite 為 true,伺服器必須覆寫現有相同名稱的檔案。
命名空間: Microsoft.SharePoint.Client
組件: Microsoft.SharePoint.Client.Silverlight (在 Microsoft.SharePoint.Client.Silverlight.dll 中); Microsoft.SharePoint.Client.Phone (在 Microsoft.SharePoint.Client.Phone.dll 中) Microsoft.SharePoint.Client (在 Microsoft.SharePoint.Client.dll 中)
語法
'宣告
Public Sub CopyTo ( _
strNewUrl As String, _
bOverWrite As Boolean _
)
'用途
Dim instance As File
Dim strNewUrl As String
Dim bOverWrite As Boolean
instance.CopyTo(strNewUrl, bOverWrite)
public void CopyTo(
string strNewUrl,
bool bOverWrite
)
參數
strNewUrl
類型:System.String指定的目的地 URL。
它不能null 參考 (未執行任何動作 於 Visual Basic 中)。它必須相對或絕對表單的 URL。
bOverWrite
類型:System.Boolean指定是否要覆寫具有相同名稱的檔案。
例外狀況
例外狀況 | 條件 |
---|---|
[Microsoft.SharePoint.SPDuplicateValuesFoundException] | 無法更新清單項目,因為找不到清單中的一或多個欄位的重複的值。錯誤碼:-2130575169。 |
[Microsoft.SharePoint.SPFileCheckOutException] | 未取出檔案。錯誤碼 ︰-2147024738。 |
[Microsoft.SharePoint.SPFileCheckOutException] | 目前的使用者以外的使用者已取出檔案。錯誤碼 ︰-2130575306。 |
[Microsoft.SharePoint.SPFileLockException] | 未鎖定檔案。錯誤碼 ︰-2147024729。 |
[Microsoft.SharePoint.SPFileLockException] | 作業逾時。錯誤碼 ︰-2147023436。 |
[Microsoft.SharePoint.SPFileLockException] | 目前的使用者以外的使用者會有共用的鎖定檔案。錯誤碼 ︰-2147018894。 |
[Microsoft.SharePoint.SPFileLockException] | 目前的使用者以外的使用者會有獨佔鎖定檔案。錯誤碼 ︰-2147018887。 |
[Microsoft.SharePoint.SPInvalidLookupValuesException] | 無法更新清單項目,因為找不到一或多個欄位清單中的無效的查閱值。錯誤碼 ︰-2130575159。 |
[System.ArgumentException] | URL 必須參照至目前的網站集合中的位置。錯誤碼 ︰-2147024809。 |
[System.UnauthorizedAccessException] | 目前的使用者會有足夠的權限。錯誤碼 ︰-2147024891。 |