CHANGING BACKGROUND DESIGN/STYLE/COLOR OF SELECTED BUSINESS CARDS

  • Thread starter Thread starter FARAZ QURESHI
  • Start date Start date
F

FARAZ QURESHI

How can one change the background design/color for the selected business
cards together, instead of opening each and double clicking it's design?

Quite a number of beautiful templates for Outlook 2007 Business Cards have
been Downloaded but I want a shortcut to apply such a sample on other cards
as well, instead of Copying such a Card for every existing contact and
refilling the data.

A suggestion by Roady [MVP] as to seek advice from you specialists is surely
appreciated.
 
Business card layout is done using XML. Each contact item has a
BusinessCardLayoutXml property that can be set to the XML you desire for
your card layout. The XML is supplied as a string to that property for each
contact.

Do you have the XML for whatever you want to use as a business card layout?
 
I sure do appreciate your providing such a guidance. However, how to find out
the XML of a sample card and to change the BusinessCardLayoutXml property of
all cards in once?

Thanx again
--

Best Regards,
FARAZ A. QURESHI


Ken Slovak - said:
Business card layout is done using XML. Each contact item has a
BusinessCardLayoutXml property that can be set to the XML you desire for
your card layout. The XML is supplied as a string to that property for each
contact.

Do you have the XML for whatever you want to use as a business card layout?
 
Let's assume that the sample business card you want is selected in the
current view (ActiveExplorer.Selection.Item(1)). Let's also assume that all
the contacts you want to change are in the default Contacts folder. VBA code
to handle that would look something like this, this code as is would only
run without errors in the Outlook VBA project:

Public Sub ConvertToDesiredBusinessCard()
Dim obj As Object
Dim oFolder As Outlook.MAPIFolder
Dim oContact As Outlook.ContactItem
Dim oModel As Outlook.ContactItem
Dim colItems As Outlook.Items
Dim i As Long
Dim lCount As Long
Dim sXML As String

Set oFolder = Application.Session.GetDefaultFolder(olFolderContacts)
Set colItems = oFolder.Items

Set oModel = Application.ActiveExplorer.Selection.Item(1)

sXML = oModel.BusinessCardLayoutXml

lCount = colItems.Count
For i = 1 To lCount
Set obj = colitems.Item(i)
If (obj.Class = olContact) Then
Set oContact = obj
oContact.BusinessCardLayoutXml = sXML
oContact.Save
End If
Next
End Sub
 
YAHOO!!!
XCLent Code! Sure is a treasure! Thanx Ken! However, any idea How to change
the Fonts of the "Full Name" field?
--

Best Regards,
FARAZ A. QURESHI


Ken Slovak - said:
Let's assume that the sample business card you want is selected in the
current view (ActiveExplorer.Selection.Item(1)). Let's also assume that all
the contacts you want to change are in the default Contacts folder. VBA code
to handle that would look something like this, this code as is would only
run without errors in the Outlook VBA project:

Public Sub ConvertToDesiredBusinessCard()
Dim obj As Object
Dim oFolder As Outlook.MAPIFolder
Dim oContact As Outlook.ContactItem
Dim oModel As Outlook.ContactItem
Dim colItems As Outlook.Items
Dim i As Long
Dim lCount As Long
Dim sXML As String

Set oFolder = Application.Session.GetDefaultFolder(olFolderContacts)
Set colItems = oFolder.Items

Set oModel = Application.ActiveExplorer.Selection.Item(1)

sXML = oModel.BusinessCardLayoutXml

lCount = colItems.Count
For i = 1 To lCount
Set obj = colitems.Item(i)
If (obj.Class = olContact) Then
Set oContact = obj
oContact.BusinessCardLayoutXml = sXML
oContact.Save
End If
Next
End Sub
 
Looking at the card XML schema I see a "size" attribute no font or typeface
information available.

You can download the Office2007XMLSchema.exe package from the Office
developer Web site, that has the schemas for business cards, the ribbon,
form regions and other Office 2007 XML schemas.
 
Thanx Ken sure am gonna try it right away!
Running the previous code did change the order of presentation of all the
contacts to that of the currently one but the background image remained the
same of each!

Any idea How to change the background picture of ALL the EBCs to:
"C:\Documents and Settings\FARAZ\My Documents\My Pictures\EBC_Background.jpg"?

All the inconveniences regretted, but your help sure is the only helpful I
have till found!
--

Best Regards,
FARAZ A. QURESHI


Ken Slovak - said:
Looking at the card XML schema I see a "size" attribute no font or typeface
information available.

You can download the Office2007XMLSchema.exe package from the Office
developer Web site, that has the schemas for business cards, the ribbon,
form regions and other Office 2007 XML schemas.
 
You need to download that XML schema and to view the XML you're using. Once
you have the XML store the string and review it. There's an image tag
available for changing the background image.
 
How to download the schema of a card?

Suppose I download an EBC template, how can I view it's XML schema and
compare with an existing EBC's?

Last I time had carried out the exercise by simply:
1. Selecting the desired card;
2. Pressing Alt+F11;
3. Pasting your suggested XML code in the VBA Editor; and
4. Hitting the Play/Run Button.

But I don't know how to view the XML properties of an existing/downloaded EBC.

Please help.

Thanx again!

--

Best Regards,
FARAZ A. QURESHI


Ken Slovak - said:
You need to download that XML schema and to view the XML you're using. Once
you have the XML store the string and review it. There's an image tag
available for changing the background image.
 
If you select an item with a business card in a folder view (Explorer) you
can do type this in the Immediate window in your Outlook VBA project to see
the business card XML for that contact item:

? Application.ActiveExplorer.Selection(1).BusinessCardLayoutXml

If you open an item with a business card then to view that XML use this:

? Application.ActiveInspector.CurrentItem.BusinessCardLayoutXml

In both cases when you press Enter the XML will be outputted to the
Immediate window where you can copy it and paste the XML into Notepad to
study.

That in combination with the XML schema for business cards will let you know
what the current card is and what properties are available to you to
customize the business card XML.
 
Thanx Ken!
XCLent one again!
BTW! Any idea how 2 change the background of every card to a single image
located at C:\abc.jpg?

--
Best Regards,
FARAZ A. QURESHI


Ken Slovak - said:
If you select an item with a business card in a folder view (Explorer) you
can do type this in the Immediate window in your Outlook VBA project to see
the business card XML for that contact item:

? Application.ActiveExplorer.Selection(1).BusinessCardLayoutXml

If you open an item with a business card then to view that XML use this:

? Application.ActiveInspector.CurrentItem.BusinessCardLayoutXml

In both cases when you press Enter the XML will be outputted to the
Immediate window where you can copy it and paste the XML into Notepad to
study.

That in combination with the XML schema for business cards will let you know
what the current card is and what properties are available to you to
customize the business card XML.
 
Using the business card XML you would use the <img> tag, which is shown in
the schema for business cards. Have you downloaded and looked at that schema
at all?

You could also use the object model for a ContactItem and call the
AddBusinessCardLogoPicture() method for all the contacts in your folder.
Have you looked at the object browser for the Outlook ContactItem object
model at all?
 
Thanx Ken,

The <img> tag doesn't display an exact address of the image so as to apply
the same on other as well and besides after devising a new schema or card how
to apply it on others?

However, I was also quite puzzled how 2 extract the XML. I:
1. selected a preferred card;
2. hit Alt+F11;
3. in "ThisOutlookSession" I pasted the code:
Public Sub GetXML()
Dim obj As Object
Dim oFolder As Outlook.MAPIFolder
Dim oContact As Outlook.ContactItem
Dim oModel As Outlook.ContactItem
Dim colItems As Outlook.Items
Dim i As Long
Dim lCount As Long
Dim sXML As String
Set oFolder = Application.Session.GetDefaultFolder(olFolderContacts)
Set colItems = oFolder.Items
Set oModel = Application.ActiveExplorer.Selection.Item(1)
sXML = oModel.BusinessCardLayoutXml
End Sub

4. then in the immediate window I pasted the following line and hitted enter:
? Application.ActiveExplorer.Selection(1).BusinessCardLayoutXml

5. The XML code generated in the immediate window was:
<card
xmlns="http://schemas.microsoft.com/office/outlook/12/electronicbusinesscards"
ver="1.0" layout="left" bgcolor="ffffff"><img xmlns="" align="tleft"
area="32" use="photo"/><fld xmlns="" prop="name" align="left" dir="ltr"
style="b" color="000000" size="10"/><fld xmlns="" prop="org" align="left"
dir="ltr" color="000000" size="8"/><fld xmlns="" prop="title" align="left"
dir="ltr" color="000000" size="8"/><fld xmlns="" prop="dept" align="left"
dir="ltr" color="000000" size="8"/><fld xmlns="" prop="blank" size="8"/><fld
xmlns="" prop="telwork" align="left" dir="ltr" color="000000" size="8"/><fld
xmlns="" prop="email" align="left" dir="ltr" color="000000" size="8"/><fld
xmlns="" prop="addrwork" align="left" dir="ltr" color="000000" size="8"/><fld
xmlns="" prop="blank" size="8"/><fld xmlns="" prop="blank" size="8"/><fld
xmlns="" prop="blank" size="8"/><fld xmlns="" prop="blank" size="8"/><fld
xmlns="" prop="blank" size="8"/><fld xmlns="" prop="blank" size="8"/><fld
xmlns="" prop="blank" size="8"/><fld xmlns=""
prop="blank" size="8"/></card>

Thanx again, Pal!!!

--
Best Regards,
FARAZ A. QURESHI


Ken Slovak - said:
Using the business card XML you would use the <img> tag, which is shown in
the schema for business cards. Have you downloaded and looked at that schema
at all?

You could also use the object model for a ContactItem and call the
AddBusinessCardLogoPicture() method for all the contacts in your folder.
Have you looked at the object browser for the Outlook ContactItem object
model at all?
 
That XML just uses the contact photo I believe.

You're going to have to research this yourself and maybe download various
sample business cards and examine how they are set up. I haven't really done
much with business cards so I'm not exactly sure how the images are set up.
 
Thanx anyway my dear 4 supporting for so long.

Do wish me luck in success of finding the goal in researching myself!

Thanx agan!!!!
--

Best Regards,
FARAZ A. QURESHI


Ken Slovak - said:
That XML just uses the contact photo I believe.

You're going to have to research this yourself and maybe download various
sample business cards and examine how they are set up. I haven't really done
much with business cards so I'm not exactly sure how the images are set up.
 
Back
Top