Outlook API从outlook属性获取登录用户CountryOrRegion [英] Outlook API to get the logged on users CountryOrRegion from the outlook properties

查看:218
本文介绍了Outlook API从outlook属性获取登录用户CountryOrRegion的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Experts,

Hello Experts,

我正在寻找一个outlook / office365 API,它可以从Outlook属性中提供当前登录用户的国家或地区。

I am looking for an outlook/office365 API which can provide the current logged on users Country Or Region from the Outlook Properties.

我的意思是当我们从Outlook打开联系人属性时,我们会看到用户的所有细节,我们需要获取CountryOrRegion维护在用户个人资料中。

by outlook properties i mean when we open the contact properties from the Outlook we see all the details of the user, out of that we need to fetch the CountryOrRegion maintained in the user profile.

谢谢! 

推荐答案

您好,

$命名空间类的一个b $ b CurrentUser 属性r 将当前登录用户的显示名称作为 
收件人 对象。

收件人类r的AddressEntry
属性
eturns 
AddressEntry 对应于
已解析收件人的对象。
注意,访问  AddressEntry 属性强制解析未解析的收件人姓名。如果无法解析名称,则返回错误。如果收件人
已解决,
已解决
property is
True 。然后您可以使用以下方法:

The CurrentUser property of the Namespace class returns the display name of the currently logged-on user as a  Recipient object. The AddressEntry property of the Recipient class returns the  AddressEntry object corresponding to the resolved recipient. Note, acessing the  AddressEntry property forces resolution of an unresolved recipient name. If the name cannot be resolved, an error is returned. If the recipient is resolved, the Resolved property is True . Then you can use the following methods:

  -
GetContact
- r eturns a  ContactItem
表示
的对象 AddressEntry
,如果
AddressEntry 对应于Outlook联系人通讯簿(CAB)中的联系人。
ContactItem 对应于
的对象
AddressEntry 。返回 Null
Nothing 在Visual Basic中"如果
AddressEntry 对象与联系人通讯录中的联系人不对应。

 - GetContact - returns a  ContactItem object that represents the AddressEntry , if the AddressEntry corresponds to a contact in an Outlook Contacts Address Book (CAB). ContactItem object that corresponds to the AddressEntry . Returns Null ( Nothing in Visual Basic) if the AddressEntry object does not correspond to a contact in a Contacts Address Book.

  -
GetExchangeUser
- r eturns an  ExchangeUser
表示
的对象 AddressEntry
如果
AddressEntry 所属到交易所
AddressList 对象,例如Global
地址列表( GAL)并且对应于Exchange用户。请注意,您必须连接到Exchange服务器才能使用此方法。如果使用此方法传递的字符串具有与现有地址条目类似的字符集,则返回值可能包括
根据传递的字符串的第一个字母匹配的条目。

 - GetExchangeUser - returns an  ExchangeUser object that represents the AddressEntry if the AddressEntry belongs to an Exchange AddressList object such as the Global Address List (GAL) and corresponds to an Exchange user. Note, you have to be connected to the Exchange server to use this method. If a string passed using this method has a character set that is similar to an existing address entry, the return value may include an entry that is matched based on the first letter of the string passed.

Sub DemoAE() 
 Dim colAL As Outlook.AddressLists 
 Dim oAL As Outlook.AddressList 
 Dim colAE As Outlook.AddressEntries 
 Dim oAE As Outlook.AddressEntry 
 Dim oExUser As Outlook.ExchangeUser 
 Set colAL = Application.Session.AddressLists 
 For Each oAL In colAL 
 'Address list is an Exchange Global Address List 
 If oAL.AddressListType = olExchangeGlobalAddressList Then 
 Set colAE = oAL.AddressEntries 
 For Each oAE In colAE 
 If oAE.AddressEntryUserType = _ 
 olExchangeUserAddressEntry _ 
 Or oAE.AddressEntryUserType = _ 
 olExchangeRemoteUserAddressEntry Then 
 Set oExUser = oAE.GetExchangeUser 
 Debug.Print (oExUser.JobTitle) 
 Debug.Print (oExUser.OfficeLocation) 
 Debug.Print (oExUser.BusinessTelephoneNumber) 
 End If 
 Next 
 End If 

 Next 

End Sub


这篇关于Outlook API从outlook属性获取登录用户CountryOrRegion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆