SPWeb.GetFile 方法 (String)

Retrieves the file object located at the specified URL.

命名空间:  Microsoft.SharePoint
程序集:  Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)

语法

声明
Public Function GetFile ( _
    strUrl As String _
) As SPFile
用法
Dim instance As SPWeb
Dim strUrl As String
Dim returnValue As SPFile

returnValue = instance.GetFile(strUrl)
public SPFile GetFile(
    string strUrl
)

参数

返回值

类型:Microsoft.SharePoint.SPFile
The file object with the specified URL.

异常

异常 条件
ArgumentNullException

strUrl is null .

ArgumentException

strUrl is or empty.

备注

This method calls the SPFile constructor with this and strUrl.

示例

The following code example loads the default.aspx file.

SPFile file = web.GetFile(“default.aspx”);
    if(file.Exists) // here, this condition will return always false
    {
      // …
    }

另请参阅

引用

SPWeb 类

SPWeb 成员

GetFile 重载

Microsoft.SharePoint 命名空间