Dela via


ExchangeServiceBinding.FindFolderAsync Method (FindFolderType)

The FindFolderAsync method provides asynchronous access to the FindFolder Web service method.

Namespace: ExchangeWebServices
Assembly: EWS (in ews.dll)

Syntax

'Declaration
Public Sub FindFolderAsync ( _
    FindFolder1 As FindFolderType _
)
public void FindFolderAsync (
    FindFolderType FindFolder1
)
public:
void FindFolderAsync (
    FindFolderType^ FindFolder1
)
public void FindFolderAsync (
    FindFolderType FindFolder1
)
public function FindFolderAsync (
    FindFolder1 : FindFolderType
)

Parameters

  • FindFolder1
    The FindFolder request.

Example

The following example shows how to perform an asynchronous FindFolder call.

static void FindFolderA(ExchangeServiceBinding esb)
{ 
    // Register the event.
    esb.FindFolderCompleted += new FindFolderCompletedEventHandler(HandleFindFolderCompleted);

    // Create the request.
    FindFolderType request = new FindFolderType();
    request.FolderShape = new FolderResponseShapeType();
    request.FolderShape.BaseShape = DefaultShapeNamesType.AllProperties;
    request.Traversal = FolderQueryTraversalType.Deep;
    request.ParentFolderIds = new BaseFolderIdType[1];
    DistinguishedFolderIdType root = new DistinguishedFolderIdType();
    root.Id = DistinguishedFolderIdNameType.root;
    request.ParentFolderIds[0] = root;

    // Send the asynchronous request.
    esb.FindFolderAsync(request);

    // Wait for the response.
    while (!handled)
    {
        Thread.Sleep(1000);
        Console.Write("Waiting\r\n");
    }
}

static private bool handled = false;

static void HandleFindFolderCompleted(object sender, FindFolderCompletedEventArgs e)
{
    if ((!e.Cancelled) && (e.Error == null))
    {
        FindFolderResponseType response = e.Result;
        // TODO: Handle the response.
    }
    handled = true;
}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003,

Target Platforms

Windows 98, Windows 2000, Windows 2000 Server, Windows CE, Windows Longhorn, Windows 98 Second Edition, Pocket PC, Smart Phone, Windows Server 2003, Windows XP Professional with Service Pack 2 (SP2)