M
mgarg
Hi All,
All i am trying to is look for a particular Telephone number in
Contacts using MessageFilter instead of going through each message in
Contacts to speed up the search process. Can anyone help me in how to
do this.
Preferrably in c# but vb will also do.
This is how my code looks like
MAPI._Session oSession = new MAPI.Session();
Object vEmpty = Missing.Value;
oSession.Logon(vEmpty,vEmpty,false,false,vEmpty,vEmpty,vEmpty);
MAPI.Folder oFolder = (MAPI.Folder)oSession.GetDefaultFolder(5);
MAPI.Messages oMessages = (MAPI.Messages)oFolder.Messages;
MAPI.MessageFilter oFilter = (MAPI.MessageFilter)oMessages.Filter;
MAPI.Fields fields = (MAPI.Fields)oFilter.Fields;
MAPI.Field oField =
(MAPI.Field)fields.Add(MAPI.CdoPropTags.CdoPR_BUSINESS_TELEPHONE_NUMBER,vEmpty,"111111",vEmpty);
for (int i = 1; i < Convert.ToInt32(oMessages.Count); i ++)
{
MAPI.Message oMessage = (MAPI.Message)oMessages.get_Item(i);
MAPI.Fields oFields = (MAPI.Fields)oMessage.Fields;
MAPI.Field oField1 = (MAPI.Field)oFields.get_Item
(MAPI.CdoPropTags.CdoPR_BUSINESS_TELEPHONE_NUMBER,vEmpty);
object obj = oField1.Value;
}
oSession.Logoff();
This For Loop goes through each of my messages in contacts. I was
thinking it will loop only twice if i have two messages with the same
number.
Any help will be appreciated
Regards Mita
All i am trying to is look for a particular Telephone number in
Contacts using MessageFilter instead of going through each message in
Contacts to speed up the search process. Can anyone help me in how to
do this.
Preferrably in c# but vb will also do.
This is how my code looks like
MAPI._Session oSession = new MAPI.Session();
Object vEmpty = Missing.Value;
oSession.Logon(vEmpty,vEmpty,false,false,vEmpty,vEmpty,vEmpty);
MAPI.Folder oFolder = (MAPI.Folder)oSession.GetDefaultFolder(5);
MAPI.Messages oMessages = (MAPI.Messages)oFolder.Messages;
MAPI.MessageFilter oFilter = (MAPI.MessageFilter)oMessages.Filter;
MAPI.Fields fields = (MAPI.Fields)oFilter.Fields;
MAPI.Field oField =
(MAPI.Field)fields.Add(MAPI.CdoPropTags.CdoPR_BUSINESS_TELEPHONE_NUMBER,vEmpty,"111111",vEmpty);
for (int i = 1; i < Convert.ToInt32(oMessages.Count); i ++)
{
MAPI.Message oMessage = (MAPI.Message)oMessages.get_Item(i);
MAPI.Fields oFields = (MAPI.Fields)oMessage.Fields;
MAPI.Field oField1 = (MAPI.Field)oFields.get_Item
(MAPI.CdoPropTags.CdoPR_BUSINESS_TELEPHONE_NUMBER,vEmpty);
object obj = oField1.Value;
}
oSession.Logoff();
This For Loop goes through each of my messages in contacts. I was
thinking it will loop only twice if i have two messages with the same
number.
Any help will be appreciated
Regards Mita