N
Nat
We currently have 2 room setup forms, which are stored in public folders. The
forms have room & meeting information ,primary and secondary contact
information, and date and time information. All of the information is
manually entered , except for the requestor's name, division and employee
which is filled in automatically when the form is opened up. I oriiginally
edited the form with the script editor, but now when a new user opens the
form it only fills in the employee name, except when I open the form it works
correctly.
In a previoius question, Sue referenced using CDO 1.21, but I don't know
what that means. She also mentioned "commenting out the On Error resume Next
statement" to help troubleshoot the issue. I am not sure what that means as
I am no programmer but am trying to resolve this OL issue. These are forms
that have been at our organization for awhile but the programmers are no
longer here and I could not find any documentation. Here is the code I think
references that functionality. Any guidance would be greatly appreciated.
'*************************************************************
'* Room set up script
'* this posts to a folder, has two click buttons which will cause messages
to be generaged
'*
'*
'*
'*************************************************************
'* global settings
'*************************************************************
dim composemode
composemode=True
dim olemsession
'*************************************************************
'* ItemRead
'* This event will only occur when an item is loaded from storage
'* thus if a new item, then composemode set in global settings remains true
'**************************************************************
Sub Item_Read()
' if this subroutine occurs, then an item was read
Composemode = False
End Sub
'******************************************************************
'* Function: Item_Open()
'* Description: On composing the form, a MAPI Session
'* logs on and calls Sub GetDefaultFields()
'* to retrieve the user's name, department
'* and phone number.
'*
'******************************************************************
Function Item_Open()
if item.size = 0 then 'if in compose mode
Set Item.userproperties("ContactPerson").value =
Application.GetNameSpace("MAPI").CurrentUser
' get ole/message session object
Set olemsession = application.CreateObject("MAPI.Session")
' logon to current session
returncode =
olemsession.Logon(application.GetNameSpace("MAPI").CurrentUser, "", False,
False, 0)
Set mypage = Item.GetInspector.ModifiedFormPages("Meeting")
Call SetDefaultFields
'Logoff the session object
olemsession.Logoff()
end if
End Function
'**********************************************************************
'* PROCEDURE: SetDefaultFields
'* DESCRIPTION: Populate employee fields on the form with information
'* retrieved about the user from the address book.
'***********************************************************************
Sub SetDefaultFields()
On Error Resume Next
Set user = olemsession.CurrentUser
'PR_DISPLAY_NAME
item.userproperties.find("ContactPerson") = user.Name
'PR_DIVISION / DEPARTMENT_NAME
item.userproperties.find("Division") = user.Fields.item(&h3a18001e)
'PR_BUSINESS_TELEPHONE_NUMBER
item.userproperties.find("ContactPhone") = user.Fields.item(&h3a08001e)
end sub
forms have room & meeting information ,primary and secondary contact
information, and date and time information. All of the information is
manually entered , except for the requestor's name, division and employee
which is filled in automatically when the form is opened up. I oriiginally
edited the form with the script editor, but now when a new user opens the
form it only fills in the employee name, except when I open the form it works
correctly.
In a previoius question, Sue referenced using CDO 1.21, but I don't know
what that means. She also mentioned "commenting out the On Error resume Next
statement" to help troubleshoot the issue. I am not sure what that means as
I am no programmer but am trying to resolve this OL issue. These are forms
that have been at our organization for awhile but the programmers are no
longer here and I could not find any documentation. Here is the code I think
references that functionality. Any guidance would be greatly appreciated.
'*************************************************************
'* Room set up script
'* this posts to a folder, has two click buttons which will cause messages
to be generaged
'*
'*
'*
'*************************************************************
'* global settings
'*************************************************************
dim composemode
composemode=True
dim olemsession
'*************************************************************
'* ItemRead
'* This event will only occur when an item is loaded from storage
'* thus if a new item, then composemode set in global settings remains true
'**************************************************************
Sub Item_Read()
' if this subroutine occurs, then an item was read
Composemode = False
End Sub
'******************************************************************
'* Function: Item_Open()
'* Description: On composing the form, a MAPI Session
'* logs on and calls Sub GetDefaultFields()
'* to retrieve the user's name, department
'* and phone number.
'*
'******************************************************************
Function Item_Open()
if item.size = 0 then 'if in compose mode
Set Item.userproperties("ContactPerson").value =
Application.GetNameSpace("MAPI").CurrentUser
' get ole/message session object
Set olemsession = application.CreateObject("MAPI.Session")
' logon to current session
returncode =
olemsession.Logon(application.GetNameSpace("MAPI").CurrentUser, "", False,
False, 0)
Set mypage = Item.GetInspector.ModifiedFormPages("Meeting")
Call SetDefaultFields
'Logoff the session object
olemsession.Logoff()
end if
End Function
'**********************************************************************
'* PROCEDURE: SetDefaultFields
'* DESCRIPTION: Populate employee fields on the form with information
'* retrieved about the user from the address book.
'***********************************************************************
Sub SetDefaultFields()
On Error Resume Next
Set user = olemsession.CurrentUser
'PR_DISPLAY_NAME
item.userproperties.find("ContactPerson") = user.Name
'PR_DIVISION / DEPARTMENT_NAME
item.userproperties.find("Division") = user.Fields.item(&h3a18001e)
'PR_BUSINESS_TELEPHONE_NUMBER
item.userproperties.find("ContactPhone") = user.Fields.item(&h3a08001e)
end sub