Search This Blog

2009-04-30

SPFolder And SPFile

SPFolder
SPFolder class represents a folder in Sharepoint site.

Public Methods :-
The following table shows the public methods of the SPFolder class and a brief description of each.
CopyTo
Copies the folder and its contents into a new folder at the specified URL.
MoveTo
Moves the folder to the specified URL.
ToString
Returns the relative URL of the folder based on the parent Web site.

Public Properties :-
The following table shows the public properties of the SPFolder class, the data type of each property, and a brief description of each.
ContainingDocumentLibrary
System.Guid
Gets the document library that contains the folder.
Exists
Boolean
Gets a Boolean value that indicates whether the folder exists.
Files
Microsoft.SharePoint.SPFileCollection
Gets the collection of all files contained in the folder.
Name
String
Gets the name of the folder.
ParentFolder
Microsoft.SharePoint.SPFolder
Gets the parent folder of the folder.
ParentWeb
Microsoft.SharePoint.SPWeb
Gets the parent Web site of the folder.
ServerRelativeUrl
String
Gets the server-relative URL of the folder.
SubFolders
Microsoft.SharePoint.SPFolderCollection
Gets the collection of subfolders contained within the folder.
Url
String
Gets the site-relative URL of the folder.

SPFile :-
The SPFile class represents a file in a SharePoint Web site that can be a Web Part Page, an item in a document library, or a file in a folder.
Public Methods
The following table shows the public methods of the SPFile class and a brief description of each.

CheckIn
Checks in the file to a document library.
CheckOut
Checks out the file from a document library.
CopyTo(String)
Copies the file to the destination URL but does not overwrite an existing file of the same name.
CopyTo(String, Boolean)
Copies the file to the destination URL but overwrites an existing file of the same name only if bOverwrite is true.
MoveTo(String)
Moves the file to the destination URL but does not overwrite an existing file of the same name.
MoveTo(String, Boolean)
Moves the file to the destination URL but overwrites an existing file of the same name only if bOverwrite is true.
OpenBinary
Opens the file in binary format.
SaveBinary
Saves the file in binary format.
UndoCheckOut
Undoes the file check-out.
Public Properties
The following table shows the public properties of the SPFile class, the data type of each

property, and a brief description of each.
CheckedOutBy
Microsoft.SharePoint.SPUser
Gets the user who has checked out the file.

CheckedOutDate
System.DateTime
Gets the date and time that the file was checked out.

CheckInComment
String
Gets the comment used when a document is checked into a document library.

Exists
Boolean
Gets a Boolean value that indicates whether the file exists.

InDocumentLibrary
Boolean
Gets a Boolean value that indicates whether the file belongs to a document library.

Item
Microsoft.SharePoint.SPListItem
Gets the list item object that corresponds to the file if the file belongs to a document library.

Length
Int64
Gets the size of the file in bytes, including the size of any supporting files, but excluding Web Parts.

Name
String
Gets the internal name of the file.

ParentFolder
Microsoft.SharePoint.SPFolder
Gets the parent folder of the file.

ServerRelativeUrl
String
Gets the relative URL of the file based on the URL for the server.

TimeCreated
System.DateTime
Gets a date and time value indicating when the file was created.

TimeLastModified
System.DateTime
Gets a date and time value indicating when the file was last modified.

Title
String
Gets the display name of the file.

Url
String
Gets the site-relative URL of the file.

Versions
Microsoft.SharePoint.SPFileVersionCollection
Gets a collection of file version objects representing the versions of the file.

No comments: