Partilhar via


SPListItem.FileSystemObjectType Property

Gets or sets the file system object type for the item.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
<ClientCallablePropertyAttribute(SetProperty := False)> _
<ClientCallableConstraintAttribute(FixedId := "filetype", Type := ClientCallableConstraintType.Custom,  _
    Value := "It MUST be either FileSystemObjectType.File or FileSystemObjectType.Folder")> _
Public Property FileSystemObjectType As SPFileSystemObjectType
    Get
    Set
'Usage
Dim instance As SPListItem
Dim value As SPFileSystemObjectType

value = instance.FileSystemObjectType

instance.FileSystemObjectType = value
[ClientCallablePropertyAttribute(SetProperty = false)]
[ClientCallableConstraintAttribute(FixedId = "filetype", Type = ClientCallableConstraintType.Custom, Value = "It MUST be either FileSystemObjectType.File or FileSystemObjectType.Folder")]
public SPFileSystemObjectType FileSystemObjectType { get; set; }

Property Value

Type: Microsoft.SharePoint.SPFileSystemObjectType
An enumeration value that indicates the type: file, folder, Web, or invalid.

Exceptions

Exception Condition
ArgumentException

You can set this property only for a new list item. The current item is not new; it has already been persisted in the database.

Remarks

It is only valid to set this property on new SPListItem objects—that is, before the Update method is called for the first time and the item is persisted in the database.

See Also

Reference

SPListItem Class

SPListItem Members

Microsoft.SharePoint Namespace