Compartilhar via


SPFile Members

Include Protected Members
Include Inherited Members

Represents a file in a SharePoint Web site that can be a Web Parts page, an item in a document library, or a file in a folder.

The SPFile type exposes the following members.

Properties

  Name Description
Public property Author Gets the user who uploaded the document to the server or created the document on the server.
Public property BackwardLinks Gets a collection of link objects that represent the backward links of the file.
Public property CharSetName Gets the name of the character set that is used in the file.
Public property CheckedOutBy Obsolete. This property is obsolete. Use LockedByUser instead.
Public property CheckedOutByUser Gets an object that represents the user who has checked out the file.
Public property CheckedOutDate Gets the date and time that the file was checked out.
Public property CheckInComment Gets the comment that is used when a document is checked into a document library.
Public property CheckOutExpires Obsolete. This property is obsolete. Use LockExpires instead.
Public property CheckOutStatus Obsolete. This property is obsolete. Use CheckOutType instead.
Public property CheckOutType Gets a value that indicates how the file is checked out of a document library.
Public property CustomizedPageStatus Gets the customization (also known as "ghost") status of the file object.
Public property DocumentLibrary Gets the parent library of the SPFile.
Public property EffectiveAuditMask Gets the effective audit mask for this object.
Public property EffectiveRawPermissions Gets the effective base permissions for the current user.
Public property ETag Gets an ETag that identifies a version of the file.
Public property EventReceivers Gets the collection of event receiver definitions for the file.
Public property Exists Gets a Boolean value that indicates whether the file exists.
Public property ForwardLinks Gets a collection of link objects that represent the forward links in the file.
Public property GeneratingConverterId Gets the ID of the transformer that is used to create the file, or Guid.Empty if the file is not a child file.
Public property Generator Gets the name of the application that created the .htm or .aspx file.
Public property IconUrl Gets the URL to the icon that is associated with the file.
Public property InDocumentLibrary Gets a Boolean value that indicates whether the file belongs to a document library.
Public property IsConvertedFile Gets a Boolean value that indicates whether the file object was created as part of a document transform.
Public property IsIRMed Gets a Boolean value that indicates whether Information Rights Management is enabled for the file.
Public property IsSharedAccessRequested Gets a Boolean value that indicates whether shared access has been requested for the file.
Public property Item Gets the list item object that corresponds to the file if the file belongs to a document library.
Public property Length Gets the size of the file in bytes, excluding the size of any Web Parts that are used in the file.
Public property LengthByUser Gets a collection of user storage objects that contain information about each user of the Web Parts page, including the user name, user ID, and the number of bytes that the Web Part personalizations consume.
Public property Level Gets the level of publication for the file.
Public property ListItemAllFields Gets the SPListItem object that corresponds to this file, including all its field values, if the file belongs to a document library.
Public property LockedByUser Gets the user who has locked the file.
Public property LockedDate Gets the creation date and time of a file lock.
Public property LockExpires Gets the expiration date and time of a file lock.
Public property LockId Gets the identifier (ID) of the current lock on the file.
Public property LockType Gets a value that describes the type of lock that is on a file.
Public property MajorVersion Gets the major version of the file.
Public property MinorVersion Gets the minor version of the file.
Public property ModifiedBy Gets a user object that represents the user who last modified the file.
Public property Name Gets the name of the file including the extension.
Public property ParentFolder Gets the parent folder of the file.
Public property ProgID Gets a string that identifies the application in which the file was created.
Public property Properties Gets metadata for the file.
Public property RequiresCheckout Gets a Boolean value that specifies if the file is in a document library that requires checkout.
Public property ServerRedirected Gets a Boolean value that indicates whether users who do not have access to view the source file, or who do not have the appropriate client application installed, are redirected to server-side rendering of the file when they click a link to view it.
Public property ServerRelativeUrl Gets the relative URL of the file based on the URL for the server.
Public property SourceFile Gets the parent file object of the file that was created through document transforms.
Public property SourceLeafName Gets the leaf name of the parent document for the file.
Public property SourceUIVersion Gets the version number of the parent document for the file.
Public property TimeCreated Gets a date and time value that indicates when the file was created.
Public property TimeLastModified Gets a date and time value that indicates when the file was last modified.
Public property Title Gets the display name of the file.
Public property TotalLength Gets the size of the file in bytes, including the size of any Web Parts that are used in the file.
Public property UIVersion Gets the version number of the file.
Public property UIVersionLabel Gets the version of the file.
Public property UniqueId Gets the GUID that uniquely identifies the file in the content database.
Public property Url Gets the site-relative URL of the file.
Public property Versions Gets a collection of file version objects that represent the versions of the file.
Public property Web Gets the Web site where the file is located.

Top

Methods

  Name Description
Public method AddProperty Adds an item to the list of metadata for the file.
Public method Approve Approves the file submitted for content approval with the specified comment.
Public method CanOpenFile(Boolean) Indicates whether the current user has permission to view the content of the file, specifying a level of access.
Public method CanOpenFile(Boolean, String) Indicates whether the current user has permission to view the content of the file, specifying a level of access and an output variable to receive an ETag.
Public method CheckIn(String) Checks in the file to a document library with the specified comment.
Public method CheckIn(String, SPCheckinType) Checks in the file to a document library based on the specified comment and type of check in to perform.
Public method CheckOut() Checks the file out of a document library.
Public method CheckOut(Boolean, String) Checks out the file from a document library by specifying whether to check out the file to the local computer and by specifying that the file should not be checked out if it has been modified after a particular date.
Public method CheckOut(SPFile.SPCheckOutType, String) Checks out the file from a document library by specifying the type of checkout and by specifying that the file should not be checked out if it has been modified after a particular date.
Public method Convert Transforms the file using the specified transformer.
Public method ConvertLock Converts an existing lock on the file to a new type of lock.
Public method CopyTo(String) Copies the file to the destination URL but does not overwrite an existing file of the same name.
Public method CopyTo(String, Boolean) Copies the file to the destination URL and optionally overwrites an existing file of the same name.
Public method CreateSharedAccessRequest Requests shared access for the file.
Public method Delete Deletes the file object.
Public method DeleteAllPersonalizations Deletes all personalization information from theWeb Parts page, home page, or wiki page for the user with the specified ID.
Public method DeleteAllPersonalizationsAllUsers Deletes personalization information for all users from the Web Parts page.
Public method DeleteCellStoragePartition Deletes all entries in the specified cell storage partition.
Public method DeleteProperty Deletes an item from the list of metadata for the file.
Public method Deny Denies approval for a file that was submitted for content approval.
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method GetConversionState Returns the transform state of the file to the specified transformer ID.
Public method GetConvertedFile Returns the child file that was created from this file using document transforms and the specified transformer.
Public method GetHashCode (Inherited from Object.)
Public method GetHtmlTranslateCacheItem Returns the contents of the file from the cache for HTML translation, excluding cache items that are older than the date the file was last modified.
Public method GetHtmlTranslateCacheNameFromStsName Returns the name of the main file from the cache for HTML translation.
Public method GetLimitedWebPartManager Returns the Web Part manager that is associated with the Web Parts page.
Public method GetListItem Gets the SPListItem that corresponds to this file, if this file belongs to a document library. Also gets values for specified fields.
Public method GetProperty Gets the value from an item in the list of metadata for the file based on the specified key.
Public method GetType (Inherited from Object.)
Public method GetWebPartCollection Obsolete. Use the GetLimitedWebPartManager method to return an SPLimitedWebPartManager object to manage Web Parts instead. (In Windows SharePoint Services 2.0 the GetWebPartCollection method returned the Web Part collection that is associated with the Web Parts page.)
Public method Lock Creates a lock on the file, preventing other users from modifying it.
Protected method MemberwiseClone (Inherited from Object.)
Public method MoveTo(String) Moves the file to the destination URL but does not overwrite an existing file of the same name.
Public method MoveTo(String, SPMoveOperations) Moves the file to the specified destination URL based on the type of operation that is specified.
Public method MoveTo(String, Boolean) Moves the file to the destination URL and optionally overwrites an existing file of the same name.
Public method MoveTo(String, SPMoveOperations, Boolean) Moves the file to the specified destination URL.
Public method OpenBinary() Opens the file in binary format.
Public method OpenBinary(SPOpenBinaryOptions) Opens the specified file as a byte array and specifies options that control how the file opens.
Public method OpenBinaryStream() Opens the file as a stream.
Public method OpenBinaryStream(SPOpenBinaryOptions) Opens the specified file as a stream and specifies options that control how the file opens.
Public method OpenBinaryStream(SPOpenBinaryOptions, String, String) Opens the file as a stream based on the specified options.
Public method OpenFileFormatMetaInfoStream
Public method Publish Submits the file for content approval with the specified comment.
Public method Recycle Sends the file to the recycle bin.
Public method RefreshLock Renews an existing lock on the file.
Public method ReleaseLock Releases an existing lock that is specified by its identifier (ID).
Public method RemoveSharedAccessRequest
Public method ReplaceLink Replaces all instances in the file of a specified link with a new link.
Public method RevertContentStream Returns the file to its original state so that its logic becomes cached in memory (or "ghosted") rather than stored in the database.
Public method SaveBinary([]) Saves the file in binary format based on the specified byte array.
Public method SaveBinary(Stream) Saves the file in binary format based on the specified stream.
Public method SaveBinary([], Boolean) Saves the file in binary format based on the specified byte array and a Boolean value that specifies whether to check required fields.
Public method SaveBinary(Stream, SPFileSaveBinaryParameters) Saves the file in binary format based on a stream that contains a file and an SPFileSaveBinaryParameters object with additional parameters.
Public method SaveBinary(Stream, Boolean) Saves the file in binary format based on the specified stream and a Boolean value that specifies whether to check required fields.
Public method SaveBinary(Stream, Boolean, Boolean, String, String, Stream, String) Saves the file and file format metadata based on the specified streams, strings, and optional ETag value.
Public method SaveBinary(Stream, Boolean, Boolean, String, String, Stream, Boolean, String) Saves the file and file format metadata based on the specified streams, strings, Boolean value, and optional ETag value.
Public method SaveFileFormatMetaInfoStream Saves the stream of metadata that contains file format information for the specified file to the database.
Public method ScheduleEnd Sets the date on which a file will be removed from public views of a document library.
Public method ScheduleStart(DateTime) Schedules the automatic approval of a document in a moderated library at the specified date and time.
Public method ScheduleStart(DateTime, Boolean) Schedules the automatic approval of a document in a moderated library at the specified date and time, and optionally leaves the moderation status of the item unchanged.
Public method ScheduleStart(DateTime, String) Schedules automatic approval of a document in a moderated library at the specified date and time with the specified explanation for the approval.
Public method ScheduleStart(DateTime, Boolean, String) Schedules the automatic approval of a document in a moderated library at the specified date and time, with the specified approval comment, and optionally changes the moderation status of the list item.
Public method SendToOfficialFile(String) Sends the file to a records repository.
Public method SendToOfficialFile(String, String) Sends the file to a records repository and specifies the name of a record routing type.
Public method SendToOfficialFile(String, SPOfficialFileHost, String, SPOfficialFileSubmissionMode, String) Sends file to a specific URL.
Public method SendToOfficialFile(String, SPOfficialFileHost, [], String, SPOfficialFileSubmissionMode, String) Sends file to a specific URL.
Public methodStatic member SendToOfficialFile(SPWeb, Uri, [], [], String, Uri, String, SPOfficialFileSubmissionMode, SPFile.CustomFileSubmissionPostProcessing, String) Sends file to a destination router.
Public method SetHtmlTranslateCacheItem Saves the contents of the file into a cache for HTML translation.
Public method SetProperty Sets the value of an item in the list of metadata for the file.
Public methodStatic member StorageManagementWebPartPageInformation Obsolete. Returns information about storage management for the Web Parts page.
Public method TakeOffline Takes the most current approved or major version of the file offline.
Public method ToString Returns the URL for the file based on the site or subsite URL. (Overrides Object.ToString().)
Public method UndoCheckOut Undoes the file checkout.
Public method UnPublish Removes the file with the specified comment from content approval.
Public method Update Updates the database with changes that are made to the file.

Top

See Also

Reference

SPFile Class

Microsoft.SharePoint Namespace