Outlook 2010体验 之一 Exchange 2010和Outlook 2010中的 全局地址列表(GAL)照片


很多年以来,使用Exchange作为邮件服务器的邮件用户都希望在全局地址列表(GAL)收件人信息中显示该联系人的照片。尤其是在一个大型的组织或一个地理位置相对分散的团队中,这种做法是非常有用的,因为这样做能够将一个从来没有见过或者是不经常见面的人的长相和其姓名很好的联系起来。员工通常被要求在创建员工标示或ID时进行拍照,并将这些照片放在其内部网络内

在MSDN和其它地方,能够找到关于这个问题的变通解决方案或Outlook第三方插件的示例代码(Outlook的工作区或者第三方附加物中存在着一些问题,你也可以在MSDN中发现一些实例代码)。几年前,有一位IT人编写了ASP代码,其作用是基于从公司的LDAP目录中导入的活动目录(AD)中员工ID属性将员工照片显示在公司内部网络上根据从公司的LDAP导入的活动目录中员工的ID属性,来使得他们的照片显示在网络上。这个有趣的项目满足了一个IT人想成为代码开发者另一面。

幸运的是,你不必改变你自己来做这些事情。通过AD的帮助,Exchange 2010和Outlook 2010可以使这一任务变得非常快捷。AD引入(包括)一个“Picture”属性(我们将提到它的“ldapDisplayName”定义为“thumbnailphoto”)用于存储照片的缩略图,你可以很容易地导入照片,但不要(而不是)从你的20万像素的数码照相机中导入高清照片,其大小不超过10K,通过使用Exchange 2010的Import-RecipientDataProperty命令进行导入。

大多IT人员会问到的第一个问题就是——所有那些导入的照片将在我的AD中占有多少尺寸?这将导致怎样的AD复制行为(多大的AD复制量)?对象属性被限制在10K大小内,并且cmdlet不允许导入大于10K的照片。在这里以使用原始照片9K为例,你可以将其压缩为更小尺寸,例如大概2K-2.5K,在显示小图片时没有明显的质量下降。如果你在AD中存储用户证书和10K或更小缩略图在尺寸上是可进行比较的。存储10,000用户的缩略图差不多需要100Mb的空间,并且这些数据并不经常做改动。

注意:推荐缩略照片的分辨率为96×96像素

我们可以通过如下方法来进行添加照片的功能:

一、修改活动目录架构

首先,为了使缩略图能够后在全局编录中复制要对活动目录架构进行一次小小的修改

1、如果你没有在服务器上注册活动架构MMC控制台管理单元,那么你要再“运行”中输入:

Regsvr32 schmmgmt.dll

2、打开MMC控制台,添加活动目录架构管理单元

3、在活动目录架构管理单元中展开“属性”节点,定位到“thumbnailPhoto”属性。(在架构管理单元中是用“ldapDisplayName”标示属性的)

4、打开其“Properties(属性)”对话框,勾选“Replicate this attribute to the Global Catalog”项,再点击OK

clip_image002

图1:修改使“thumbnailPhoto”属性复制到全局编录

二、将图片导入活动目录

现在,你可以使用 “import-RecipientDataProperty”命令项将照片上传到活动目录中,例如:

Import-RecipientDataProperty -Identity “Bharat Suneja” -Picture -FileData ([Byte[]]$(Get-Content -Path “C:\pictures\BharatSuneja.jpg” -Encoding Byte -ReadCount 0))

译者注:将Bharat Suneja用户的图片C:\pictures\BharatSuneja.jpg导入AD中。

若要进行批量操作,你可以使用Get-Mailbox命令和自定义的筛选器(或者使用“Get-DistributionGroupMember”命令来对一个通讯组的成员进行操作),结合一个foreach循环获取邮箱。此外,也可以通过一个CSV/TXT文件获取用户名或相应缩略图路径。

三、在Outlook 2010中显示缩略图

现在,让我们启动Outlook 2010来看一下效果

打开通讯簿/全局地址列表中收件人的属性

clip_image004

图2:缩略图显示在全局地址列表中收件人的属性中

当接收到一封来自已被植入缩略图的用户发送来的邮件是,缩略图将显示在邮件预览中。

clip_image005

图3:在消息中显示缩略图

在创建一个邮件时,当你将鼠标移动到收件人地址上时,缩略图也会被显示出来

clip_image006

图4:在创建邮件时,收件人的缩略图被显示

Outlook还可以在其它位置显示照片,例如:在后台帮助视图的账户设置部分中显示。

Outlook团队的更新

来自Outlook团队的朋友们要求我们指出新版的Oulook社会连接器也显示GAL照片,同时也会在联系人文件夹和社会网络中显示。

全局地址列表照片和脱机地址簿

在活动目录中上传照片后,还需要更新Outlook脱机地址列表(OAB)中缓存的内容。可以使用以下方法更新默认脱机地址列表。

Update-OfflineAddressBook “Default Offline Address Book”

在Exchange 2010中,一个OAB的属性可以被自定义。通过使用OAB的ConfiguredAttributes属性进行操作(参考Set-OfflineAddressBook命令)。ConfiguredAttributes属性默认被勾选,可以按照需求对其进行添加或移除的修改操作。

默认情况下,thumbnailPhoto在OAB中作为一个标示性属性存在的。这意味着该属性值不能(没有)被复制到OAB,相反,它简单地表明客户端应从活动目录获取值。如果一个Outlook客户端(包括Outlook Anywhere客户端通过HTTPS连接Exchange)能访问AD,缩略图将被下载和显示。当离线时,缩略图将不能被下载

标示性属性的另一个例子就是UmspokenName。

通过以下命令行能够列出默认脱机地址列表中的所有属性:

(Get-OfflineAddressBook “Default Offline Address Book”).ConfiguredAttributes

对于真正的脱机使用,可以修改OAB的ConfiguredAttributes,使thumbnailPhoto有一个属性值。通过该操作以及OAB更新后,照片被加到OAB中。更新取决于用户的数量和缩略图的尺寸,这将大大增加到OAB的复制(按照用户数量和上传照片的体积,这将明显增加OAB的体积)。在一个实验环境中彻底测试这一个方案,你可能将不想用这种方式为离线客户提供全局地址列表照片服务。

为了阻止Outlook缓存不显示缩略图(记住,照片没有在OAB中——仅保存了一个从AD获取照片的指针),可以通过如下命令删除OAB中ConfiguredAttributes的thumbnailPhoto属性:

$attributes = (Get-OfflineAddressBook “Default Offline Address Book”).ConfiguredAttributes

$attributes.Remove(“thumbnailphoto,Indicator”)

Set-OfflineAddressBook “Default Offline Address Book” -ConfiguredAttributes $attributes

附原文:

GAL Photos in Exchange 2010 and Outlook 2010

Over the years, displaying recipient photographs in the Global Address List (GAL) has been a frequently-requested feature, high on the wish lists of many Exchange folks. Particularly in large organizations or geographically dispersed teams, it’s great to be able to put a face to a name for people you’ve never met or don’t frequently have face time with. Employees are commonly photographed when issuing badges/IDs, and many organizations publish the photos on intranets.

There have been questions about workarounds or third-party add-ins for Outlook, and you can also find some sample code on MSDN and elsewhere. A few years ago, an IT person wrote ASP code to make employee photos show up on the intranet based on the Employee ID attribute in Active Directory (AD) – which was imported from the company’s LDAP directory. A fun project to satisfy the coder alter-ego of the IT person.

Luckily, you won’t need to turn to your alter-ego to do this. Exchange 2010 and Outlook 2010 make this task a snap, with help from AD. AD includes the Picture attribute (we’ll refer to it using its ldapDisplayName: thumbnailPhoto) to store thumbnail photos, and you can easily import photos— not the high-res ones from your 20 megapixel digital camera, but small, less-than-10K-ish ones, using Exchange 2010’s Import-RecipientDataProperty cmdlet.

The first question most IT folks would want to ask is— What’s importing all those photos going to do to the size of my AD database? And how much AD replication traffic will this generate? The attribute is limited to 10K in size, and the cmdlet won’t allow you to import a photo that’s larger than 10K. The original picture used in this example was 9K, and you can compress it further to a much smaller size – let’s say approximately 2K-2.5K, without any noticeable degradation when displayed at the smaller sizes. If you store user certificates in AD, the 10K or smaller size thumbnail pictures are comparable in size. Storing thumbnails for 10,000 users would take close to 100 Mb, and it’s data that doesn’t change frequently.

Note: The recommended thumbnail photo size in pixels is 96×96 pixels.

With that out of the way, let’s go through the process of adding pictures.

A minor schema change

First stop, the AD Schema. A minor schema modification is required to flip the thumbnailPhoto attribute to make it replicate to the Global Catalog.

  1. If you haven’t registered the Schema MMC snap-in on the server you want to make this change on, go ahead and do so using the following command:

Regsvr32 schmmgmt.dll

  1. Fire up a MMC console (Start -> Run -> MMC) and add the Schema snap-in
  2. In the Active Directory Schema snap-in, expand the Attributes node, and then locate the thumbnailPhoto attribute. (The Schema snap-in lists attributes by its ldapDisplayName).
  3. In the Properties page, select Replicate this attribute to the Global Catalog, and click OK.
    clip_image001
    Figure 1: Modifying the thumbnailPhoto attribute to replicate it to Global Catalog

Loading pictures into Active Directory

Now you can start uploading pictures to Active Directory using the Import-RecipientDataProperty cmdlet, as shown in this example:

Import-RecipientDataProperty -Identity “Bharat Suneja” -Picture -FileData ([Byte[]]$(Get-Content -Path “C:\pictures\BharatSuneja.jpg” -Encoding Byte -ReadCount 0))

To perform a bulk operation you can use Get-Mailbox cmdlet with your choice of filter (or Get-DistributionGroupMember if you want to do this for members of a distribution group), and pipe the mailboxes to a foreach loop. You can also retrieve the user name and path to the thumbnail picture from a CSV/TXT file.

Thumbnails in Outlook 2010

Now, let’s fire up Outlook 2010 and take a look what that looks like.

In the Address Book/GAL properties for the recipient

clip_image003
Figure 2: Thumbnail displayed in a recipient’s property pages in the GAL

When you receive a message from a user who has the thumbnail populated, it shows up in the message preview.

clip_image005[1]
Figure 3: Thumbnail displayed in a message

While composing a message, the thumbnail also shows up when you hover the mouse on the recipient’s name.

clip_image006[1]
Figure 4: Recipient’s thumbnail displayed on mouse over when composing a message

There are other locations in Outlook where photos are displayed. For example, in the Account Settings section in the Backstage Help view.

Update from the Outlook team

Our friends from the Outlook team have requested us to point out that the new Outlook Social Connector also displays GAL Photos, as well as photos from Contacts folders and from social networks, as shown in this screenshot.

clip_image007
Figure 5: Thumbnail photos displayed in the People Pane in the Outlook Social Connector

More details and video in Announcing the Outlook Social Connector on the Outlook team blog.

GAL Photos and the Offline Address Book

After you’ve loaded photos in Active Directory, you’ll need to update the Offline Address Book (OAB) for Outlook cached mode clients. This example updates the Default Offline Address Book:

Update-OfflineAddressBook “Default Offline Address Book”

In Exchange 2010, the attributes in an OAB can be customized. This is done using the ConfiguredAttributes property of the OAB (see Set-OfflineAddressBook cmdlet). ConfiguredAttributes is populated with the default set of attributes, and you can modify it to add/remove attributes as required.

By default, thumbnailPhoto is included in the OAB as an Indicator attribute. This means the value of the attribute isn’t copied to the OAB— instead, it simply indicates the client should get the value from AD. If an Outlook client (including Outlook Anywhere clients connected to Exchange using HTTPS) can access AD, the thumbnail will be downloaded and displayed. When offline, no thumbnail downloads. Another example of an Indicator attribute is the UmSpokenName.

You can list all attributes included in the default OAB using the following command:

(Get-OfflineAddressBook “Default Offline Address Book”).ConfiguredAttributes

For true offline use, you could modify the ConfiguredAttributes of an OAB to make thumbnailPhoto a Value attribute. After this is done and the OAB updated, the photos are added to the OAB (yes, all 20,000 photos you just uploaded…). Depending on the number of users and sizes of thumbnail photos uploaded, this would add significant bulk to the OAB. Test this scenario thoroughly in a lab environment— chances are you may not want to provide the GAL photo bliss to offline clients in this manner.

To prevent Outlook cached mode clients from displaying thumbnail photos (remember, the photo is not in the OAB— just a pointer to go fetch it from AD), you can remove the thumbnailPhoto attribute from the ConfiguredAttributes property of an OAB using the following command:

$attributes = (Get-OfflineAddressBook “Default Offline Address Book”).ConfiguredAttributes
$attributes.Remove(“thumbnailphoto,Indicator”)
Set-OfflineAddressBook “Default Offline Address Book” -ConfiguredAttributes $attributes

Bharat Suneja

Published Wednesday, March 10, 2010 4:51 PM by Exchange
Filed Under: Administration, Outlook, Role: Client Access, Exchange 2010