The only thing I can say about the perf issues are to see what happens in
usage. Or you can simulate a load of many users on a test server if you have
one.
A wild guess here, but what is the contents of Row(1)? Is it an error
string? I usually check for things like that if the field can possibly be
created in the item as a MAPI property if it has been initialized.
I don't follow what you are saying about the company name with (Email) after
it and what you actually have in the CompanyName Outlook property. One thing
I do know is that Outlook won't resolve a name unless it has a valid
electronic address, which can be an email address or a fax number. I bet the
restriction is doing the same thing on a MAPI level, but Dmitry would know
if that's true.
John Riddle said:
Ken,
Thanks for all your help. Actually, I have already set my view cache to 8
hours because we do a lot of folder restrictions and we only have a 2.4Ghz
server with 1mb of RAM running Small Business Server 2003. I've set the 3GB
switch as well and everything seems to hum along great.
However, if people are constantly creating new contacts (which they do
sometimes a hundred a day) and filling in the company field with the
auto-complete function that I'm trying to create, I was wondering if this
restriction will be cached and re-used for each contact or if a new
restriction would be created each time a user types in company info.
I've gotten the method that you described to work as long as the the
Company Item has a Fax # or an Email Address (a few have Faxes, but none
have Email Addresses because they are custom item created to hold company
info, not personal info). For most, it does not resolve a name because there
is no email or fax. Even though, all items do have a PR_DISPLAY_NAME
property that I want to use. Also, the field is populated with "Company Name
(Business Fax)", instead of just plain "Company Name". Here is my code
behind an Outlook Contact Item:
RES_PROPERTY = 4
RELOP_EQ = 4
Sub Item_PropertyChange(ByVal PropName)
dim Columns(1)
dim Row
dim Filter 'As Redemption.TableFilter
dim Restr 'As Redemption.RestrictionProperty
dim Table 'As Redemption.MAPITable
Select Case PropName
Case "CompanyName"
PR_DISPLAY_NAME = &H3001001E
PR_COMPANY_NAME = &H3A16001E
PR_ANR = &H360C001E
set Table = CreateObject("Redemption.MAPITable")
Table.Item = Application.Session.AddressLists.Item("Companies").AddressEntries
'set up the restriction
set Filter = Table.Filter
Filter.Clear
set Restr = Filter.SetKind(RES_PROPERTY)
Restr.ulPropTag = PR_ANR
Restr.Relop = RELOP_EQ
Restr.lpProp = Item.CompanyName
Filter.Restrict
'restriction is done, read the data
Columns(0) = PR_DISPLAY_NAME
Columns(1) = PR_COMPANY_NAME
Table.Columns = Columns
Table.GoToFirst
Row = Table.GetRow
if Not IsEmpty(Row) Then
Item.CompanyName = Row(0)
End If
End Select
End Sub
I've tried changing the line: Item.CompanyName = Row(1), but it gives me a
Type Mis-match error "Unable to coerce parameter value. Unable to translate
your string."
Is there a way I can use this code to return just the FullName or the
CompanyName (either one because their both the same for my company items.