kopano-ol-extension/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Stubs/OutlookWrappers/AddressBookWrapper.cs

69 lines
2.0 KiB
C#
Raw Normal View History

2019-01-10 09:33:32 +01:00
/// Copyright 2019 Kopano b.v.
2016-12-21 12:53:16 +01:00
///
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License, version 3,
/// as published by the Free Software Foundation.
///
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
/// GNU Affero General Public License for more details.
///
/// You should have received a copy of the GNU Affero General Public License
/// along with this program.If not, see<http://www.gnu.org/licenses/>.
///
/// Consult LICENSE file for details
using Acacia.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
2017-02-08 15:40:48 +01:00
using NSOutlook = Microsoft.Office.Interop.Outlook;
2016-12-21 12:53:16 +01:00
namespace Acacia.Stubs.OutlookWrappers
{
class AddressBookWrapper : FolderWrapper, IAddressBook
{
2017-02-08 15:40:48 +01:00
public AddressBookWrapper(NSOutlook.MAPIFolder folder)
2016-12-21 12:53:16 +01:00
:
base(folder)
{
}
public override IFolder Clone()
{
return new AddressBookWrapper(CloneComObject());
}
IAddressBook IAddressBook.Clone()
{
return new AddressBookWrapper(CloneComObject());
}
2016-12-21 12:53:16 +01:00
public void Clear()
{
foreach(dynamic item in _item.Items.ComEnum())
2016-12-21 12:53:16 +01:00
{
item.Delete();
}
}
2019-01-10 09:33:32 +01:00
#region GAB
public void GABCreate<ItemType>(NSOutlook.OlItemType itemType, GABInitializer<ItemType> initializer)
{
using (ComRelease com = new ComRelease())
{
NSOutlook.Items items = com.Add(_item.Items);
dynamic contact = com.Add(items.Add(itemType));
initializer(com, contact);
}
}
#endregion
2016-12-21 12:53:16 +01:00
}
}