SPFile.CheckOut method
檢查出文件庫的檔案。
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
Public Sub CheckOut
'用途
Dim instance As SPFile
instance.CheckOut()
public void CheckOut()
Exceptions
Exception | Condition |
---|---|
SPException | 簽出檔案時,就會發生錯誤。 |
備註
這個方法會呼叫CheckOut(SPFile.SPCheckOutType, String)Online與 null 。
Examples
下列程式碼範例示範如何簽出的所有檔案共享文件] 資料夾中指定的子網站。
Dim site As SPSite = SPContext.Current.Site
Dim targetWeb As SPWeb = site.AllWebs("Site_Name/Subsite_Name")
Dim docLibFolder As SPFolder = targetWeb.Folders("Shared Documents")
Dim docLibFiles As SPFileCollection = docLibFolder.Files
Dim i As Integer
For i = 0 To docLibFiles.Count - 1
docLibFiles(i).CheckOut()
Next i
SPSite oSiteCollection = SPContext.Current.Site;
SPWeb oWebsite = oSiteCollection.AllWebs["Site_Name/Subsite_Name"];
SPFolder oFolder = oWebsite.Folders["Shared Documents"];
SPFileCollection collFiles = oFolder.Files;
for (int intIndex=0; intIndex<collFiles.Count; intIndex++)
{
collFiles[intIndex].CheckOut();
}
oWebsite.Dispose();
注意事項 |
---|
某些物件實作IDisposable介面,並且您必須避免之後不再需要保留這些物件在記憶體中。良好的程式碼撰寫方式的相關資訊,請參閱Disposing Objects。 |