View Single Post
  #8  
Old July 6th 06, 01:44 AM posted to microsoft.public.outlook.program_forms
Fidget Brain
external usenet poster
 
Posts: 8
Default OL 2007 - Set custom form region as default

i did not realise that certain MAPI properties would not be exposed in the
..NET model and that I would have to use the PropertyAcessor to get/set them.
thanks for that info. I am new to MAPI and have had a cursory look through
the documentation on MSDN. however i could see no reference to the schemas
you mention to which define these properties e.g.
"http://schemas.microsoft.com/mapi/proptag/0x36E5001E". is there a place
which maps these schemas against the properties? thanks

"Sue Mosher [MVP-Outlook]" wrote in message
...
You'll have to settle for doing it manually at present. There apparently is
a bug in Beta 2 related to using PropertyAccessor to set folder properties.
Otherwise, you'd be able to use something like (VBA prototype):

Sub SetDefaultFormFolder(fld As Outlook.Folder, _
formClass As String, formName As String)
Dim pa As Outlook.PropertyAccessor
Dim propNames()
Dim propValues()
Dim arrErrors()
strPR_DEF_POST_MSGCLASS = _
"http://schemas.microsoft.com/mapi/proptag/0x36E5001E"
strPR_DEF_POST_DISPLAYNAME = _
"http://schemas.microsoft.com/mapi/proptag/0x36E6001E"
'On Error Resume Next

If Not fld Is Nothing Then
propNames() = Array(strPR_DEF_POST_MSGCLASS, _
strPR_DEF_POST_DISPLAYNAME)
propValues() = Array(formClass, formName)
Set pa = fld.PropertyAccessor
arrErrors = pa.SetProperties(propNames, propValues)
If Not (IsEmpty(arrErrors)) Then
'Examine the arrErrors array to determine if any
'elements contain errors
For i = LBound(arrErrors) To UBound(arrErrors)
'Examine the type of the element
If IsError(arrErrors(i)) Then
Debug.Print (CVErr(arrErrors(i)))
End If
Next
End If

End If
Set pa = Nothing
End Sub

Alternatively, if your add-in creates the folder, then you could deploy it
by including a .pst file as a project resource, with the folder in that
file, already prepopulated with the desired properties. Your code would
simply copy the folder to the user's existing folder hierarchy.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Fidget Brain" wrote in message
...
sorry i forgot to mention

manually right clicking the folder to achieve this is no good to me. this
is
a .NET add-in that will be shipped out to users, so i am asuming that I
can
do this programmatically.

"Fidget Brain" wrote in message
...
I created a custom form region with the following message class:
"IPM.Contact.TestAddIn1.ClientRegion". I then created a new Folder within
the default Contacts folder to store these custom items. Finally, I
created
a NavigationFolder within the Contacts navigation module which points to
my
new Folder.

when I click the navigation pane folder it is raising the default
Contacts
form, rather than my custom form. this is expected. the problem is that I
can't find a way to set my custom message class for this folder in order
to correct this problem. The DefaultMessageClass property of my folder is
read-only. Also when I first create my folder, the help file specifies
that the additional optional parameter should specify an olDefaultFolder
type, so I can't set it there either.

any help appreciated as Ive been stuck on this now for a while





Ads