Text not appearing in a textbox for Outlook 2003 custom form

J

John Riddle

Hello All,

I've searched high and low for a solution to this. I have a custom contact
form that we have been using since Outlook 2000 (we're now using outlook
2003). There are many custom fields on this form, but one in particular we
do all of our searching on. Its a "Resume" field (standard textbox). It has
always worked perfectly. The problem now is that since converting our entire
organization to Outlook 2003, when we do a search for words in a contact's
"resume" field, the search will produce the correct number of results, but
when opening the contacts to view their resume, the field is blank. If I add
the "Resume" field to the folder view and view the contact without opening
it, I can see that the field is populated just find with the information,
however when opening the item, the field is empty.

This only occurs with about 20% of the items opened.
On on of our users, he could see almost none of the "Resumes" returned after
doing a search. I realized he was using "Favorites" folders and removed all
entries and told him not to mess with "Favorites" folders. This seemed to
bring him up to speed with all the other users (only about 20% of the items
show an empty "Resume" field for him now).
I've cleared the forms cache for all users. I've deleted the frmcache.dat
file and all other folders in the containing folder with no benefit.
I've tried re-creating the form from scratch in Outlook 2003, publishing it
under a different name and then converting all (20,000) items in the folder
to use the new forms message class with no benefit.

I'm at my wits end! Has ANYONE seen this type of behavior before and more
importantly can anyone tell me how to fix it???

Thanks in advance,

John
 
S

Sue Mosher [MVP-Outlook]

FWIW, there is now a hotfix for the forms cache problem with forms in PF
Favorites folders. See http://www.slipstick.com/dev/index.htm

The only time I've seen fields turn up blank is when the form is too
complex, i.e. it has too many fields or formulas, and then it happens all
the time on a particular item.

How are you performing this search?
 
J

John Riddle

Sue,

Thank you very much for the response. I've tested a few other things based
on what you've said:

1. I went to the page you specified and clicked on the two hotfix links. The
problems described were not what I was experiencing.
2. I created a new form with only the "Resume" field added. (to ensure that
my form was not over complicated or too many fields) And then published it
to another folder. Moved a few of the problem contacts into it. Tried to
open the form (after adding the field to the folder). Still no luck.

I'm REALLY frustrated with this. I've spent weeks migrating us from Exchange
5.5 to Exchange 2003 and from Outlook 2000 to Outlook 2003. It is beginning
to appear that I'll have to move everything back to the old set-up as there
appears to be no answer to this problem.

Any other ideas?

John
 
J

John Riddle

Sue,

Okay, I've found the problem. The solution, however may be much more
complicated. It seems that there is too much text in the "Resume" field. By
adding a column "size" to the folder view and opening items larger than 36K
(no Resume text displayed) and then opening items smaller than 36K (Resume
text displays for all items). This seems to have identified the problem, but
how do I fix this? I can search on the text in the resume and the proper
search results appear. However, when opening up the items listed in the
results, we need to be able to see the data. Can anyone suggest a work
around? I can place a button on the form to launch NotePad and somehow
retrieve the data outside the form from the exchange server directly? The
data is obviously in the Exchange server. Is there ANY way at all to
retrieve and view it (either within or outside the custom form)? Extended
MAPI?

I don't know anything about about Extended MAPI or really any other method
to retrieve this data outside the standard Outlook Object Model, so if you
have a suggestion, a code sample would be very much appreciated.

Thanks,

John
 
S

Sue Mosher [MVP-Outlook]

36k might just be over the size limit for Outlook items. There isn't an
article for OL2003 yet that I can see, but the one for OL2002 tells the
story well enough: http://support.microsoft.com/?kbid=290781 .

I'm surprised, though, that the search is working. Do you see any difference
between a straight online session and using Cached Exchange mode? Ken Slovak
has been documenting a bunch of cached mode issues.

If you want to see if Extended MAPI can get it, get a copy of Outlook Spy
from http://www.dimastr.com and try to look at the field with the IMessage
interface (Fields collection).

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
J

John Riddle

Sue,

Thanks for responding. Yes, I have Outlook Spy and when I click the IMessage
icon, in the table for the field, it says MAPI_E_NOT_ENOUGH_MEMORY under the
"value" column. However, in the area to the right of the table where it says
"value", if I click on the folder icon next to it, it pops up a window that
has all the text in both HEX and plain text mode. I can copy the entire
contents back into the field and save it, creating an attachment based on
the contents of the field and then when re-opening the item, take the text
from the attachment and re-populate the field.

All the data is in the field, its just that Outlook will not read it if it
is above a certain size. I was actually aware of the size limitation when I
created the internal application that we use here, however in testing I put
very large amounts of data in the field and had no problems at all. It was
only after upgrading to OL2003/Exchange 2003 that we couldn't read the data
anymore.

There is no difference between on-line and cached mode.

After not receiving any responses on this issue after several days, I posted
it as a new question looking for an Extended MAPI Guru. I got the following
response from "Tim" through private email.

John,

Hi, I encountered a similar bug/problem with Outlook's UserProperty object.
If the underlying property was a string and the data was larger than 32K
(approx) then the call to the Value property succeeded but returned an empty
string. The data existed in the underlying custom property but it couldn't
be retrieved. (Actually, I could retrieve the data as long as I didn't
release the UserProperty object. Once I closed and reopened it, I could no
longer retrieve the data.). I believe that this bug affects all versions of
Outlook XP and most versions ( initial release, sp1 and sp2) of Outlook 2K.


Anyway...To open a property using IMAPIProp's OpenProperty method, do the
following:

Call the Outlook Item's MAPIOBJECT method and query the returned IUnknow
interface pointer for an IMessage or IMAPIProp interface. (Be careful, CDO
for Exchange also has an IMessage interface. The MAPI IMessage interface is
derived from IMAPIProp. Look for this interface in MSDN.)
Call OpenProperty and ask for an IStream interface pointer (Unfortunately
the MAPI version of this interface doesn't support reporting the size of the
property's data).
Retrieve the data from the ISteam interface pointer (in chunks) and
reassemble it (I used the CComBSTR class to hold and append the chunks of
data.)


You can use the attached function as a guide. It takes a UserProperties
object and a string (the name of the property) and returns the property's
text. It retrieves the contents using the IMAPIProp::OpenPropertyMethod.
The code uses ATL (CComDispatchDriver, CComBSTR, etc and extended MAPI. The
IncMapi.h header file includes and links in the required MAPI headers and
libraries and defines smart pointers for common MAPI objects.

I hope this helps.


Tim

I'm currently working on implementing some sample code that he gave me. It's
a daunting task for someone who doesn't know Extended MAPI or even C++. I'm
sure I'll work it out though. He was very helpful.

John





After not getting a response on
 
S

Sue Mosher [MVP-Outlook]

You might also consider using Redemption, which wraps around Extended MAPI
and might provide a way to do this.

I suspect the issue is that Outlook 2003/Exchange 2003 add full Unicode
support, so the size of your text may have doubled. Keep us posted.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
K

Ken Slovak - [MVP - Outlook]

According to Dmitry on his Redemption Web site a MAPI call to a table can
only retrieve about 32K worth of information in one go, depending on the
service provider: "Another limitation in case of the Exchange provider is
the size of the returned data - Exchange provider limits it to around 32 kB
in a single call; that means you will never be able to retrieve message body
if its size is greater than 32 kB and if you request too many rows, Exchange
will return less rows than requested to keep the size of the returned data
below 32 kB."

The use of Unicode would of course double the size of a message body as Sue
mentioned too.
 
K

Ken Slovak - [MVP - Outlook]

The size limitation is for retrieving data using a MAPITable. No such limit
exists for retrieving individual fields from items (Messages). You can get
the EntryID and LongTermEntryID for each item using a MAPITable plus various
other data and once you have identified those items you are interested in
you can use the id's to get the individual items. From there you just get
the field you are interested in.
 
J

John Riddle

Ken,

Do you have a sample that might demonstrate this for retreiving data in a
custom field of a contact item? I really appreciate your help.

Thanks,

John
 
K

Ken Slovak - [MVP - Outlook]

Not in Extended MAPI, I don't code in that. Here's something in a
combination of Redemption, CDO 1.21 and Outlook object model code.

The code first gets a MAPITable with the long and short-term EntryID's for
specified items filtered from a collection (reminder set). Then it retrieves
the original items using the returned EntryID's. From there it gets a named
property value. It doesn't show the instantiation of the Redemption objects
and an Outlook.MAPIFolder object is passed into the code as oFolder.

PR_Reminder is the property tag for a reminder for that specific folder,
gotten using the GetIDsFromNames method of a Redemption item in that folder.
I'm not showing that code either here.

Const MAPI_NAMED_PROP = "{00020329-0000-0000-C000-000000000046}"
Dim PR_Reminder As Long
Dim blnFound As Boolean
Dim varColumns(1) As Variant
Dim Rows As Variant
Dim Row As Variant
Dim strEntryID As String
Dim strEntryIDLongTerm As String
Dim rdmFilter As Redemption.TableFilter
Dim rdmTable As Redemption.MAPITable
Dim rdmRestrictProp As Redemption.RestrictionAnd
Dim rdmRes1 As Redemption.RestrictionProperty
Dim rdmRes2 As Redemption.RestrictionNot
Dim rdmRes3 As Redemption.RestrictionContent
Dim objMessage As MAPI.Message
Dim lngRowCount As Long
Dim lngRetrieve As Long
Dim i As Long

On Error Resume Next

With oFolder
PR_Reminder = GetReminderUID(.EntryID, .StoreID)
End With

With rdmTable
If PR_Reminder <> 0 Then
.Item = oFolder.Items
Set rdmFilter = rdmTable.Filter
With rdmFilter
.Clear
Set rdmRestrictProp = .SetKind(RES_AND)
With rdmRestrictProp
Set rdmRes1 = .Add(RES_PROPERTY)
With rdmRes1
.ulPropTag = PR_Reminder
.relop = RELOP_EQ
.lpProp = True
End With
Set rdmRes2 = .Add(RES_NOT)
Set rdmRes3 = rdmRes2.SetKind(RES_CONTENT)
With rdmRes3
.ulFuzzyLevel = FL_FULLSTRING
.ulPropTag = CdoPR_SUBJECT
.lpProp = NEW_ITEM_SUBJECT
End With
End With

.Restrict
End With

varColumns(0) = PR_ENTRYID
varColumns(1) = PR_LONGTERM_ENTRYID_FROM_TABLE

.Columns = varColumns
.GoToFirst

lngRowCount = .RowCount
If lngRowCount > 50 Then
lngRetrieve = 50
lngRowCount = lngRowCount - 50
Else
lngRetrieve = lngRowCount
lngRowCount = 0
End If

If lngRetrieve <> 0 Then
Do
Rows = .GetRows(lngRetrieve)
For i = LBound(Rows) To UBound(Rows)
strEntryID = ""
strEntryIDLongTerm = ""
Set objMessage = Nothing

Row = Rows(i)
If Not IsEmpty(Row) Then
strEntryID = rdmUtils.HrArrayToString(Row(1))
Err.Clear
If strEntryID = "" Then
strEntryID = rdmUtils.HrArrayToString(Row(0))
End If

With oFolder
Set objMessage = g_objCDO.GetMessage(strEntryID, .StoreID)
If Not objMessage Is Nothing Then
ProcessReminderItem(strEntryID, .StoreID)
Else
Err.Clear
End If
End With
End If
Next i

If lngRowCount > 50 Then
lngRetrieve = 50
lngRowCount = lngRowCount - 50
Else
lngRetrieve = lngRowCount
lngRowCount = 0
End If
Loop Until lngRowCount = 0
End If
 
G

Guest

Ken,

Thanks. After looking at your answer, I was somewhat overwhelmed. Decided to hold of on getting into Redemption til I had some time on my hands. This weekend, however I did decide to give it a go and was able to do exactly what I need (Could grab the text from a field even when holding more than a mb of text) and place it in the custom field on my form no problems at all.

Here's the only code in my item_open :

dim utils, Candidate, PrResume, theResume
set utils = CreateObject("Redemption.MAPIUtils")
set Candidate = Item
PrResume = &H8239001E
theResume = utils.HrGetOneProp(Candidate.MAPIOBJECT, PrResume)
Item.UserProperties("Resume") = theResume

After diving into Redemption and solving this problem and several others that were vexing me (populating a combobox with the names of contacts in PF's holding more than 15,000 contacts in under a couple seconds), I'm really excited about all the possibilities that Redemption offers a VB guy (just about a year experience) like me.

I've posted another question starting a new thread for another issue that I thought I was forced to accept, but now I'm hopeful I do not. Could you look at that one for me?

Thanks Sue. Thanks Ken.

John
 
K

Ken Slovak - [MVP - Outlook]

Two things to bear in mind when using MAPITable filters that I've found.

One, the property tag for a named property may be different for different
folders and certainly for folders in different InfoStores. And they would be
different for different transports (Exchange, no Exchange). So always get
the property tag you need on the fly or get it once and store it for each
folder in a collection keyed by folder EntryID for each Outlook session.

In the example I showed I use a procedure to get the property tag for the
reminder flag and pass that procedure the EntryID and StoreID of the folder
I'm looking at. Dmitry has examples on the Redemption Web site of how to get
the property tag.

Second, if you are working with properties that are either named properties
or properties that aren't always included in an item (such as the reminder
flag for example) then use a clause in the filter that checks to see if the
property exists in the item. You can see examples of that both on Dmitry's
Web site and if you use OutlookSpy you can see that for the search folder
conditions for the Reminders folder.

Using MAPITables to get items is blazingly fast. This is just an estimate
but I consider a CDO 1.21 search using a MessageFilter to be about an order
of magnitude faster than an Outlook object model search using a Restricted
Items collection and SetColumns. MAPITable's seem to be an order of
magnitude faster than using CDO, so effectively you are getting results
about 100 times faster than using the Outlook object model. Setting up the
table filter takes quite a few lines of code but once it's all set up the
execution time is excellent.




John Riddle said:
Ken,

Thanks. After looking at your answer, I was somewhat overwhelmed. Decided
to hold of on getting into Redemption til I had some time on my hands. This
weekend, however I did decide to give it a go and was able to do exactly
what I need (Could grab the text from a field even when holding more than a
mb of text) and place it in the custom field on my form no problems at all.
Here's the only code in my item_open :

dim utils, Candidate, PrResume, theResume
set utils = CreateObject("Redemption.MAPIUtils")
set Candidate = Item
PrResume = &H8239001E
theResume = utils.HrGetOneProp(Candidate.MAPIOBJECT, PrResume)
Item.UserProperties("Resume") = theResume

After diving into Redemption and solving this problem and several others
that were vexing me (populating a combobox with the names of contacts in
PF's holding more than 15,000 contacts in under a couple seconds), I'm
really excited about all the possibilities that Redemption offers a VB guy
(just about a year experience) like me.
I've posted another question starting a new thread for another issue that
I thought I was forced to accept, but now I'm hopeful I do not. Could you
look at that one for me?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top