Ejemplo n.º 1
0
        public override void OpenView()
        {
            this.book_view = this.book.GetBookView(BookQuery.AnyFieldContains(""),
                                                   new object [0],
                                                   -1);

            this.book_view.ContactsAdded    += OnContactsAdded;
            this.book_view.ContactsRemoved  += OnContactsRemoved;
            this.book_view.ContactsChanged  += OnContactsChanged;
            this.book_view.SequenceComplete += OnSequenceComplete;

            this.book_view.Start();
        }
Ejemplo n.º 2
0
        public ArrayList GetContacts(string bookName)
        {
            string    contact_fax = null;
            ArrayList ebooks      = new ArrayList();
            ArrayList records     = new ArrayList();

            SourceList slist = new SourceList("/apps/evolution/addressbook/sources");

            if (slist != null)
            {
                SList group_list = slist.Groups;
                foreach (SourceGroup group in group_list)
                {
                    //Only get phone books on this machine.
                    if (group.Name == "On This Computer")
                    {
                        SList src_list = group.Sources;

                        foreach (Evolution.Source src in src_list)
                        {
                            if (src.Name == bookName)
                            {
                                //Book bk = Book.NewSystemAddressbook ();
                                Book bk = new Book(src);
                                bk.Open(true);

                                BookQuery q           = BookQuery.AnyFieldContains("");
                                Contact[] contactlist = bk.GetContacts(q);
                                //Console.WriteLine ("Contact count (range) : {0}", contactlist.Length);

                                if (contactlist != null)
                                {
                                    foreach (Contact comp in contactlist)
                                    {
                                        contact_fax = null;

                                        if (comp.BusinessFax != null && comp.BusinessFax != String.Empty)
                                        {
                                            contact_fax = comp.BusinessFax;
                                        }
                                        else if (comp.OtherFax != null && comp.OtherFax != String.Empty)
                                        {
                                            contact_fax = comp.OtherFax;
                                        }
                                        else if (comp.HomeFax != null && comp.HomeFax != String.Empty)
                                        {
                                            contact_fax = comp.HomeFax;
                                        }

                                        if (contact_fax != null)
                                        {
                                            GfaxContact gc = new GfaxContact();
                                            //Console.WriteLine ("Id: {0}", comp.Id);
                                            gc.PhoneNumber   = contact_fax;
                                            gc.ContactPerson = comp.FullName;
                                            gc.Organization  = comp.Org;
                                            records.Add(gc);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(records);
        }