Reporting Newly Synchronized Updates


Applies To: Windows Server Update Services

The following example shows how to retrieve newly synchronized updates. You can further restrict the updates that IUpdateServer.GetUpdates retrieves by including categories or classifications of updates to retrieve. This example filters the result to include only the latest revision of an update and those updates that are not declined or superseded by another update.

IUpdateServer server = AdminProxy.GetUpdateServer();
ISynchronizationInfo syncInfo = server.GetSubscription().GetLastSynchronizationInfo();
UpdateCollection updates = null;

if (SynchronizationResult.Succeeded == syncInfo.Result)
  updates = server.GetUpdates(ApprovedStates.Any, 
                              syncInfo.StartTime, syncInfo.EndTime, 
                              null, null);

  foreach (IUpdate update in updates)
    if (true == update.IsLatestRevision && 
        false == update.IsSuperseded && 
        false == update.IsDeclined)
      Console.WriteLine("{0}", update.Title);