home | get Sue’s code | forums | share code | registration

More Outlook Resource Sites

Microsoft Developer Network (MSDN)

FAQs and other general resources

Login

login
password
Remember me

You will need to register and log in if you want to download the source code for the Microsoft Outlook Programming book. The forums and code sharing areas are open to both registered and non-registered visitors.

share code 09-Feb-2010 02:50

Looking for help with Outlook programming projects — VSTO, add-ins, VBA, custom Outlook forms, etc.? You′ve come to the right place!

NEW! >> Subscribe to this site via RSS. For more RSS options, see the complete list of feeds on our main news page.

 

Code level: beginner    Code area: Outlook Form Design Printer Friendly Version
Title: Create new appointment from custom contact form
Description: This code creates and displays a simple appointment from a command button named cmdMakeAppt on a custom Outlook form. The appointment gets the company's name in the Subject and a link to the contact in the Contacts box (aka Links collection).
Date: 27-May-2003  09:27
Code level: beginner
Code area: Outlook Form Design
Posted by: Sue Mosher
Body:
All 10comments
Page [ 1  
  27-Aug-2003  22:49   
This was very clost to what I am looking for. However, I want the body of the appointment to be from my notes on my contact page. When I try, it does not work. Can you tell me what I did wrong?



Sub cmdMakeAppt_Click()

    Const olAppointmentItem = 1

    Set objAppt = Application.CreateItem(olAppointmentItem)

    If Item.Size = 0 Then

        Item.Save ' must save item before adding link

    End If

    With objAppt

      .RequiredAttendees = "bob@crw.bz"

        .Subject = "In Home Consultation with " & Item.FullName

        .Location = Item.BusinessAddressStreet & " " & Item.BusinessAddressCity

        .Body = Item.Notes

        .Links.Add Item

    End With

    objAppt.Display

    Set objAppt = Nothing

End Sub





By the way, as a test, I tried another instance of FullName in place of Notes, and it worked fine. Thank you in advance...
  28-Aug-2003  07:08   
In general, is there a quick and easy way to determine what outlook calls a particular field in order to refer to it properly in script? (A novice like me would thin "properties" would tell me, but apparently not)
  28-Aug-2003  07:24   
Through the beauty of your site, I found my answers at http://www.slipstick.com/dev/propsyntax.htm



Thank you
  14-Nov-2004  02:03   
What can I do to add the 'appointment' item to another 'Calendar' folder other than the default folder.
  15-Nov-2004  08:13   
To create a new instance of an item in a non-default folder, instead of CreateItem, you need to use the Add method on the target folder's Items collection. If the target is a default folder in another user's Exchange mailbox, you can use the Namespace.GetDefaultFolder method to return it as a MAPIFolder object. Otherwise, you can use the code at http://www.outlookcode.com/d/code/getfolder.htm to walk the folder hierarchy and return the MAPIFolder corresponding to a given path string.
 
  08-Sep-2005  14:15   
I have a Task Item (Custom Form) with a link that I want to copy to a new Appt Item.

How do you add the link to the new Appt Item?
Sub AddApptbtn_Click
    Dim myLinks
     Dim myLink
    Dim myTask
    Set myTask = Item
    myTask.Save
    Set myItem = Application.CreateItem(1)
    myItem.Subject = myTask.Subject
    myItem.MessageClass = "IPM.Appointment"
    myItem.Categories = myTask.Categories
    myItem.Body = myTask.Body
    Set myLinks = myTask.Links
    myct = myLinks.Count
    myItem.Save
    If myct <> 0 then
      For i = 1 to myct
        Set myLink = myLinks(i)
        myItem.Links.Add myLink
      Next
    End If
    myItem.Save
    myItem.Display
End Sub
 
  08-Sep-2005  15:04   
The Link is not the Contact Item... it is just a link. I found this by looking at properties of Link object "Using the Link Object
Use the Item method to retrieve the Link object from a Links object. Because the Name property is the default property of the Link object, you can identify the linked item by name."

myItem.Links.Add myLink.Item
  29-Mar-2006  10:49   
About the original Code: Would it be possible to do the same thing calling the code with the click of a toolbart button rather than a button actually in the form? Excuse me if this is a foolish question - I am very new to all of this!
  31-Mar-2006  17:45   
Paul, yes, you could do the same thing with a VBA macro running from a toolbar button. Instead of Item, you'd use Application.ActiveInspector.CurrentItem.
  03-Jul-2009  01:57   
AIR CONDISINOR OPERATOR
Page [ 1  
Post your comment



name        email