请问OUTLOOK的通讯录怎么读取,有什么接口

jingjing_123 2009-11-09 10:59:59
如题,看过以前的贴,没有找的解决方法。。。。
...全文
465 19 打赏 收藏 转发到动态 举报
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
google vc outlook.application

http://topic.csdn.net/t/20050620/20/4095077.html
  • 打赏
  • 举报
回复
如果是office上的outlook应该没有问题
  • 打赏
  • 举报
回复
oe6似乎不支持vba

你看看http://blog.sina.com.cn/s/blog_4c62562801000bhw.html

或者是mapi这样的编程方式....
jingjing_123 2009-11-10
  • 打赏
  • 举报
回复
Outlook Express 6
  • 打赏
  • 举报
回复
你的office版本?
jingjing_123 2009-11-10
  • 打赏
  • 举报
回复
引用了,在stdafx.h里

#import “C:/Program Files/Common Files/Microsoft Shared/OFFICE11/mso.dll” rename_namespace(”Office”), named_guids
#import “C:/Program Files/Microsoft Office/Office11/MSOUTL.olb” rename_namespace(”Outlook”), named_guids

using namespace Office;
using namespace Outlook;

但是系统找不到MSOUTL.olb文件,我在网上下了一个,可以编译通过,但是运行,就报上面的错
  • 打赏
  • 举报
回复
你引用dll了么??还有outlook应该在你机器有装
jingjing_123 2009-11-10
  • 打赏
  • 举报
回复

::CoInitialize(NULL);
{
_ApplicationPtr spOutlook("Outlook.Application");
_NameSpacePtr spNamespace = spOutlook->GetNamespace("MAPI");
MAPIFolderPtr spFolder = spNamespace->GetDefaultFolder(olFolderContacts);
_ItemsPtr spItems = spFolder->GetItems();
_ContactItemPtr spContact;

char s[200]={0};
for(int i=1;i<=spItems->Count;++i)
{
spContact = spItems->Item(i);
sprintf(s, "%s%s", _com_util::ConvertBSTRToString(spContact->Subject), _com_util::ConvertBSTRToString(spContact->MobileTelephoneNumber));
//AfxMessageBox(_T(s));
}
spContact = NULL;
spItems = NULL;
spFolder = NULL;
spNamespace = NULL;
spOutlook = NULL;
}
::CoUninitialize();

为什么 _ApplicationPtr spOutlook("Outlook.Application"); 运行的时候报错 :
ReadBookFromOutlook.exe 中的 0x7c812a6b 处最可能的异常: Microsoft C++ 异常: 内存位置 0x0013f18c 处的 _com_error。
ReadBookFromOutlook.exe 中的 0x7c812a6b 处未处理的异常: Microsoft C++ 异常: 内存位置 0x0013f18c 处的 _com_error。
MoXiaoRab 2009-11-09
  • 打赏
  • 举报
回复
Just a small example


Variant Outlook = CreateOleObject( "Outlook.Application" );
Variant MAPINamespace = Outlook.OleFunction( "GetNamespace", "MAPI" );
Variant contactsFolder = MAPINamespace.OleFunction( "GetDefaultFolder", olFolderContacts );
Variant contactItems = contactsFolder.OlePropertyGet( "Items" );
Variant contactItemsCount = contactItems.OlePropertyGet( "Count" );
for( int i = 1; i <= contactItemsCount; i++ )
{
Variant contactItem = contactItems.OleFunction( "Item", i );
for( int j = 0; propertyList.setCurrent( j ); j++ )
{
Variant propertyValue = contactItem.OlePropertyGet( "FullName" );
}
}



jingjing_123 can refer this document from MSDN

In additon to it,the following is a LIST

OlePropertyGet with one of these values:

Title
FirstName
MiddleName
LastName
Suffix
FullName
CompanyName
Department
JobTitle
BusinessAddressStreet
BusinessAddressCity
BusinessAddressState
BusinessAddressPostalCode
BusinessAddress
BusinessAddressCountry
HomeAddressStreet
HomeAddressCity
HomeAddressState
HomeAddressPostalCode
HomeAddress
HomeAddressCountry
OtherAddressStreet
OtherAddressCity
OtherAddressState
OtherAddressPostalCode
OtherAddress
OtherAddressCountry
AssistantTelephoneNumber
BusinessTelephoneNumber
Business2TelephoneNumber
BusinessFaxNumber
CallbackTelephoneNumber
CarTelephoneNumber
CompanyMainTelephoneNumber
HomeFaxNumber
HomeTelephoneNumber
Home2TelephoneNumber
ISDNNumber
MobileTelephoneNumber
OtherFaxNumber
OtherTelephoneNumber
PagerNumber
PrimaryTelephoneNumber
RadioTelephoneNumber
TTYTDDTelephoneNumber
TelexNumber
Account
Anniversary
AssistantName
BillingInformation
Birthday
BusinessAddressPostOfficeBox
Categories
Children
Email1Address
Email1AddressType
Email1DisplayName
Email2Address
Email2AddressType
Email2DisplayName
Email3Address
Email3AddressType
Email3DisplayName
Gender //Unspecified=0, Female=1, Male=2
GovernmentIDNumber
Hobby
HomeAddressPostOfficeBox
Initials
InternetFreeBusyAddress
Language
ManagerName
Mileage
OfficeLocation
OrganizationalIDNumber
OtherAddressPostOfficeBox
Importance //Priority: Low=0, Normal=1, High=2
Profession
ReferredBy
Sensitivity //Private: Normal=0, Personal=1, Private=2, Confidential=3
Spouse
User1
User2
User3
User4
WebPage
jingjing_123 2009-11-09
  • 打赏
  • 举报
回复
我的是Outlook Express 用的是第一种方法,第二种
#import "e:\Program Files\Microsoft Office\Office\mso9.dll" named_guids
#import "e:\Program Files\Microsoft Office\Office\MSOUTL9.olb" \
no_namespace exclude("_IRecipientControl", "_DRecipientControl")

这两个库文件都找不到
MoXiaoRab 2009-11-09
  • 打赏
  • 举报
回复
pContact->GetEmail1Address()是获取邮件地址,这你也看到了吧?

根据1#下面的那些属性进行填充
jingjing_123 2009-11-09
  • 打赏
  • 举报
回复
找了个例子,可以读取姓名和邮箱,但不能获取到电话号码http://www.vckbase.com/document/viewdoc/?id=660
MoXiaoRab 2009-11-09
  • 打赏
  • 举报
回复
我给你贴的那个MSDN文档你看下,还有有的问题你可以去Google,MSDN。不用每个问题都面面俱到地问

jingjing_123 2009-11-09
  • 打赏
  • 举报
回复
up ~ 高手help~
jingjing_123 2009-11-09
  • 打赏
  • 举报
回复
Tr0j4n, VARIANT atl头文件什么意思?要加载哪个头文件,知识浅薄,请说明白一些,谢谢
oyljerry 2009-11-09
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 jingjing_123 的回复:]
o sorry,连接的网址是自动发邮件的,但是你贴出来的代码部分,但是 这个提示 “Variant”  未声明的标识符 MFC 里没有种类型的变量
[/Quote]
VARIANT atl头文件
jingjing_123 2009-11-09
  • 打赏
  • 举报
回复
o sorry,连接的网址是自动发邮件的,但是你贴出来的代码部分,但是 这个提示 “Variant” 未声明的标识符 MFC 里没有种类型的变量
MoXiaoRab 2009-11-09
  • 打赏
  • 举报
回复
这个是发邮件的吗??明明是contract操作啊
jingjing_123 2009-11-09
  • 打赏
  • 举报
回复
3ks Tr0j4n,我不是要outlook 自动打邮件的,我需要读取联系人姓名和电话号码

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧