Solved

Mails when send the sent email will be stored in an alternative place. that code errors when unknown email id's thats out of office or Meeting requests are sent or accepted

Posted on 2010-08-18
2
313 Views
Last Modified: 2012-05-10
Hi,

Mails when send the sent email will be stored in an alternative place. that code errors when unknown email id's thats out of office or Meeting requests are sent or accepted.
Run time error 438
Object doen't support this property or method

When debug goes here

    Set Item.SaveSentMessageFolder = Application.Session.Folders("sent New").Folders("Sent")

regards
Sharath
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

    Dim olkRecipient As Outlook.Recipient

    Set Item.SaveSentMessageFolder = Application.Session.Folders("sent New").Folders("Sent")

    For Each olkRecipient In Item.Recipients

        LogAddress olkRecipient.Name, olkRecipient.Address

    Next

    Set olkRecipient = Nothing

    toMe Item

    If Not bolBulkMail Then

        If (Not bolReadReceipt) And (Not bolDeliveryReceipt) Then

            If MsgBox("Do you want receipts for this message?", vbQuestion + vbYesNo, "Request Receipts") = vbYes Then

                Item.ReadReceiptRequested = True

                Item.OriginatorDeliveryReportRequested = True

            End If

        Else

            Item.ReadReceiptRequested = bolReadReceipt

            Item.OriginatorDeliveryReportRequested = bolDeliveryReceipt

        End If

    End If

    'CheckFollowUp Item, Cancel

    Item.Save

End Sub

Open in new window

0
Comment
Question by:bsharath
2 Comments
 
LVL 59

Accepted Solution

by:
Chris Bottomley earned 500 total points
ID: 33467435
How about limiting it to emails as below?

Chris
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

Dim olkRecipient As Outlook.Recipient

    if item.class <> olmail then exit sub

    Set Item.SaveSentMessageFolder = Application.Session.Folders("sent New").Folders("Sent")

    For Each olkRecipient In Item.Recipients

        LogAddress olkRecipient.Name, olkRecipient.Address

    Next

    Set olkRecipient = Nothing

    toMe Item

    If Not bolBulkMail Then

        If (Not bolReadReceipt) And (Not bolDeliveryReceipt) Then

            If MsgBox("Do you want receipts for this message?", vbQuestion + vbYesNo, "Request Receipts") = vbYes Then

                Item.ReadReceiptRequested = True

                Item.OriginatorDeliveryReportRequested = True

            End If

        Else

            Item.ReadReceiptRequested = bolReadReceipt

            Item.OriginatorDeliveryReportRequested = bolDeliveryReceipt

        End If

    End If

    'CheckFollowUp Item, Cancel

    Item.Save

End Sub

Open in new window

0
 
LVL 11

Author Comment

by:bsharath
ID: 33467515
Thanks Chris
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now