MAPI 存根库无法初始化 MAPI for Outlook 2016(64 位)
MAPI Stub Library cannot initialize MAPI for Outlook 2016(64bit)
我的电脑是Windows7(64位),然后安装Outlook 2016(64位)。
然后我按照https://docs.microsoft.com/en-us/office/client-developer/outlook/mapi/how-to-link-to-mapi-functions?redirectedfrom=MSDN中的说明使用MAPIStubLibrary。
我使用的MAPIStubLibrary版本更新于2018-02-26
我直接将 MapiStubLibrary.cpp 和 StubUtils.cpp 添加到我的项目中。然后我调用以下行来初始化 MAPI:
if (MAPIInitialize(NULL) != S_OK)
AfxMessageBox(_T("Initialize MAPI fails!"));
但是,当调用上面的代码时,我会看到一个消息框说“
Either there is no default mail client or the current mail client cannot fulfill the messaging request. Please run Microsoft Outlook and set it as the default mail client.
并且函数 MAPIInitialize(NULL) 将 return E_FAIL。但是我设置了Outlook 2016(64bit)为默认邮件客户端
我想我可能需要将 MAPIStubLibrary 更新到最新版本,所以我转到 https://github.com/stephenegriffin/MAPIStubLibrary 然后下载最新版本。
然后将library文件夹下的所有文件复制到我的项目中,包括MapiStubLibrary.cpp、StubUtils.cpp和StubUtils.h。
然后我在VS2008中重建项目。然而,这次我得到了很多错误:
.\MAPIStubLibrary\MapiStubLibrary.cpp(1155) : error C2065: 'nullptr' : undeclared identifier
.\MAPIStubLibrary\StubUtils.cpp(44) : error C2039: 'function' : is not a member of 'std'
.\MAPIStubLibrary\StubUtils.cpp(44) : error C2143: syntax error : missing ';' before '<'
.\MAPIStubLibrary\StubUtils.cpp(44) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
.\MAPIStubLibrary\StubUtils.cpp(45) : error C2086: 'int mapistub::function' : redefinition
.\MAPIStubLibrary\StubUtils.cpp(44) : see declaration of 'mapistub::function'
.\MAPIStubLibrary\StubUtils.cpp(49) : error C2065: 'logLoadMapiCallback' : undeclared identifier
为什么?
更新:
我仔细检查并确认 Outlook 是 64 位的:
这意味着 Outlook 未安装或具有不同的位数。检查文件中的 Outlook 位数 |办公室展望 |关于 Outlook。
我的电脑是Windows7(64位),然后安装Outlook 2016(64位)。
然后我按照https://docs.microsoft.com/en-us/office/client-developer/outlook/mapi/how-to-link-to-mapi-functions?redirectedfrom=MSDN中的说明使用MAPIStubLibrary。
我使用的MAPIStubLibrary版本更新于2018-02-26
我直接将 MapiStubLibrary.cpp 和 StubUtils.cpp 添加到我的项目中。然后我调用以下行来初始化 MAPI:
if (MAPIInitialize(NULL) != S_OK)
AfxMessageBox(_T("Initialize MAPI fails!"));
但是,当调用上面的代码时,我会看到一个消息框说“
Either there is no default mail client or the current mail client cannot fulfill the messaging request. Please run Microsoft Outlook and set it as the default mail client.
并且函数 MAPIInitialize(NULL) 将 return E_FAIL。但是我设置了Outlook 2016(64bit)为默认邮件客户端
我想我可能需要将 MAPIStubLibrary 更新到最新版本,所以我转到 https://github.com/stephenegriffin/MAPIStubLibrary 然后下载最新版本。
然后将library文件夹下的所有文件复制到我的项目中,包括MapiStubLibrary.cpp、StubUtils.cpp和StubUtils.h。
然后我在VS2008中重建项目。然而,这次我得到了很多错误:
.\MAPIStubLibrary\MapiStubLibrary.cpp(1155) : error C2065: 'nullptr' : undeclared identifier
.\MAPIStubLibrary\StubUtils.cpp(44) : error C2039: 'function' : is not a member of 'std'
.\MAPIStubLibrary\StubUtils.cpp(44) : error C2143: syntax error : missing ';' before '<'
.\MAPIStubLibrary\StubUtils.cpp(44) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
.\MAPIStubLibrary\StubUtils.cpp(45) : error C2086: 'int mapistub::function' : redefinition
.\MAPIStubLibrary\StubUtils.cpp(44) : see declaration of 'mapistub::function'
.\MAPIStubLibrary\StubUtils.cpp(49) : error C2065: 'logLoadMapiCallback' : undeclared identifier
为什么?
更新:
我仔细检查并确认 Outlook 是 64 位的:
这意味着 Outlook 未安装或具有不同的位数。检查文件中的 Outlook 位数 |办公室展望 |关于 Outlook。