Esempio n. 1
0
 public static void ImportedContactAdded(IResource contact, IResource AB)
 {
     if (!ProcessingImportFromOutlook)
     {
         ImportedContactsChangeWatcher.SetExportedContact(contact);
         OutlookSession.OutlookProcessor.QueueJob(new ExportContactDescriptor(contact, AB));
     }
 }
Esempio n. 2
0
 private void DoDropResources(IResource targetResource, IResourceList droppedResources)
 {
     foreach (IResource res in droppedResources.ValidResources)
     {
         if (targetResource.HasProp(PROP.Imported) && res.HasProp(PROP.EntryID))
         {
             ImportedContactsChangeWatcher.ImportedContactAdded(res, targetResource);
         }
         else
         {
             res.AddLink("InAddressBook", targetResource);
         }
     }
 }
Esempio n. 3
0
            private void OnImportedContactChanged(object sender, ResourcePropIndexEventArgs e)
            {
                string oldID          = (string)e.ChangeSet.GetOldValue(PROP.EntryID);
                object oldUserCreated = e.ChangeSet.GetOldValue(ContactManager._propUserCreated);

                //-------------------------------------------------------------
                //  An Outlook Contact can be removed from the AB via two mechanisms:
                //  - moved to the Deleted Items. In such case the Outlook resource
                //    generally exists, and EntryID still exists (though it can be
                //    changed). For this case MAPI Listener's OnMailMoved is called,
                //    which calls Contact.RemoveFromSynch( IResource, newID ).
                //  - deleted physically. In this case EntryId is physically removed
                //    along with the object itself. Here MAPI Listener's OnMailDeleted
                //    is called, which calls Contact.RemoveFromSynch( IResource, true ).
                //  In both cases MAPI routines set "UserCreated" boolean prop to "true"
                //  which serves as indication for us to unlink the contact and the AB.
                //-------------------------------------------------------------
                if (oldUserCreated == null && e.Resource.HasProp(ContactManager._propUserCreated))
                {
                    new ResourceProxy(e.Resource).DeleteLink("InAddressBook", _importedAB);
                }
                else
                //-------------------------------------------------------------
                //  Specially go around the case when EntryId is being removed, this
                //  is covered (on the more general level) by previous condition.
                //  LX: this restriction is left "as is" from SergeZhulin.
                //-------------------------------------------------------------
                if (e.Resource.HasProp(PROP.EntryID) || oldID == null)
                {
                    if (!ProcessingImportFromOutlook && !ImportedContactsChangeWatcher.IsExportedContact(e.Resource))
                    {
                        OutlookSession.OutlookProcessor.QueueJob(new ExportContactDescriptor(e.Resource));
                    }
                    ImportedContactsChangeWatcher.CleanExportedContact(e.Resource);
                }
            }