Edit

Share via


ExchangeServiceBinding.FindFolderAsync Method

Definition

Overloads

FindFolderAsync(FindFolderType)

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

FindFolderAsync(FindFolderType, Object)

The FindFolderAsync(FindFolderType, Object) method provides asynchronous access to the FindFolder Web service method.

FindFolderAsync(FindFolderType)

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

public:
 void FindFolderAsync(ExchangeWebServices::FindFolderType ^ FindFolder1);
public void FindFolderAsync (ExchangeWebServices.FindFolderType FindFolder1);
Public Sub FindFolderAsync (FindFolder1 As FindFolderType)

Parameters

FindFolder1
FindFolderType

The FindFolder request.

Examples

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

static void FindFolderA(ExchangeServiceBinding <span class="label">esb</span>)
{ 
    // Register the event.
<span class="label">esb</span>.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.
<span class="label">esb</span>.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) &amp;&amp; (e.Error == null))
    {
        FindFolderResponseType response = e.Result;
        // TODO: Handle the response.
    }
    handled = true;
}

Applies to

FindFolderAsync(FindFolderType, Object)

The FindFolderAsync(FindFolderType, Object) method provides asynchronous access to the FindFolder Web service method.

public:
 void FindFolderAsync(ExchangeWebServices::FindFolderType ^ FindFolder1, System::Object ^ userState);
public void FindFolderAsync (ExchangeWebServices.FindFolderType FindFolder1, object userState);
Public Sub FindFolderAsync (FindFolder1 As FindFolderType, userState As Object)

Parameters

FindFolder1
FindFolderType

The FindFolder request.

userState
Object

Remarks

For an example of an asynchronous call, see FindFolderAsync(FindFolderType).

Applies to