Reading Profile Documents with Lotus Notes C-API

I'm sick and tired of seeing this:

NSD

I even caught a red screen, but wasn't fast enough at grabbing a screen shot of it.

I've created a profile document with a Notes client, using the Formula

@Command( [EditProfileDocument] ; "profile"; "uregprofile")

which looks quite harmless to me, and which in fact does create the profile document, which I can save.

When I try to access a field on that profile document from the C-API with

	err = NSFProfileGetField(db,
			profilename,
			(WORD)strlen(profilename),
			NULL,
			0,
			"idfilepath",
			(WORD)strlen("idfilepath"),
			&datatype,
			&bhvalue,
			&valuelen);

Notes crashes. profilename is set to "uregprofile", but I've tried any of the incantations with profilename and username including the ridiculous looking $profile_007profile_ which is contained in the $Name field of the document itself.

The documentation is very helpful here:

An example of this field from a "Calendar Profile" document created from the Notes client would be, $profile_015calendarprofile_. Here the UserName is blank since this profile was created with the Notes client. Therefore to retrieve this profile, use NULL for UserName. Another example of a profile document where UserName may be blank is the "Delegation Profile". This profile is also created using the Notes client.

Update: Watch out for the API documentation when it specifies "UserName - Name of the user of this profile. Optional - may be NULL.". They don't mean NULL (i.e. (void *)0), they mean the empty string "". Quite a difference! Yeah…

Post a Comment

*Required Full name
*Required (Never published)