[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

Repost: Example of using MarkAsTask?

M O J O

10/24/2007 5:25:00 AM

Hi,

(I'm using vb.net 2005)

I'm trying to send an email and mark the "follow up".

Here's my code...

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim oApp As New Microsoft.Office.Interop.Outlook.Application
Dim oNs As Outlook.NameSpace = oApp.GetNamespace("mapi")
oNs.Logon("Outlook", Missing.Value, False, True)
Dim mail As Outlook.MailItem =
CType(oApp.CreateItem(Outlook.OlItemType.olMailItem), Outlook.MailItem)

With mail
.Subject = "TEST"
.To = "myemail@domain.com"
.Body = "Bla bla"
.BodyFormat = Outlook.OlBodyFormat.olFormatPlain
.MarkAsTask(Outlook.OlMarkInterval.olMarkNextWeek)
.TaskStartDate = Now.AddDays(1)
.TaskDueDate = Now.AddDays(1)
.Send()
End With
End Sub

I get an exeption that "MarkAsTask" can't be set, because the mail has not
been sent/recieved.

Any idea how to set MarkAsTask (example code would be GREAT!).

Thanks!

M O J O
5 Answers

jialge

10/25/2007 6:31:00 AM

0

Hello M O J O,

I feel sorry for my delayed response due to an unexpected broken issue of
newsgroup system. From your post, my understanding on this issue is: you
want how to mark the 'follow up' for an mail item to be sent with
MarkAsTask. If I'm off base, please feel free to let me know.

As you see, when the MarkAsTask is called on an mail item (in Drafts
folder) which is not sent out yet, it will report an exception: "Draft
items cannot be marked. MarkAsTask is only valid on items that have been
sent or received.". When an email item has not been sent, it stays in
Drafts folder. The exception is thrown because all items in Drafts are not
allowed to be marked as task. I am still performing researches on this
issue. A possible workaround is to query the mail item in Sent folder of
Outlook after the mail is sent, then mark it as 'Follow up' with
MarkAsTask. But it refers to another problem as you mentioned in the issue
"Outlook 2007: How do I find GlobalObjectID?": How can I identify the
original mail item? MailItem's EntryId property does not help because it
changes when the item is in different folder. MailItem's Title, To, CC are
also not reliable enough for identifying. I have also tried the ItemSend
event of Outlook, but find that when ItemSend event is triggered, both
Outbox and Sent box do not have that mail. Therefore, marking the task in
Send event also does not help. I am consulting the Outlook product team for
the issue and I will get back to you as soon as possible. I appreciate your
patience.

Sincerely,
Jialiang Ge (jialge@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
For MSDN subscribers whose posts are left unanswered, please check this
document: http://blogs.msdn.com/msdnts/pages/posting...

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default....
ications. If you are using Outlook Express/Windows Mail, please make sure
you clear the check box "Tools/Options/Read: Get 300 headers at a time" to
see your reply promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/de....
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

M O J O

10/25/2007 7:04:00 AM

0

Hi Jialiang,

Thank you so far ... looking forward to hear from you!

:o)

Kind regards,
M O J O

Jialiang Ge [MSFT] skrev:
> Hello M O J O,
>
> I feel sorry for my delayed response due to an unexpected broken issue of
> newsgroup system. From your post, my understanding on this issue is: you
> want how to mark the 'follow up' for an mail item to be sent with
> MarkAsTask. If I'm off base, please feel free to let me know.
>
> As you see, when the MarkAsTask is called on an mail item (in Drafts
> folder) which is not sent out yet, it will report an exception: "Draft
> items cannot be marked. MarkAsTask is only valid on items that have been
> sent or received.". When an email item has not been sent, it stays in
> Drafts folder. The exception is thrown because all items in Drafts are not
> allowed to be marked as task. I am still performing researches on this
> issue. A possible workaround is to query the mail item in Sent folder of
> Outlook after the mail is sent, then mark it as 'Follow up' with
> MarkAsTask. But it refers to another problem as you mentioned in the issue
> "Outlook 2007: How do I find GlobalObjectID?": How can I identify the
> original mail item? MailItem's EntryId property does not help because it
> changes when the item is in different folder. MailItem's Title, To, CC are
> also not reliable enough for identifying. I have also tried the ItemSend
> event of Outlook, but find that when ItemSend event is triggered, both
> Outbox and Sent box do not have that mail. Therefore, marking the task in
> Send event also does not help. I am consulting the Outlook product team for
> the issue and I will get back to you as soon as possible. I appreciate your
> patience.
>
> Sincerely,
> Jialiang Ge (jialge@online.microsoft.com, remove 'online.')
> Microsoft Online Community Support
>
> ==================================================
> For MSDN subscribers whose posts are left unanswered, please check this
> document: http://blogs.msdn.com/msdnts/pages/posting...
>
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscriptions/managednewsgroups/default....
> ications. If you are using Outlook Express/Windows Mail, please make sure
> you clear the check box "Tools/Options/Read: Get 300 headers at a time" to
> see your reply promptly.
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscriptions/support/de....
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
>

jialge

10/29/2007 3:00:00 AM

0

Dear M O J O

Due to the complexity in the issue, I would like to have a Product Support
Professional from Microsoft CSS work with you to resolution. Please note
that there will be no cost to you for this support incident.

To expedite creation of the support incident, please email me
(jialge@online.microsoft.com, remove 'online.') with the following
information.
1. Customer Name
2. Customer email address
3. Company Name, if applicable
4. Best times to reach you and your time zone.
5. Microsoft Support Contract Information, if applicable
6. Complete Address
7. Daytime Telephone Number
8. Operating System(s) in use
9. Operating System Language, especially if not US English
10. Application Language, especially if not US English
11. Any additional telephone number(s), in case you cannot be reached at
your primary telephone number.

After I receive an email from you with the requested information, I will
create a support incident for you. Then, one of our support professionals
will contact you to establish a mutually convenient time to work on this.

Thank you again for your patience in working on this issue in the community.

Sincerely,
Jialiang Ge (jialge@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

jialge

10/29/2007 3:00:00 AM

0

Dear M O J O

Due to the complexity in the issue, I would like to have a Product Support
Professional from Microsoft CSS work with you to resolution. Please note
that there will be no cost to you for this support incident.

To expedite creation of the support incident, please email me
(jialge@online.microsoft.com, remove 'online.') with the following
information.
1. Customer Name
2. Customer email address
3. Company Name, if applicable
4. Best times to reach you and your time zone.
5. Microsoft Support Contract Information, if applicable
6. Complete Address
7. Daytime Telephone Number
8. Operating System(s) in use
9. Operating System Language, especially if not US English
10. Application Language, especially if not US English
11. Any additional telephone number(s), in case you cannot be reached at
your primary telephone number.

After I receive an email from you with the requested information, I will
create a support incident for you. Then, one of our support professionals
will contact you to establish a mutually convenient time to work on this.

Thank you again for your patience in working on this issue in the community.

Sincerely,
Jialiang Ge (jialge@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

jialge

10/29/2007 3:07:00 AM

0

Hi M O J O,

Would you send an email to me so that we can communicate with this issue
more efficient? You may email me at: jialge@online.microsoft.com(remove
"online.")

Thanks.

Sincerely,
Jialiang Ge (jialge@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.