Classic ASP 3.0 question - can an outlook task be created within code?

sbornstein2
sbornstein2 used Ask the Experts™
on
Hello all,

I have an old ASP 3.0 application.  I beleive my client uses exchange but I need to double check.  They want to based on after a new item is created from one of my forms, create an outlook task specified to a certain person.  Any idea if this is possible?  I assume I have to find out for sure about exchange as it may need to be completed there if it is to a certain person.  So I know this is preliminary info here.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Chris BottomleySoftware Quality Lead Engineer
Top Expert 2011

Commented:
If ASP supports VBA ... then the answer is yes, VBA can be used to connect to or open outlook as necessary and a task can be dynamically created and populated from the relevant data.

Chris
Chris BottomleySoftware Quality Lead Engineer
Top Expert 2011

Commented:
sbornstein2

If you are happy following links then that is fine, I mean no offence to your skills when I say my intent is to try and walk you through the process.  I have trialled a task send to a user and am perfectly happy automating outlook so hopefully can provide such support as you would like.

Chris
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

SvenTech Lead Web-Development

Commented:
Problem with this is: If you are using ASP your code is server side. You need to install Outlook on server and you can not access outlook on a specific client. To do this you would have to run an iis web server on each client.

You have to know if there is an exchange server, and if so, try to access this directly. I do not have any code examples. Here is only a short one for connecting to exchange:
http://www.codeproject.com/KB/asp/Exchange_ADSI_LDAP.aspx

A code example for new calender entry in outlook:
Set myOLApp = CreateObject("Outlook.Application")
Set myItem = myOLApp.CreateItem(olAppointmentItem)
With myItem
.Start = "01.02.97 10:00:00"
.End = "01.02.97 16:00:00"
.Subject = "Präsentation der neuen Werbekampagne"
.Save
.Display
End With
Set myItem = Nothing
Set myOLApp = Nothing

Open in new window

Chris BottomleySoftware Quality Lead Engineer
Top Expert 2011

Commented:
DarthSonic

You may well know more than I but I would be cautious about statements such as "you can not access outlook on a specific client" which can be misleading.  Using VBA if ASP supports it you can createa task which may well require otlook on the server, but if so and there is such an install then you can most definitely create a task that can be sent to the specific client.  Whether they choose to accept it is another matter.

Personally I am waiting for the author to come online so we can establish teh environment, capability and need before getting too stuck in.

Chris
SvenTech Lead Web-Development

Commented:
You can not use VBA in ASP, you can only use "VBScript" or JavaScript. Both could be used also for client side scripts but there is no ActiveX object for Outlook or Exchange client side within the browsers as far as I know.
Chris BottomleySoftware Quality Lead Engineer
Top Expert 2011

Commented:
DarthSonic

That helps, in VBS of course we can use to all intents and purposes VBA code as indicated in your earlier snippet so I see no problem as long as there is instance of outlook installed on the server.  If not I wouldn't rule it out but I don't know currently if we can connect to exchange in the same way.

Chris

Author

Commented:
Hey guys,

Thanks for all the input I will be trying some things over the next few nights.  I beleive I can use the Outlook.Application create object and I think possibly create a request task to a user.  I found one link but I need to test things.  They do use exchange I found out but I am hoping I don't have to worry about exchange and somehow send a create task request for a user or something.  I will keep ya posted and will award this question very soon.  Thanks again and have a great begin to the week.
Chris BottomleySoftware Quality Lead Engineer
Top Expert 2011

Commented:
When you're looking the snippet is the code I used to send a task to a user.  Simply add the correct email address in place of the recipient and owner.

Chris
Sub otherPerson()
Dim nuTask As Outlook.TaskItem
 
    Set nuTask = Application.CreateItem(olTaskItem)
    With nuTask
        .DueDate = Date + 7 + TimeValue("10:00:00")
        .ReminderTime = Date + 5 + TimeValue("15:00:00")
        .subject = "Delete Me"
        .Body = "Auto Generated by me"
        .Recipients.Add "email@address"
        .Owner = "email@address"
        .Assign
        .Send
        .Delete
    End With
    Set nuTask = Nothing
 
End Sub

Open in new window

Author

Commented:
will do Chris.  thanks a lot.  I will paste also the link I found when I get home from work to see if that is similar to what I need as well.
SvenTech Lead Web-Development

Commented:
chris_bottomleys code translated to asp would be:
Sub otherPerson()
 
    Dim nuTask
 
    Set outlookApp = CreateObject("Outlook.Application")
    Set nuTask = outlookApp.CreateItem(olTaskItem)
 
    With nuTask
 
        .DueDate = Date + 7 + TimeValue("10:00:00")
        .ReminderTime = Date + 5 + TimeValue("15:00:00")
        .subject = "Delete Me"
        .Body = "Auto Generated by me"
        .Recipients.Add "email@address"
        .Owner = "email@address"
        .Assign
        .Send
        .Delete
 
    End With
 
    Set nuTask = Nothing
    Set outlookApp = Nothing
 
End Sub

Open in new window

Software Quality Lead Engineer
Top Expert 2011
Commented:
Apologies I tested directly in outlook for simplicity.  Recalling you will be working from VBS therefore the structure needs to slightly modified as below.
Chris
otherPerson
Sub otherPerson()
dim olApp
Dim nuTask
 
    set olapp = createobject("outlook.application")
    Set nuTask = olapp.CreateItem(3)
    With nuTask
        .DueDate = Date() + 7 + TimeValue("10:00:00")
        .ReminderTime = Date() + 5 + TimeValue("15:00:00")
        .subject = "Delete Me"
        .Body = "Auto Generated by me"
        .Recipients.Add "email@address"
        .Owner = "email@address"
        .Assign
        .display
        .Send
    End With
    Set nuTask = Nothing
    Set olapp = nothing
 
End Sub

Open in new window

Chris BottomleySoftware Quality Lead Engineer
Top Expert 2011

Commented:
DarthSonic:

LOoks like you were close but olTaskItem is an outlook constant therefore replacing with the magic number or creation of a constant is required.

Chris

Author

Commented:
thanks all
Chris BottomleySoftware Quality Lead Engineer
Top Expert 2011

Commented:
Glad to help

Chris

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial