BlackBerry 10 - Photos from partial contact - contacts

I am developing an application that needs to list all contacts in the phone's contacts list. Each cell needs to have the name of the contact and the corresponding photo (primaryPhoto).
I can do this, by fetching contactDetails for each contact. However, if the contacts list has a huge number of elements, this process is too slow. To handle this problem, I am not fetching the contact details and I am using the partial contacts retreived by
contacts = m_contactService->contacts(filter);
The only problem is that this list doesn't contain any photo! And I need the primaryPhoto available.
Is there a way to get the primaryPhoto from a partialContact without the need to fecth all contact details?
Thanks for your help

Implement the following after you get the list of contacts from this returned from the search filter
note: this is not pure C++, do not use this verbatim!
foreach contact in contacts
m_CPhoto = contact->primaryPhoto(); //returns the ContactPhoto id
// if necessary...
m_cPhotoList << m_CPhoto; // you can do this since this would be a list of ids
// to display the actual photo in your list view
m_CPhoto->smallPhoto();
// I only use 'small' since this is a list view; you may use 'original' or 'large'

Related

Dart Phone class search with flutter_contacts

I created a function (using flutter_contacts) that searches contacts on my Phone based on a given contact cell number (input - cellnumber) :
Contact? contact = contacts.firstWhereOrNull((c) => c.phones.contains(Phone(cellnumber)));
It works completely ok when I search for a number without "+" sign (e.g. 12345) and the contact in the contact list has a number without "+" (e.g. 12345).
But it doesn't work when I search for a number with "+" sign (e.g. +12345) and the contact has a number with plus (e.g. +12345).
Anyone knows why is that and how to fix it?
If you look at the code you will see that for the Phone class to be equal to another, there needs to be more components to match than just the phone number.
So to check for phone numbers only, you need to roll your own coparison:
Contact? contact = contacts.firstWhereOrNull((c) => c.phones.any((phone) => phone.number == cellNumber);
If this still does not match, print all the contacts to debug it. I have no idea what your contact list contains or why it would not match.
There is a normalizedNumber property, maybe you need to use that instead to figure out if someone used formatting like "+1 (234) 567-8900".

How can I perform filtering/searching school by writing the email address in flutter?

I would like to implement filtering/searching the university by typing its name like this picture below using flutter as a beginner. I would like it to auto-filter then display the school name even when I don't type the whole email address. It is quite hard to find good examples for what I want to do. Does anyone know of good examples that implemented something like I want?
Thank you
This a simple search in list items based on the text written. Below is the solution i use to search items in a list and update the list accordingly.
Assume you have a list of Emails.
List emails = []; A list which consist of emails from server/source
List emailsToShow = []; List of emails you update with every letter typed.
searchEmail(String typedLetters) {
if (typedLetters.length > 0) {
emailsToShow.clear();
emailsToShow.addAll(emails
.where((element) =>
element.toLowerCase().contains(typedLetters.toLowerCase()))
.toList());
setState((){});
}
}
Now call this function from onChanged method of TextField and show emailsToShow list in ListView/ListView.builder and you are good to go.

Get SOST database ID of sent emails

I have an ABAP program that sends emails. A sent email is stored in SOOD table. After sending an email I would like to get some ID of the email to be able to check its status later (in SOST table). I have seen more functions/methods to send email (e.g. cl_bcs/send, SO_NEW_DOCUMENT_SEND_API1), but none of them returns any ID. Is there a reliable way to get it?
Function module SO_NEW_DOCUMENT_SEND_API1 create and export a new OBJECT_ID for every new message sent, As you can see in here -
This NEW_OBJECT_ID stored at BCST_SR table in SCOM_KEY field. From BCST_SR table you've to get DOC_OID, using DOC_OID you can get details from SOOD table. (Reference field in SOOD is - IF_DOC_BCS ) Then use the Object number OBJNO to get the details from SOST table.
Also you can refer t-code SBWP to check your mail status.
For class CL_BCS, you can check the send_request object's method doc_wrapper_id. This will return the sood structer.
Two other answers gave me together valuable clues to get it done (+1). But both missed some accuracy and code snippets, so I sum it all up in my answer.
using cl_bcs
DATA gr_send_request TYPE REF TO cl_bcs.
DATA emailid LIKE soodk.
gr_send_request = cl_bcs=>create_persistent( ).
" ...
CALL METHOD gr_send_request->send(EXPORTING i_with_error_screen = 'X'
RECEIVING result = gv_sent_to_all ).
IF gv_sent_to_all = 'X'.
emailid = gr_send_request->send_request->doc_wrapper_id( ).
ENDIF.
SOODK (not sood) is structure containing three components (OBJTP, OBJYR, OBJNO) which are together the key in SOOD table.
using SO_NEW_DOCUMENT_SEND_API1
DATA LT_OBJECTID TYPE SOFOLENTI1-OBJECT_ID.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = LT_MAILSUBJECT
DOCUMENT_TYPE = 'HTM'
IMPORTING
new_object_id = lt_objectid
" ...
lt_objectid (SOFOLENTI1-OBJECT_ID) is char(17), that contains concatenated SOODK structure OBJTP+OBJYR+OBJNO. When divided to parts, it can be used to lookup a record in SOODK table. (I didn't find it in BCST_SR-SCOM_KEY, but it was not necessary.)

Blackberry, searching contacts from list

I want to add an Search Box in list Field. so that When i Enter a letter, then it will show the names starting with the letter 'A' , and so on. Iam using Vector to save the list of contacts same as the image shown :
If you want to select from the Contacts, use the ContactList.choose() method.
DO NOT try to iterate through the entire contacts your self every time. Remember there are lot of people having thousands of contacts and your code will be very unresponsive.
See: https://stackoverflow.com/a/4436816/371534
However, if you want to have 'filter as you type' kind of functionality with some other data, use the KeywordFilterField. You can get a sample code for it in the BlackBerry JDK samples.
Set a FieldChangeListener (or listen for alphanumeric key presses) to your EditField. Then refresh the list each time. Filtering on entries starting with the string contained in the EditField.
I wrote this on a pc without the Blackberry plugin installed, so couldn't test it, but it should be something like this.
String prefix = editField.getText();
Enumeration e = list.items();
while(e.hasMoreElements())
{
PIMItem item = (PIMItem) e.nextElement();
String name = item.getString(PIMItem.NAME,0);
if (name.startsWith(prefix))
{
//TODO display on screen
}
}

Trying to access ContactEndpointCollection in Microsoft Lync

I am trying to get access to all the endpoints that a particular contact might have so that I can display them, and the only place I have been able to find such a collection in the documentation is in the ContactEndpointCollection. However, despite all my searching I cant seem to find how you can get this collection from a particular Contact.
So my question is this: given a Contact, how can I get their ContactEndpointCollection?
You need to use the GetContactInformation method to get the contact endpoints.
Contact c;
List<object> endpoints = c.GetContactInformation(ContactInformationType.ContactEndpoints) as List<object>;
foreach(object o in endpoints)
{
ContactEndpoint ce = o as ContactEndpoint;
// Stuff
}
This returns an object, which you will need to cast to a list of objects. Then you can iterate through that list, casting each element as a ContactEndpoint. I don't know how to avoid the double casting, I am sure there is a way but this is a workaround.