依赖“SMS”的 PR_DISPLAY_NAME 属性和“ActiveSync”命名消息存储
我正在尝试找出 Windows 移动设备(版本 6.1 和 6.5)上的消息存储类型。
更具体地说,我试图弄清楚消息存储是否属于“Exchange (ActiveSync)”类型,而不是 SMS 或其他电子邮件帐户类型(POP3、IMAP 等)。
我所依赖的事实是,SMS 存储的属性 PR_DISPLAY_NAME
返回的值为 "SMS"
,Exchange 存储的属性 PR_DISPLAY_NAME
返回的值为 "ActiveSync"
。
我的问题是,我可以依靠这些值来确定消息存储类型吗?有更好的方法来实现这一目标吗?
以下是描述我的逻辑的伪代码:
bool isActiveSyncSet = areAnySyncAccountSet(); // I use Sync configuration service
// provider to check if any ActiveSync accounts are set.
// Initialize MAPI and fetch all stores
while(we_have_stores) {
// Open Current Store
openCurrentStore(¤tStore);
string storeName = fetchStoreName(currentStore); // using GetProps method fetch PR_DISPLAY_NAME
if(storeName == "SMS" ) continue;
if(isActiveSyncSet && storeName == "ActiveSync") {
// We got the Exchange Message Store
break;
} else {
// We have an E-Mail store but not an ActiveSync one
}
}
I'm trying to find out the type of message store on windows mobile devices (version 6.1 & 6.5).
More specifically I'm trying to figure out if a message store is of type "Exchange (ActiveSync)" and NOT SMS or other E-Mail account type (POP3, IMAP etc).
I'm relying on the fact that the value returned for property PR_DISPLAY_NAME
for SMS Store is "SMS"
and for Exchange Store is "ActiveSync"
.
My question is, can I rely on these values to determine the message-store type? Is there a better way to achieve this?
Following is the pseudo-code depicting my logic:
bool isActiveSyncSet = areAnySyncAccountSet(); // I use Sync configuration service
// provider to check if any ActiveSync accounts are set.
// Initialize MAPI and fetch all stores
while(we_have_stores) {
// Open Current Store
openCurrentStore(¤tStore);
string storeName = fetchStoreName(currentStore); // using GetProps method fetch PR_DISPLAY_NAME
if(storeName == "SMS" ) continue;
if(isActiveSyncSet && storeName == "ActiveSync") {
// We got the Exchange Message Store
break;
} else {
// We have an E-Mail store but not an ActiveSync one
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
经过大量离线研究和测试在许多不同设备上返回的字符串[1],我得出的结论是:
人们可以依赖字符串
“ActiveSync” 为消息存储的
PR_DISPLAY_NAME
属性返回,以将其标识为 ActiveSync Exchange 消息存储。此消息存储在设备 UI 上显示为Outlook 电子邮件
。至少对于 6.1 和 6.5 设备来说是这样。我没有在Windows 7 手机上进行测试,因为那不是我的应用的目标受众[2]。希望这可以帮助任何做类似事情的人。
[1] 我测试的设备来自不同的供应商(HTC、LG、三星),因此我非常有信心这对于运行 Windows Mobile 6.1 或 6.5 操作系统的不起眼的设备也适用。
[2] 如果您拥有一部或有权使用一部 Windows 7 手机,请随时添加有关 Windows 7 手机的信息。 (我不确定这些手机上是否还有 MAPI)。
After a lot of offline research and testing the string returned on lots of different devices[1], I've come to the conclusion that:
One can rely on the string
"ActiveSync"
being returned forPR_DISPLAY_NAME
property of a message store to identify it as an ActiveSync Exchange Message store. This message store is displayed asOutlook E-Mail
on the device UI. This is true for 6.1 and 6.5 devices at least. I did not test on Windows 7 phone, as that is not the target audience for my app[2].Hope this helps anyone doing similar stuff.
[1] Devices that I tested were from different Vendors(HTC, LG, Samsung), so I'm pretty confident this should hold true for obscure devices running Windows Mobile 6.1 or 6.5 OS.
[2] Please feel free to add info about Windows 7 phones, if you have one or have access to one. (I'm not sure if they still have MAPI still on those phones).
我对 Windows Mobile 没有太多经验,但为什么不能检查 PR_MDB_PROVIDER 属性?
I don't have much experience with Windows Mobile, but why can't you check the PR_MDB_PROVIDER property?