IEnumerator IEnumerable.GetEnumerator()
 {
     foreach (NSOutlook.Store store in _item)
     {
         yield return(Mapping.Wrap(store));
     }
 }
 IEnumerator IEnumerable.GetEnumerator()
 {
     foreach (NSOutlook.Store store in IteratorStoresSafe())
     {
         yield return(Mapping.Wrap(store));
     }
 }
 public IEnumerator <IStore> GetEnumerator()
 {
     foreach (NSOutlook.Store store in _item)
     {
         yield return(Mapping.Wrap(store));
     }
 }
Beispiel #4
0
 public IFolder GetFolderFromID(string folderId)
 {
     using (ComRelease com = new ComRelease())
     {
         NSOutlook.NameSpace nmspace = com.Add(_app.Session);
         NSOutlook.Folder    f       = (NSOutlook.Folder)nmspace.GetFolderFromID(folderId);
         return(Mapping.Wrap <IFolder>(f));
     }
 }
Beispiel #5
0
 /// <summary>
 /// Creates a new item
 /// </summary>
 public ItemType Create <ItemType>()
     where ItemType : IItem
 {
     using (ComRelease com = new ComRelease())
     {
         NSOutlook.Items items = com.Add(_item.Items);
         object          item  = items.Add(Mapping.OutlookItemType <ItemType>());
         return(Mapping.Wrap <ItemType>(item));
     }
 }
Beispiel #6
0
        public IItem GetItemFromID(string id)
        {
            using (ComRelease com = new ComRelease())
            {
                NSOutlook.NameSpace nmspace = com.Add(_item.Session);

                // Get the item; the wrapper manages it
                object o = nmspace.GetItemFromID(id);
                return(Mapping.Wrap <IItem>(o));
            }
        }
Beispiel #7
0
        public ItemType SearchOne()
        {
            // Wrap manages com object in value
            object value = _item.Find(MakeFilter());

            if (value == null)
            {
                return(default(ItemType));
            }
            return(Mapping.Wrap <ItemType>(value));
        }
        public IStore AddFileStore(string path)
        {
            using (ComRelease com = new ComRelease())
            {
                NSOutlook.NameSpace session = com.Add(_item.Session);

                // Add the store
                session.AddStore(path);

                // And fetch it and wrap
                return(Mapping.Wrap(_item[_item.Count]));
            }
        }
Beispiel #9
0
 public IRecipient ResolveRecipient(string name)
 {
     using (ComRelease com = new ComRelease())
     {
         NSOutlook.NameSpace session = com.Add(_app.Session);
         // Add recipient, unlock after Resolve (which might throw) to wrap
         NSOutlook.Recipient recipient = com.Add(session.CreateRecipient(name));
         if (recipient == null)
         {
             return(null);
         }
         IRecipient wrapped = Mapping.Wrap(com.Remove(recipient));
         wrapped.Resolve();
         return(wrapped);
     }
 }
Beispiel #10
0
 private void HandleItemChange(object objItem)
 {
     try
     {
         using (IItem item = Mapping.Wrap <IItem>(objItem, GlobalOptions.INSTANCE.ReleaseItemEventWrappers))
         {
             if (item != null && _itemChange != null)
             {
                 _itemChange(item);
             }
         }
     }
     catch (System.Exception e)
     {
         Logger.Instance.Error(this, "Exception in HandleItemChange: {0}", e);
     }
 }
Beispiel #11
0
 private void HandleBeforeFolderMove(NSOutlook.MAPIFolder target, ref bool cancel)
 {
     try
     {
         if (_beforeFolderMove != null)
         {
             using (IFolder targetWrapped = Mapping.Wrap <IFolder>(target, false))
             {
                 if (targetWrapped != null)
                 {
                     _beforeFolderMove(this, targetWrapped, ref cancel);
                 }
             }
         }
     }
     catch (System.Exception e)
     {
         Logger.Instance.Error(this, "Exception in HandleBeforeItemMove: {0}", e);
     }
 }
Beispiel #12
0
 private void HandleFolderChange(NSOutlook.MAPIFolder folder)
 {
     try
     {
         if (_folderChange != null)
         {
             using (IFolder folderWrapped = Mapping.Wrap <IFolder>(folder, false))
             {
                 if (folderWrapped != null)
                 {
                     _folderChange(folderWrapped);
                 }
             }
         }
     }
     catch (System.Exception e)
     {
         Logger.Instance.Error(this, "Exception in HandleFolderChange: {0}", e);
     }
 }
Beispiel #13
0
 override public IStore GetStore()
 {
     return(Mapping.Wrap(_item.Store));
 }
 public IItem GetCurrentItem()
 {
     return(Mapping.Wrap <IItem>(_item.CurrentItem));
 }