Share via


SPWeb.GetFile method (String)

Recupera o objeto de arquivo localizado na URL especificada.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaração
Public Function GetFile ( _
    strUrl As String _
) As SPFile
'Uso
Dim instance As SPWeb
Dim strUrl As String
Dim returnValue As SPFile

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

Parâmetros

Valor retornado

Type: Microsoft.SharePoint.SPFile
O objeto de arquivo com a URL especificada.

Exceptions

Exception Condition
ArgumentNullException

strUrl é null .

ArgumentException

strUrl é ou vazio.

Comentários

Este método chama o construtor SPFile com this e strUrl.

Examples

O exemplo de código a seguir carrega o arquivo default.aspx .

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

Ver também

Referência

SPWeb class

SPWeb members

GetFile overload

Microsoft.SharePoint namespace