ContentIterator.ListHasItemsOfContentType method

Determines if a SPList object or a SPFolder object has items of a specified content type.

Namespace:  Microsoft.Office.Server.Utilities
Assembly:  Microsoft.Office.Server (in Microsoft.Office.Server.dll)

Syntax

'Declaration
Public Shared Function ListHasItemsOfContentType ( _
    list As SPList, _
    strContentTypeName As String, _
    folder As SPFolder, _
    fRecursive As Boolean _
) As Boolean
'Usage
Dim list As SPList
Dim strContentTypeName As String
Dim folder As SPFolder
Dim fRecursive As Boolean
Dim returnValue As Boolean

returnValue = ContentIterator.ListHasItemsOfContentType(list, _
    strContentTypeName, folder, fRecursive)
public static bool ListHasItemsOfContentType(
    SPList list,
    string strContentTypeName,
    SPFolder folder,
    bool fRecursive
)

Parameters

  • strContentTypeName
    Type: System.String

    The name of the content type.

  • fRecursive
    Type: System.Boolean

    Whether to include items underneath the folder. If folder is a null reference (Nothing in Visual Basic), this parameter applies to the root folder of the list.

Return value

Type: System.Boolean
true if items exist of the specified content type; otherwise, false.
Returns Boolean.

Remarks

The list cannot be a virtual list.

See also

Reference

ContentIterator class

ContentIterator members

Microsoft.Office.Server.Utilities namespace