Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save appointment item in additional added folders

Status
Not open for further replies.

harmmeijer

Programmer
Mar 1, 2001
869
CN
I have opened an additional folder in outlook 2000 that is used as a goup mailbox.

In outlook I can open the calendar and add appointments here but with automation I haven't got a clue on how to do this.

I can get the folder and add an item folder.items.add(1) but when I save the item it ends up in my folder under calendar not in the group account folder.

Here is the vba code, note that this eventually has to run in javascript.

Code:
    Dim nameOfMyfolder As String
    Dim nameOfGroupfolder As String
    nameOfMyfolder = "Mailbox - myname"
    nameOfGroupfolder = "Mailbox - helpdesk"
    
    Dim out As Outlook.Application
    Set out = New Outlook.Application

    Dim f As MAPIFolder
    Dim i As Integer
    i = 1
    Do While i < out.GetNamespace("MAPI").Folders.Count + 1
        Dim s As String
        s = out.GetNamespace("MAPI").Folders(i).Name
        If s = nameOfGroupfolder Then
            Set f = out.GetNamespace("MAPI").Folders(i)
            MsgBox "OK f is now: " & f.Name
        End If
        
        i = i + 1
    Loop
    If f Is Nothing Then
        MsgBox "Please add the ""additional folderes""" & vbCrLf & _
            "In outlook under tools -> services -> microsoft excha" & _
            "nge server -> properties -> advanced -> add"
        Exit Sub
    End If
    ' OK, got the group folder, now put an appointment in there
    Dim aItem As AppointmentItem
    Set aItem = f.Items.Add(olAppointmentItem)
    aItem.MeetingStatus = 1
    
    If aItem.Parent.Parent.Name = nameOfMyfolder Then
        MsgBox "Why does it create the calendar item in MY folder when " & _
        "I invoke items.add on the GROUP folder????"
        MsgBox "The appt has to be in the group folder, no use saving it in my folder"
        Exit Sub
    End If

    aItem.Subject = "new subject"
    aItem.Send



Greetings, Harm Meijer
 
No, sorry. The folder is the default folder for the Helpdesk account.
But members of the Helpdesk group have read and create permission on all folders.




Greetings, Harm Meijer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top