SPFile.CheckOut 方法
签出文档库文件。
命名空间: Microsoft.SharePoint
程序集: Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)
语法
声明
Public Sub CheckOut
用法
Dim instance As SPFile
instance.CheckOut()
public void CheckOut()
异常
异常 | 条件 |
---|---|
SPException | 签出文件时,将出现错误。 |
备注
此方法调用CheckOut(SPFile.SPCheckOutType, String)与Online和 null 。
示例
下面的代码示例演示如何签出的所有文件在共享文档文件夹中指定的子网站。
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。