Results 1 to 30 of 30

Thread: I Need Outlook Com Add In Help Needed, Please

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2006
    Posts
    79

    Angry I Need Outlook Com Add In Help Needed, Please

    Problem Specification (draft)

    Functions:
    1)
    To calculate a running total of flexible working hours and show it in
    calendar view based on a reference calendar which is on server in
    "Public Folders" with a name "Standard Working Hours"

    A separate "balance ticket" can be generated as well and user may open
    the balance ticket to get all the required information (daily and
    running
    balance). Runnig total and the updating of changed data may be a bit
    challenging to program !

    Another option is to place the information in the "Tasks" folder of
    the user or some other special "Own Working Hours"

    2)
    To calculate own daily working hours based on a reference calendar
    which is on server in "Public Folders" with a name "Working Hours"

    3)
    To check that there are no overlapping hours (overlapping
    appointments are OK, but the ones starting with an integer are not
    permitted to
    overlap). A RED error ticket may be generated or some other form of
    error
    message should be displayed to the user in error condition.

    4)
    TO make a balance correction - if needed based on special "balance
    correction" appoinment on the day given for the future days

    5)
    To produce a (given time span) report of used working hours to
    specific codenumber or task. This is extra bonus feature.

    Tools:
    1) Outlook-2000 + forms
    2) visual basic


    'My attempted solution

    VB Code:
    1. 'log the user on to the application
    2. strLogonID = Request.ServerVariables("Logon_User")
    3. strMailbox = Right(strLogonID, Len(strLogonID) - InStr(strLogonID, "\"))
    4.  
    5. ' Construct CDO profile
    6. strProfileInfo = strServer + vbLF + strMailbox
    7.  
    8. ' Create CDO session
    9. Err.Clear
    10. On Error Resume Next
    11. Set objSession = Server.CreateObject("MAPI.Session")
    12.  
    13. ' Logon with authenticated CDO profile
    14. Err.Clear
    15. On Error Resume Next
    16. objSession.Logon "", "", False, True, 0, True, strProfileInfo
    17.  
    18. Private WithEvents moOL As Outlook.Application
    19. Private WithEvents moNS As Outlook.NameSpace
    20. Private WithEvents moActiveExplorer As Outlook.Explorer
    21.  
    22. Sub TestColorLabel()
    23.     Dim objItem As Object
    24.     Dim thisAppt As AppointmentItem
    25.    
    26.     Set objItem = Application.ActiveExplorer.Selection(1)
    27.     If objItem.Class = olAppointment Then
    28.         Set thisAppt = objItem
    29.         Call SetApptColorLabel(thisAppt, 3)
    30.     End If
    31.    
    32.     Set objItem = Nothing
    33.     Set thisAppt = Nothing
    34. End Sub
    35.  
    36. Sub SetApptColorLabel(objAppt As Outlook.AppointmentItem, _
    37.                       intColor As Integer)
    38.     ' requires reference to CDO 1.21 Library
    39.     ' adapted from sample code by Randy Byrne
    40.     ' intColor corresponds to the ordinal value of the color label
    41.         '1=Important, 2=Business, etc.
    42.     Const CdoPropSetID1 = "0220060000000000C000000000000046"
    43.     Const CdoAppt_Colors = "0x8214"
    44.     Dim objCDO As MAPI.Session
    45.     Dim objMsg As MAPI.Message
    46.     Dim colFields As MAPI.Fields
    47.     Dim objField As MAPI.Field
    48.     Dim strMsg As String
    49.     Dim intAns As Integer
    50.     On Error Resume Next
    51.    
    52.     Set objCDO = CreateObject("MAPI.Session")
    53.     objCDO.Logon "", "", False, False
    54.     If Not objAppt.EntryID = "" Then
    55.         Set objMsg = objCDO.GetMessage(objAppt.EntryID, _
    56.                                    objAppt.Parent.StoreID)
    57.         Set colFields = objMsg.Fields
    58.         Set objField = colFields.Item(CdoAppt_Colors, CdoPropSetID1)
    59.         If objField Is Nothing Then
    60.             Err.Clear
    61.             Set objField = colFields.Add(CdoAppt_Colors, vbLong, intColor, CdoPropSetID1)
    62.         Else
    63.             objField.Value = intColor
    64.         End If
    65.         objMsg.Update True, True
    66.     Else
    67.         strMsg = "You must save the appointment before you add a color label. " & _
    68.                  "Do you want to save the appointment now?"
    69.         intAns = MsgBox(strMsg, vbYesNo + vbDefaultButton1, "Set Appointment Color Label")
    70.         If intAns = vbYes Then
    71.             Call SetApptColorLabel(objAppt, intColor)
    72.         End If
    73.     End If
    74.                      
    75.     Set objMsg = Nothing
    76.     Set colFields = Nothing
    77.     Set objField = Nothing
    78.     objCDO.Logoff
    79.     Set objCDO = Nothing
    80.  
    81. Sub AddHours()
    82. Dim i As AppointmentItem
    83. Dim h As Single
    84. 'totals the hours for selected appointmentItems
    85. h = 0
    86. For Each i In ActiveExplorer.Selection
    87. h = h + DateDiff("n", i.Start, i.End)
    88. Next i
    89. MsgBox Format(h / 60, "0.0") & " Hours", vbInformation, "Total Hours"
    90. End Sub


    //This doesnt work...I have been trying to debug but to no avail, just highlighting so many errors. I guessed I need to develop a COM ADD IN...I dont know much about this, even I tried running downloaded samples from this site but couldnt get it to run, but dont know how to go about this. Any help would be greatly appreciated. thanks in advance
    Last edited by RobDog888; Oct 26th, 2006 at 01:18 AM. Reason: Added [vbcode] tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width