using javascript to set outlook meeting request date

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mofmans2ndcoming
    New Member
    • Nov 2007
    • 16

    using javascript to set outlook meeting request date

    I have a script for my companies internal network that I am developing to ease the transition away from out old conference room scheduling system to outlook. (this is a stop gap until we can get developer time to do a proper server side solution)

    The users are use to a web interface and the conference rooms AD names are not human friendly so I decided to use some ActiveX to create a sort of meeting request link on a web page so when you click on it, it opens up the meeting request form with the proper conference room address already populated in the form.

    The problem I have now is how to I use a text field data that holds the users desired date so when they look at availability of the room the proper day will already be there.

    I know I need to set the my object's start property to a datetime, but, after parsing the string for the numerical values, how do I turn them into a datetime value with javascript?

    Thanks,

    Jeremy
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Use the Date() object and set the date with the setFullYear() method.

    Comment

    • mofmans2ndcoming
      New Member
      • Nov 2007
      • 16

      #3
      Originally posted by acoder
      Use the Date() object and set the date with the setFullYear() method.
      That will produce a date that outlook will accept?

      Edit:

      I just tried and it will not accept a data object or any of its possible outputs. Outlook accepts the "DateTime" data type. Javascript's date() object is not that type, nor does it output to that type.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Oh, I thought you wanted a date/time object within JavaScript.

        What format does Outlook take?

        Comment

        • mofmans2ndcoming
          New Member
          • Nov 2007
          • 16

          #5
          Originally posted by acoder
          Oh, I thought you wanted a date/time object within JavaScript.

          What format does Outlook take?

          I posted in my edit, but will reply.

          Outlook accepts the datetime type used in MS's APIs.


          Thanks for the fast reply.

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            This is not possible with standard JavaScript but you could possibly achieve this with ActiveX and a bit of VB(?)

            Perhaps if you post your code, someone will be able to help you with the ActiveX code.

            Comment

            • mofmans2ndcoming
              New Member
              • Nov 2007
              • 16

              #7
              Code:
                  objOL = new ActiveXObject("outlook.application");
                  objAppt = objOL.CreateItem(olAppointmentItem);
                  objAppt.Subject = "My Appointment";
                  /*objAppt.Start = */
                          
                  objAppt.MeetingStatus = olMeeting;
                  objAppt.start = formatDate(date);
                  objAppt.RequiredAttendees = "mytest@testing.net";
                  objAppt.display();
              Thank you for your help thus far.

              I figured I would have to use some more activeX. the issue I have right now is that I do not have access to a back end so server side code will not fly. Is there an ActiveX object that I can use, or a method in the current object I have that will allow me to create a datetime type?

              What are the recommendations ?

              Thanks

              Comment

              • mofmans2ndcoming
                New Member
                • Nov 2007
                • 16

                #8
                Would this work?

                Code:
                <script language = "vbscript">
                MyVBFunction(a,b,c)
                [function that accepts integers and returns a DateTime]
                </script>
                
                <script language = "javascript">
                ...
                
                ApptObj.start = MyVBFunction(1,2,2007);
                
                ....
                </script>
                I have looked around and mixing and intermingling like this seems possible. VBScript should have the ability to generate a DateTime, it runs client side, and I am in an IE only environment so incompatibility with other browsers will not matter.

                ideas?

                Comment

                • acoder
                  Recognized Expert MVP
                  • Nov 2006
                  • 16032

                  #9
                  OK, try something like:
                  [CODE=javascript]objAppt.Start = "11/20/2007 3:00:00 PM";[/CODE]That should hopefully work with your ActiveX code.

                  Comment

                  • mofmans2ndcoming
                    New Member
                    • Nov 2007
                    • 16

                    #10
                    Originally posted by acoder
                    OK, try something like:
                    [CODE=javascript]objAppt.Start = "11/20/2007 3:00:00 PM";[/CODE]That should hopefully work with your ActiveX code.
                    That worked! I had tried something like that but I think I did not include the time.

                    I am glad I will not have to use a mixture of VBScript and Javascript.

                    Is there a reference anywhere that you used? I tried looking up information on MSDN but that site is not the friendliest to navigate when you are not use to using it.

                    Thanks for your help.

                    Jeremy

                    Comment

                    • acoder
                      Recognized Expert MVP
                      • Nov 2006
                      • 16032

                      #11
                      Glad you got it working.

                      Something like this page might help (though requires modification to work with JScript).

                      Comment

                      Working...