Discussion:
Problem in creating outlook task remotely using outlook object mod
(too old to reply)
rujuta_l
2009-07-09 10:30:49 UTC
Permalink
Hello,
We are trying to create task in tasks folder of outlook using outlook object
model in ASp.net2.0 web application. The code is like this
Dim oApp As Outlook.Application = New Outlook.Application()
Dim oNS As Outlook.NameSpace = oApp.GetNamespace("mapi") '
oNS.Logon(txtAdmineMailID.Text, txtAdminPwd.Text, True, True)

Dim OTask As Outlook.TaskItem =
oApp.CreateItem(Outlook.OlItemType.olTaskItem)
OTask.Assign()
OTask.Recipients.Add(txteMailID.Text)
OTask.Subject = txtSub.Text
OTask.Body = txtMsg.Text
OTask.DueDate = DateTime.Today
OTask.ReminderTime = OTask.DueDate
OTask.Send()

The code works fine if run locally on windows 2003 server
(http://localhost/CreateTask/test.aspx) provided outlook on the win2003
server configured properly and is open. Task gets created in task folder of
email account provided in txtemail.text by email account provided in
txtAdmineMailID.Text
In following two cases, the above code does not work.
1. If the outlook on win2003 is not open, task does not get created even if
run locally.
2. If the application is run remotely from some other machine using the url
http://abc2003/CreateTask/test.aspx (abc2003 is the name of server where the
createTask app resides), keeping outook on server open, we get the following
error for 1st line of code
Dim oApp As Outlook.Application = New Outlook.Application()
Error is
Retrieving the COM class factory for component with CLSID
{0006F03A-0000-0000-C000-000000000046} failed due to the following error:
80070005.
We need to create the task remotely and without keeping outlook open. Pl.
suggest the solution.

thanks in advance.
Sue Mosher [MVP]
2009-07-09 22:04:27 UTC
Permalink
You may need to rethink your application architecture, because Outlook is
not suitable to automate from server-based code, including ASP.NET. Any
Outlook automation related to a web page should be done with client-side
script, which would be able to access the tasks folder of the local user.

Exactly where are you trying to create the task -- in the browser user's
Tasks folder? Somewhere else? Is this an internal application for an
organization that uses Exchange as its mail server? If so, what version of
Exchange?
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
Post by rujuta_l
Hello,
We are trying to create task in tasks folder of outlook using outlook object
model in ASp.net2.0 web application. The code is like this
Dim oApp As Outlook.Application = New Outlook.Application()
Dim oNS As Outlook.NameSpace = oApp.GetNamespace("mapi") '
oNS.Logon(txtAdmineMailID.Text, txtAdminPwd.Text, True, True)
Dim OTask As Outlook.TaskItem =
oApp.CreateItem(Outlook.OlItemType.olTaskItem)
OTask.Assign()
OTask.Recipients.Add(txteMailID.Text)
OTask.Subject = txtSub.Text
OTask.Body = txtMsg.Text
OTask.DueDate = DateTime.Today
OTask.ReminderTime = OTask.DueDate
OTask.Send()
The code works fine if run locally on windows 2003 server
(http://localhost/CreateTask/test.aspx) provided outlook on the win2003
server configured properly and is open. Task gets created in task folder of
email account provided in txtemail.text by email account provided in
txtAdmineMailID.Text
In following two cases, the above code does not work.
1. If the outlook on win2003 is not open, task does not get created even if
run locally.
2. If the application is run remotely from some other machine using the url
http://abc2003/CreateTask/test.aspx (abc2003 is the name of server where the
createTask app resides), keeping outook on server open, we get the following
error for 1st line of code
Dim oApp As Outlook.Application = New Outlook.Application()
Error is
Retrieving the COM class factory for component with CLSID
80070005.
We need to create the task remotely and without keeping outlook open. Pl.
suggest the solution.
thanks in advance.
Richard
2009-07-17 17:53:19 UTC
Permalink
I'm trying to create something similar too, need to create a task from
a webserver to the users mail, i know it can be done bacause
sharepoint does it in some of its lists, it can export the task to the
user and they appear in the task folder, but i don't know how they do
it.
rujuta_l
2009-07-23 04:11:02 UTC
Permalink
Task should get created in the task folder of user whose email id is provided
in txteMailID Textbox.
txtAdmineMailID.Text holds email of the sender who wants to create task in
receiver (txteMailID )'s task folder.

thanks.
Post by Sue Mosher [MVP]
You may need to rethink your application architecture, because Outlook is
not suitable to automate from server-based code, including ASP.NET. Any
Outlook automation related to a web page should be done with client-side
script, which would be able to access the tasks folder of the local user.
Exactly where are you trying to create the task -- in the browser user's
Tasks folder? Somewhere else? Is this an internal application for an
organization that uses Exchange as its mail server? If so, what version of
Exchange?
--
Sue Mosher, Outlook MVP
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
Post by rujuta_l
Hello,
We are trying to create task in tasks folder of outlook using outlook object
model in ASp.net2.0 web application. The code is like this
Dim oApp As Outlook.Application = New Outlook.Application()
Dim oNS As Outlook.NameSpace = oApp.GetNamespace("mapi") '
oNS.Logon(txtAdmineMailID.Text, txtAdminPwd.Text, True, True)
Dim OTask As Outlook.TaskItem =
oApp.CreateItem(Outlook.OlItemType.olTaskItem)
OTask.Assign()
OTask.Recipients.Add(txteMailID.Text)
OTask.Subject = txtSub.Text
OTask.Body = txtMsg.Text
OTask.DueDate = DateTime.Today
OTask.ReminderTime = OTask.DueDate
OTask.Send()
The code works fine if run locally on windows 2003 server
(http://localhost/CreateTask/test.aspx) provided outlook on the win2003
server configured properly and is open. Task gets created in task folder of
email account provided in txtemail.text by email account provided in
txtAdmineMailID.Text
In following two cases, the above code does not work.
1. If the outlook on win2003 is not open, task does not get created even if
run locally.
2. If the application is run remotely from some other machine using the url
http://abc2003/CreateTask/test.aspx (abc2003 is the name of server where the
createTask app resides), keeping outook on server open, we get the following
error for 1st line of code
Dim oApp As Outlook.Application = New Outlook.Application()
Error is
Retrieving the COM class factory for component with CLSID
80070005.
We need to create the task remotely and without keeping outlook open. Pl.
suggest the solution.
thanks in advance.
Sue Mosher [MVP]
2009-07-23 12:17:26 UTC
Permalink
So you have one person creating tasks in the Exchangemailbox of another,
creating them directly without sending a task request? With what Exchange
version?
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
Post by rujuta_l
Task should get created in the task folder of user whose email id is provided
in txteMailID Textbox.
txtAdmineMailID.Text holds email of the sender who wants to create task in
receiver (txteMailID )'s task folder.
thanks.
Post by Sue Mosher [MVP]
You may need to rethink your application architecture, because Outlook is
not suitable to automate from server-based code, including ASP.NET. Any
Outlook automation related to a web page should be done with client-side
script, which would be able to access the tasks folder of the local user.
Exactly where are you trying to create the task -- in the browser user's
Tasks folder? Somewhere else? Is this an internal application for an
organization that uses Exchange as its mail server? If so, what version of
Exchange?
Post by rujuta_l
Hello,
We are trying to create task in tasks folder of outlook using outlook object
model in ASp.net2.0 web application. The code is like this
Dim oApp As Outlook.Application = New Outlook.Application()
Dim oNS As Outlook.NameSpace = oApp.GetNamespace("mapi") '
oNS.Logon(txtAdmineMailID.Text, txtAdminPwd.Text, True, True)
Dim OTask As Outlook.TaskItem =
oApp.CreateItem(Outlook.OlItemType.olTaskItem)
OTask.Assign()
OTask.Recipients.Add(txteMailID.Text)
OTask.Subject = txtSub.Text
OTask.Body = txtMsg.Text
OTask.DueDate = DateTime.Today
OTask.ReminderTime = OTask.DueDate
OTask.Send()
The code works fine if run locally on windows 2003 server
(http://localhost/CreateTask/test.aspx) provided outlook on the win2003
server configured properly and is open. Task gets created in task
folder
of
email account provided in txtemail.text by email account provided in
txtAdmineMailID.Text
In following two cases, the above code does not work.
1. If the outlook on win2003 is not open, task does not get created
even
if
run locally.
2. If the application is run remotely from some other machine using the url
http://abc2003/CreateTask/test.aspx (abc2003 is the name of server
where
the
createTask app resides), keeping outook on server open, we get the following
error for 1st line of code
Dim oApp As Outlook.Application = New Outlook.Application()
Error is
Retrieving the COM class factory for component with CLSID
80070005.
We need to create the task remotely and without keeping outlook open. Pl.
suggest the solution.
thanks in advance.
rujuta_l
2009-07-24 06:58:02 UTC
Permalink
Yes. Receiver has given author permission to the sender for his task folder.
Exchange server can be either 2003 or 2007.
The application is hosted on 2003 server (name of the server is svr03) .
Outlook on the server is configured with some email account e.g.
***@abc.com. txtAdmineMailID.Text is readonly textbox and contains this
email id i.e. ***@abc.com. Receiver email id can vary and it is accepted in
txteMailID textbox (e.g. ***@abc.com). But this is sure that receiver
(***@abc.com) has given author permissions to ***@abc.com for his task
folder.So task can always be created by ***@abc.com in receiver's task
folder (***@abc.com). This works fine if application is run on svr03 locally
and MS Outlook is open with profile of ***@abc.com. But if it is run
remotely from some other machine (m/c name pqr) using url
http://svr03/taskapp/form1.aspx, it does not work.
Our requirement is task should get created in task folder of ***@abc.com by
***@abc.com using the application taskApp which resides on svr03 and
accessed using url http://svr03/taskapp/form1.aspx, from m/c pqr remotely and
without keeping outlook on svr03 open.

thanks,
Rujuta
Post by Sue Mosher [MVP]
So you have one person creating tasks in the Exchangemailbox of another,
creating them directly without sending a task request? With what Exchange
version?
--
Sue Mosher, Outlook MVP
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
Post by rujuta_l
Task should get created in the task folder of user whose email id is provided
in txteMailID Textbox.
txtAdmineMailID.Text holds email of the sender who wants to create task in
receiver (txteMailID )'s task folder.
thanks.
Post by Sue Mosher [MVP]
You may need to rethink your application architecture, because Outlook is
not suitable to automate from server-based code, including ASP.NET. Any
Outlook automation related to a web page should be done with client-side
script, which would be able to access the tasks folder of the local user.
Exactly where are you trying to create the task -- in the browser user's
Tasks folder? Somewhere else? Is this an internal application for an
organization that uses Exchange as its mail server? If so, what version of
Exchange?
Post by rujuta_l
Hello,
We are trying to create task in tasks folder of outlook using outlook object
model in ASp.net2.0 web application. The code is like this
Dim oApp As Outlook.Application = New Outlook.Application()
Dim oNS As Outlook.NameSpace = oApp.GetNamespace("mapi") '
oNS.Logon(txtAdmineMailID.Text, txtAdminPwd.Text, True, True)
Dim OTask As Outlook.TaskItem =
oApp.CreateItem(Outlook.OlItemType.olTaskItem)
OTask.Assign()
OTask.Recipients.Add(txteMailID.Text)
OTask.Subject = txtSub.Text
OTask.Body = txtMsg.Text
OTask.DueDate = DateTime.Today
OTask.ReminderTime = OTask.DueDate
OTask.Send()
The code works fine if run locally on windows 2003 server
(http://localhost/CreateTask/test.aspx) provided outlook on the win2003
server configured properly and is open. Task gets created in task
folder
of
email account provided in txtemail.text by email account provided in
txtAdmineMailID.Text
In following two cases, the above code does not work.
1. If the outlook on win2003 is not open, task does not get created
even
if
run locally.
2. If the application is run remotely from some other machine using the url
http://abc2003/CreateTask/test.aspx (abc2003 is the name of server
where
the
createTask app resides), keeping outook on server open, we get the following
error for 1st line of code
Dim oApp As Outlook.Application = New Outlook.Application()
Error is
Retrieving the COM class factory for component with CLSID
80070005.
We need to create the task remotely and without keeping outlook open. Pl.
suggest the solution.
thanks in advance.
veenu
2010-12-02 21:00:59 UTC
Permalink
rujuta_l wrote on 07/24/2009 02:58 ET
Post by rujuta_l
Yes. Receiver has given author permission to the sender for his task folder
Exchange server can be either 2003 or 2007
The application is hosted on 2003 server (name of the server is svr03)
Outlook on the server is configured with some email account e.g
txtAdmineMailID.Text is readonly textbox and contains thi
email id i.e. Receiver email id can vary and it is accepted i
txteMailID textbox (e.g. ). But this is sure that receive
() has given author permissions to for his tas
folder.So task can always be created by in receiver's tas
folder (). This works fine if application is run on svr03 locall
and MS Outlook is open with profile of But if it is ru
remotely from some other machine (m/c name pqr) using ur
http://svr03/taskapp/form1.aspx, it does not work
Our requirement is task should get created in task folder of b
using the application taskApp which resides on svr03 an
accessed using url http://svr03/taskapp/form1.aspx, from m/c pqr remotely an
without keeping outlook on svr03 open
thanks
Rujut
Post by Sue Mosher [MVP]
So you have one person creating tasks in the Exchangemailbox of another
creating them directly without sending a task request? With what Exchang
version
Sue Mosher, Outlook MV
Author of Microsoft Outlook 2007 Programming
Jumpstart for Power Users and Administrator
http://www.outlookcode.com/article.aspx?id
"rujuta_l" wrote i
messag
news
> Task should get created in the task folder of user whose email id i
> provide
> in txteMailID Textbox
> txtAdmineMailID.Text holds email of the sender who wants to create tas
i
> receiver (txteMailID )'s task folder
&gt
> thanks
&gt
>> You may need to rethink your application architecture, becaus
Outlook i
>> not suitable to automate from server-based code, including ASP.NET
An
>> Outlook automation related to a web page should be done wit
client-sid
>> script, which would be able to access the tasks folder of the loca
user
>&gt
>> Exactly where are you trying to create the task -- in the browse
user'
>> Tasks folder? Somewhere else? Is this an internal application fo
a
Post by rujuta_l
Post by Sue Mosher [MVP]
>> organization that uses Exchange as its mail server? If so, wha
versio
>> o
>> Exchange
>&gt
>> "rujuta_l" wrot
in messag
>> news
>> > Hello
>> > We are trying to create task in tasks folder of outlook usin
outloo
>> > objec
>> > model in ASp.net2.0 web application. The code is like thi
>> > Dim oApp As Outlook.Application = New Outlook.Application(
>> > Dim oNS As Outlook.NameSpace
oApp.GetNamespace("mapi")
>> > oNS.Logon(txtAdmineMailID.Text, txtAdminPwd.Text, True
True
>> &gt
>> > Dim OTask As Outlook.TaskItem > >> &gt
oApp.CreateItem(Outlook.OlItemType.olTaskItem
>> > OTask.Assign(
>> > OTask.Recipients.Add(txteMailID.Text
>> > OTask.Subject = txtSub.Tex
>> > OTask.Body = txtMsg.Tex
>> > OTask.DueDate = DateTime.Toda
>> > OTask.ReminderTime = OTask.DueDat
>> > OTask.Send(
>> &gt
>> > The code works fine if run locally on windows 2003 serve
>> > (http://localhost/CreateTask/test.aspx) provided outlook o
th
Post by rujuta_l
Post by Sue Mosher [MVP]
win200
>> > server configured properly and is open. Task gets created i
tas
>> > folde
>> > o
>> > email account provided in txtemail.text by email accoun
provided i
>> > txtAdmineMailID.Tex
>> > In following two cases, the above code does not work
>> > 1. If the outlook on win2003 is not open, task does not get
created
>> > even
>> > if
>> > run locally.
>> > 2. If the application is run remotely from some other machine
using the
>> > url
>> > http://abc2003/CreateTask/test.aspx (abc2003 is the name of
server
>> > where
>> > the
>> > createTask app resides), keeping outook on server open, we get
the
>> > following
>> > error for 1st line of code
>> > Dim oApp As Outlook.Application = New Outlook.Application()
>> > Error is
>> > Retrieving the COM class factory for component with CLSID
>> > {0006F03A-0000-0000-C000-000000000046} failed due to the
following
>> > 80070005.
>> > We need to create the task remotely and without keeping
outlook
Post by rujuta_l
Post by Sue Mosher [MVP]
open.
>> > Pl.
>> > suggest the solution.
>> >
>> > thanks in advance.
>> >
>>
>>
>>
Hi,

We had the similar problem that the Outlook Automation had to be done on
WebServer and send Outlook Tasks from Web-interface.
Since Microsoft officially doesn't support Server-Side Office Automation (read
http://support.microsoft.com/kb/257757), following points had to be performed
to
accomplish the requirement:
- Outlook has to be up and running on the server all the time. This has to be
taken care of by the customer or his IT team. Credentials if needed by Outlook
again have to be manually filled in by the customer
- Redemption Framework to bypass the Security checks made by outlook when
accessed using API

The solution worked but is not reliable. So please update if you find any
better
approach to accomplish or straighten up this stuff. Thanks.

Loading...