Exemple #1
0
    def batch_create(self, sync_list, src_dbid, items):
        """See the documentation in folder.Folder"""

        my_dbid = self.get_dbid()
        c = self.get_config()
        pname = sync_list.get_pname()

        src_sync_tag = c.make_sync_label(pname, src_dbid)
        dst_sync_tag = c.make_sync_label(pname, my_dbid)

        ex_cons = []
        for item in items:
            exc = EXContact(self, con=item)
            rid = item.get_itemid()
            exc.update_sync_tags(src_sync_tag, rid)

            self.add_item(exc)

            ews_con = exc.init_ews_con_from_props()
            ex_cons.append(ews_con)

        self.get_ews().CreateItems(self.get_fobj().Id, ex_cons)

        for i, item in enumerate(items):
            exc = ex_cons[i]
            item.update_sync_tags(dst_sync_tag, exc.itemid.value)

        ## FIXME: need to get error and fix it
        return True
Exemple #2
0
    def batch_create(self, sync_list, src_dbid, items):
        """See the documentation in folder.Folder"""

        my_dbid = self.get_dbid()
        c = self.get_config()
        pname = sync_list.get_pname()

        src_sync_tag = c.make_sync_label(pname, src_dbid)
        dst_sync_tag = c.make_sync_label(pname, my_dbid)

        ex_cons = []
        for item in items:
            con_itemid = item.get_itemid_from_synctags(pname, 'ex')
            exc = EXContact(self, con=item, con_itemid=con_itemid)
            rid = item.get_itemid()
            exc.update_sync_tags(src_sync_tag, rid)

            self.add_item(exc)

            ews_con = exc.init_ews_con_from_props()
            ex_cons.append(ews_con)

        self.get_ews().CreateItems(self.get_fobj().Id, ex_cons)

        for i, item in enumerate(items):
            exc = ex_cons[i]
            item.update_sync_tags(dst_sync_tag, exc.itemid.value)

        ## FIXME: need to get error and fix it
        return True
Exemple #3
0
    def _refresh_items(self):
        self.reset_items()

        ews = self.get_ews()
        fobj = self.get_fobj()
        ews_cons = ews.FindItems(fobj, eprops_xml=self.custom_eprops_xml)

        for econ in ews_cons:
            ## FIXME: This needs to be fixed if and when we support additional
            ## Item types.
            con = EXContact(folder=self, ews_con=econ)
            self.add_item(con)
Exemple #4
0
    def find_items(self, itemids):
        logging.info('folder_ex:find_items() - fetching items...')
        try:
            ews = self.get_ews()
            ews_items = ews.GetItems(itemids,
                                     eprops_xml=self.custom_eprops_xml)
        except EWSMessageError as e:
            logging.info('Error from Server looking for items: %s', e)
            return None

        fid = self.get_itemid()
        if ews_items is not None and len(ews_items) > 0:
            ## FIXME: Need to fix this when we add suppport for additional
            ## item types. For now we just assume we only get back contact
            ## types - which is true as of April 2014
            items = [EXContact(self, x) for x in ews_items]
            ret = [x for x in items if x.get_parent_folder_id() == fid]
            return ret
        else:
            return None
Exemple #5
0
 def new_contact (self, first, last):
     con = EXContact(self.cons_f)
     con.set_firstname(first)
     con.set_middlename("Bihari")
     con.set_lastname(last)
     con.set_title("Ex PM")
     con.add_notes("Jolly good fellow")
     con.add_email_work("*****@*****.**")
     con.add_web_home('http://asynk.io')
     con.add_web_home('http://karra-asynk.appspot.com')
     con.add_web_work('http://www.cleartrip.com')
     con.add_web_work('http://www.hackerrank.com')
     con.save()