共用方式為


IUpdateServer.GetUpdates Method (ApprovedStates, DateTime, DateTime, UpdateCategoryCollection, UpdateClassificationCollection)

 

Applies To: Windows Server Update Services

Gets a collection of updates based on the specified criteria.

Namespace:   Microsoft.UpdateServices.Administration
Assembly:  Microsoft.UpdateServices.Administration (in Microsoft.UpdateServices.Administration.dll)

Syntax

UpdateCollection GetUpdates(
    ApprovedStates approvedStates,
    DateTime fromArrivalDate,
    DateTime toArrivalDate,
    UpdateCategoryCollection updateCategories,
    UpdateClassificationCollection updateClassifications
)
UpdateCollection^ GetUpdates(
    ApprovedStates approvedStates,
    DateTime fromArrivalDate,
    DateTime toArrivalDate,
    UpdateCategoryCollection^ updateCategories,
    UpdateClassificationCollection^ updateClassifications
)
abstract GetUpdates : 
        approvedStates:ApprovedStates *
        fromArrivalDate:DateTime *
        toArrivalDate:DateTime *
        updateCategories:UpdateCategoryCollection *
        updateClassifications:UpdateClassificationCollection -> UpdateCollection
Function GetUpdates (
    approvedStates As ApprovedStates,
    fromArrivalDate As Date,
    toArrivalDate As Date,
    updateCategories As UpdateCategoryCollection,
    updateClassifications As UpdateClassificationCollection
) As UpdateCollection

Parameters

  • fromArrivalDate
    Type: System.DateTime

    Start date and time to search for updates. Updates synchronized on or after this date and time are included in the collection. To avoid filtering updates based on a start date, specify DateTime.MinValue. You must specify the date in Coordinated Universal Time.

  • toArrivalDate
    Type: System.DateTime

    End date and time that is used to search for updates. Updates synchronized on or before this date and time are included in the collection. To avoid filtering updates based on an end date, specify DateTime.MaxValue. You must specify the date in Coordinated Universal Time.

Return Value

Type: Microsoft.UpdateServices.Administration.UpdateCollection

An UpdateCollection collection of the most recent revision of any update that matches the given criteria.

Exceptions

Exception

Condition

ArgumentOutOfRangeException

fromSyncDate cannot be greater than toSyncDate.

Remarks

updateCategories and updateClassifications can both be null, in which case the return will not be filtered by categories or update classifications or both.

This search method will search on and return only the most recent revision of any update. For example, if an update was added on Monday and revised on Tuesday, and toSyncDate includes Monday but not Tuesday, the update would not be returned. To get all updates, call GetUpdates.

Examples

The following example shows how to get a collection of updates that represent the latest approved revision for any time, any category, and any update classification.

Dim updateCollection As UpdateCollection
updateCollection = updateServer.GetUpdates(ApprovedStates.LatestRevisionApproved, Date.MinValue, Date.MaxValue, Nothing, Nothing)

See Also

GetUpdates Overload
IUpdateServer Interface
Microsoft.UpdateServices.Administration Namespace

Return to top