1
0
mirror of https://github.com/Kopano-dev/kopano-ol-extension.git synced 2023-10-10 13:37:40 +02:00

Fix for undisposed wrapper.

This commit is contained in:
Patrick Simpson 2017-02-27 12:36:17 +01:00
parent 7773d7f973
commit 12e8f65265

View File

@ -247,17 +247,19 @@ namespace Acacia.UI
if (_gab?.Contacts != null)
{
// Begin GAB lookup, search on full name or username
ISearch<IContactItem> search = _gab.Contacts.Search<IContactItem>();
using (ISearch<IContactItem> search = _gab.Contacts.Search<IContactItem>())
{
search.AddField("urn:schemas:contacts:customerid").SetOperation(SearchOperation.Equal, username);
// Fetch the result, if any.
// TODO: make a SearchOne method?
List<GABUser> users = new List<GABUser>();
foreach (IContactItem result in search.Search(1))
using (IContactItem result = search.SearchOne())
{
if (result != null)
return new GABUser(result.FullName, result.CustomerID);
}
}
}
return new GABUser(username);
}