ResolveName method

Future<NameResolutionCollection> ResolveName(
  1. String? nameToResolve,
  2. Iterable<FolderId>? parentFolderIds,
  3. ResolveNameSearchLocation searchScope,
  4. bool returnContactDetails,
  5. PropertySet? contactDataPropertySet,
)
Finds contacts in the Global Address List and/or in specific contact folders that have names that match the one passed as a parameter. Calling this method results in a call to EWS. The name to resolve. The Ids of the contact folders in which to look for matching contacts. The scope of the search. Indicates whether full contact information should be returned for each of the found contacts. The property set for the contct details

Implementation

Future<NameResolutionCollection> ResolveName(
    String? nameToResolve,
    Iterable<FolderId>? parentFolderIds,
    ResolveNameSearchLocation searchScope,
    bool returnContactDetails,
    PropertySet? contactDataPropertySet) async {
  if (contactDataPropertySet != null) {
    EwsUtilities.ValidateMethodVersion(
        this, ExchangeVersion.Exchange2010_SP1, "ResolveName");
  }

  EwsUtilities.ValidateParam(nameToResolve, "nameToResolve");
  if (parentFolderIds != null) {
    EwsUtilities.ValidateParamCollection(parentFolderIds, "parentFolderIds");
  }

  ResolveNamesRequest request = new ResolveNamesRequest(this);

  request.NameToResolve = nameToResolve;
  request.ReturnFullContactData = returnContactDetails;
  request.ParentFolderIds.AddRangeFolderIds(parentFolderIds);
  request.SearchLocation = searchScope;
  request.ContactDataPropertySet = contactDataPropertySet;

  return (await request.Execute())[0].Resolutions;
}