更新時間:2019-11-20
描述
用戶可以查詢所有部門里面聯(lián)系人的詳細信息。
前提條件
已完成組件的初始化和登錄。
業(yè)務流程
搜索關鍵字、當前需要查找的頁面索引(從1開始)、是否精確查找,以及當前查詢序號。建議應用程序設置的查詢序號從0開始遞增,最大值0xFFFFFFFD(0xFFFFFFFE為SDK內部保留值)。
部門ID,若填寫則在指定部門下查詢,此處的部門ID默認為第一級部門ID。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
//java code TsdkEAddrManager tsdkEAddrManager = TsdkManager.getInstance().geteAddrManager(); private int queryContactsInfoSeq = 1; public int searchContacts(String keyWords) { int seq = queryContactsInfoSeq++; if (null == keyWords) { Log.e(TAG, "Search condition is empty"); } TsdkSearchContactsParam searchContactsParam = new TsdkSearchContactsParam(); searchContactsParam.setDepartmentId(""); searchContactsParam.setIsExactSearch(0); searchContactsParam.setPageIndex(1); searchContactsParam.setSearchKeyword(keyWords); searchContactsParam.setSeqNo(seq); int result = tsdkEAddrManager.searchContacts(searchContactsParam); Log.i(TAG, "searchResult -->" + result); return seq; } |
查詢到的聯(lián)系人信息包括:UC帳號、姓名、工號、IP號碼、部門名字、職務、郵箱、手機號碼、座機號碼、家庭電話、性別、郵編、地址、簽名和硬終端等。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
//Java code public void handleSearchContactResult(int querySeqNo, TsdkCommonResult result, TsdkSearchContactsResult searchContactResult) { int seqNo = querySeqNo; int ret = result.getResult(); if (ret == 0) { List<TsdkContactsInfo> contactsInfos = searchContactResult.getContactInfo(); int totalNum = searchContactResult.getTotalNum(); if (0 == totalNum) { notification.onEntAddressBookNotify(EntAddressBookConstant.Event.SEARCH_CONTACTS_NOT_FOUND, null); } else if (querySelfInfoSeq == seqNo) { notification.onEntAddressBookNotify(EntAddressBookConstant.Event.SEARCH_SELF_COMPLETE, contactsInfos); } else { list = contactsInfos; QueryContactsInfoResult queryContactsResult = new QueryContactsInfoResult(); queryContactsResult.setQuerySeq(seqNo); List<EntAddressBookInfo> contactsList = new ArrayList<>(); for (TsdkContactsInfo contactorInfo : contactsInfos) { EntAddressBookInfo entAddressBookInfo = new EntAddressBookInfo(); entAddressBookInfo.setEaddrAccount(contactorInfo.getStaffAccount()); if(contactorInfo.getStaffAccount().isEmpty() || contactorInfo.getStaffAccount() == null) { break; } entAddressBookInfo.setTerminal(contactorInfo.getTerminal()); entAddressBookInfo.setEaddrDept(contactorInfo.getDepartmentName()); entAddressBookInfo.setSysIconID(10); contactsList.add(entAddressBookInfo); } queryContactsResult.setList(contactsList); notification.onEntAddressBookNotify(EntAddressBookConstant.Event.SEARCH_CONTACTS_COMPLETE, queryContactsResult); } Log.i(TAG, totalNum + "Get the total number of returned contacts"); } else { Log.e(TAG, "Search contacts failed, result -->" + result); notification.onEntAddressBookNotify(EntAddressBookConstant.Event.SEARCH_CONTACTS_FAILED, null); } } |
注意事項
無。