|
Hi,
I have to import the contacts from Outlook. But I want to disable alert message.
Can you tell me, too?.
Thanks.
|
|
|
|
|
I used Extended MAPI and don´t show Outlook alert message in my project now.
Bye.
|
|
|
|
|
can u please share the code snippet here to disable the outllok alert message that comes up while accessing email address from contacts.
|
|
|
|
|
here's what you're looking for (and what i was looking for and found):
http://www.codeproject.com/KB/IP/CMapiEx.aspx[^]
that's a working sample of how to use extend mapi.
when you iterate through the contacts in this code, call MAPIOBJECT on the contact, then through that get the email and name of the contact to get around the security warning.
here's the quick and dirty (didn't include error checking):
static const GUID MY_IID_IMAPIProp = // {00020303-0000-0000-C000-000000000046}
{0x00020303,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}};
static const GUID OUTLOOK_EMAIL_DATA = // {00062004-0000-0000-C000-000000000046}
{0x00062004,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}};
#define OUTLOOK_EMAIL1_TYPE 0x8082
#define OUTLOOK_EMAIL1_VALUE 0x8083
#define OUTLOOK_EMAIL1_NAME 0x8084
#include <mapix.h> // for extended mapi
#include <mapiutil.h> // for get one prop
#pragma comment (lib, "mapi32.lib")
...
CComPtr<IUnknown> spMAPIObj = NULL;
CComPtr<IMAPIProp> spMAPIProp = NULL;
spMAPIObj = spContact->GetMAPIOBJECT();
hr = spMAPIObj->QueryInterface(MY_IID_IMAPIProp, (void **)&spMAPIProp );
LPSPropValue pProp = NULL;
hr = HrGetOneProp(spMAPIProp, PR_DISPLAY_NAME, &pProp);
//0x00040380 == undefined prop, but is success, so explicity check for S_OK
if (hr == S_OK && pProp != NULL && pProp->Value.LPSZ != NULL) {
sVal = prop.Value.LPSZ;
}
MAPIFreeBuffer(pProp);
ULONG ulPropCount = 0;
MAPINAMEID nameID = { (GUID*)&OUTLOOK_EMAIL_DATA, MNID_ID, OUTLOOK_EMAIL1_VALUE };
LPMAPINAMEID lpNameID[1]={ &nameID };
LPSPropTagArray lppPropTags = NULL;
hr = pIMAPIProp->GetIDsFromNames(1, lpNameID, 0, &lppPropTags);
hr = pIMAPIProp->GetProps(lppPropTags, fMapiUnicode, &ulPropCount, &pProp);
//0x00040380 == undefined prop, but is success, so explicity check for S_OK
if (hr == S_OK && pProp != NULL && pProp->Value.LPSZ != NULL) {
sVal = prop.Value.LPSZ;
}
MAPIFreeBuffer(lppPropTags);
MAPIFreeBuffer(pProp);
Dan.
modified on Thursday, July 31, 2008 2:23 PM
|
|
|
|
|
Just Gets the same item over and over again. GetFirst works ok, and
so does Getlast. Getprevious returns a null (Getlast is done first).
private void btnTest_Click(object sender, System.EventArgs e)
{
Outlook.NameSpace NameSpace1;
Outlook.MAPIFolder Folder1;
if (!ApplicationCreated)
{
OA1 = new Outlook.Application();
ApplicationCreated = true;
}
NameSpace1 = OA1.GetNamespace("MAPI");
Folder1 =
NameSpace1.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts);
int v1 = Folder1.Items.Count;
MessageBox.Show("Count of Contacts: " + v1.ToString(),
"Contacts",MessageBoxButtons.OK,MessageBoxIcon.Information);
Application.DoEvents();
Outlook.ContactItem CI1 = null;
string v2 = null;
for (int i = 1; i <= v1; i++)
{
if (i == 1)
CI1 = (Outlook.ContactItem) Folder1.Items.GetFirst();
else
CI1 = (Outlook.ContactItem) Folder1.Items.GetNext();
if (CI1 == null)
break;
else
{
v2 = CI1.Email1Address;
this.cmbMailTo.Items.Add(v2);
CI1 = null;
}
}
CI1 = (Outlook.ContactItem) Folder1.Items.GetLast();
v2 = CI1.Email1Address;
CI1 = (Outlook.ContactItem) Folder1.Items.GetPrevious();
string v3 = null;
if (CI1 == null)
v3 = "NULL PREVIOUS";
else
v3 = CI1.Email1Address;
CI1 = (Outlook.ContactItem) Folder1.Items.GetPrevious();
string v4 = null;
if (CI1 == null)
v4 = "NULL PREVIOUS PREVIOUS";
else
v4 = CI1.Email1Address;
MessageBox.Show("EmailAddress1 of last contact is " + v2
+ " and previous is " + v3 + " and before that is " + v4,
"Testing");
|
|
|
|
|
|
what is the diference between
//For Office XP
#import "E:\Program Files\Common Files\Microsoft Shared\Office10\mso.dll" named_guids
#import "E:\Microsoft Office\Office10\MSOUTL.OLB" \ no_namespace
exclude("_IRecipientControl", "_DRecipientControl");
and
//For Office 2000
#import "E:\Program Files\Common Files\Microsoft Shared\Office10\mso.dll" named_guids
#import "E:\Microsoft Office\Office10\MSOUTL.OLB" \ no_namespace
exclude("_IRecipientControl", "_DRecipientControl");
I do not see any diference just the commented line ...
|
|
|
|
|
OOPS this is a big mistake
Thanks for correcting me.
See the following for office 2000 typelib
#import "I:\My Programs\Office2K\Office\mso9.dll" named_guids
#import "I:\My Programs\Office2K\Office\MSOUTL9.OLB" \
no_namespace exclude("_IRecipientControl",
"_DRecipientControl")
|
|
|
|
|
How can i fetch messages from the Outlook Express?
|
|
|
|
|
Hi All,
Even I have the same doubt,but deepesh has given how to access the contactitems,it is working fine,similarly i would like to know how to import other information from Outlook as well. This includes Appointment Items, Email Messages, Notes, Tasks, and more. Deepesh mentioned that, to import Appointment Items from a Calendar folder one just needs to make an object of _AppointmentItemPtr smart pointer class instead of _ContactItemPtr.Yes it is ok,but how can i use the methods,no help regarding this is available,so if deepesh knows this please reply me,my mail id is cmpnarayan@myrealbox.com.
Warm regards,
Praveen
|
|
|
|
|
hi,
You can use SimpleMAPI for fetching messages. But it has a big limitation: you'll be able to fetch just for inbox.
Do you think that will be usefull to write an article and a sample app for this ?
Thanks,
Gabi
|
|
|
|
|
I come to know that it is possible with Simple MAPI,for
atleast inbox.But i don't know how?
Is any kind of code sample available or not?
|
|
|
|
|
Resolve already anybody this problem, how can fetch messages from the Outlook Express? I shall grateful for any example.
|
|
|
|
|
Check out WAB API.. a sample can be found here:
http://www.codeproject.com/cpp/wabapi.asp
Cheers!
Deepesh
|
|
|
|
|
Thanx Deepesh,
I thing this si the perfect thing, I was looking around.
thanx again,\
Coolvcguy
|
|
|
|
|
Problem about fetching messages from Outlook Express is "partialy" solved on web page OE dbx file format by Arne Schloh.
Messages are extracted from dbx file, basically, in *.eml MIME format, which is described on web page MIME information.
|
|
|
|
|
Yea,,I think that will be useful for me.
Thanks Roman,
Regards,
Coolvcguy
|
|
|
|
|
You guessed it right
Cheers!!!
Deepesh
|
|
|
|
|
Hi,
This is a very good article.
You can use also MAPI to import contacts from Outlook.
Advantages: Faster than COM based.
Disadvantages: You need to have well knoledge of MAPI.
Best Regards,
Gabi
|
|
|
|
|
I think there is another advantage: it is independent of the office version that is installed
|
|
|
|
|
You're right. I've missed this major advantage.
Thanks,
Gabi
|
|
|
|
|
Actually, for simple things like this, the object model hasn't changed since the inception of Outlook. Even the Office object model hasn't been updated (except probably for bug fixes) in a long time since it's really quite basic in functionality compared to the specific application typelibs. The object model, starting with '97, is made to be backwards compatible. Since Outlook wasn't in '95, it doesn't really matter, but '95 is still tricky since a lot has changed since then. Now MS seems to use forward-thinking when programming their APIs and their object model.
MAPI can be used, though. I'm just pointing out that object models are pretty consistent and using the typelib ID in the #import statement helps aleviate version problems when compiling. During run-time, any late-bound calls will not care what typelib version is installed.
Reminiscent of my younger years...
10 LOAD "SCISSORS"
20 RUN
|
|
|
|
|
Hi Gabi,
I knew that using extended MAPI we can import all the outlook folders,Yes the problem is we should know MAPI well,even i am facing the same problem.Could u please help me if u know how can we use MAPI.
Warm regards,
Praveen.
|
|
|
|
|
Yes,
I can help you.
So, probably it will be usefull if I'll make same appliation but based on MAPI and I'll write an article.
Do you think will be usefull for you?
|
|
|
|
|
Would you tell me How can I get web-page property in using MAPI?
I use LPMAILUSER->GetProps(PR_PERSONAL_HOME_PAGE), but failure return!
|
|
|
|
|