Solved

Updating Calendar using Outlook form.

Posted on 2003-12-11
7
1,250 Views
Last Modified: 2008-01-02
I am trying to develop a Outlook Form in which user can fill the information about the meetings and send it to a specific email id in a Exchange 5.5 mail server. I also want to update the calendar of destination email-Id. For this on send event I am writing a code which is giving error: Collaboration Data Objects: [Collaboration Data Objects - [MAPI_E_LOGON_FAILED(80040111)]]

********************
Sub AddCal(strstart, strend, strSubject, strText)
    'on Error Resume Next
    Dim oSession ' As MAPI.Session
    Dim cdoFolder ' As MAPI.Folder
    Dim cdoMessages ' As MAPI.Messages
    Dim cdoAppointmentItem ' As MAPI.AppointmentItem
   
    strservername = "ismsrv13"
    profilename = "Ranjan, Mr. Manish"
   
    Set oSession = CreateObject("MAPI.Session")
   
    strProfile = strservername & vbLf & profilename
    oSession.Logon , , False, True, 0, True, strProfile
   
    Set cdoFolder = oSession.GetDefaultFolder(CdoDefaultFolderCalendar)
    Set cdoMessages = cdoFolder.Messages
    Set cdoAppointmentItem = cdoMessages.Add
    With cdoAppointmentItem
        .Subject = strSubject
        .Text = strText
        .StartTime = strstart
        .EndTime = strend
        .BusyStatus = CdoBusy
        .ReminderSet = False
    End With
   
    cdoAppointmentItem.Update
    oSession.Logoff
    Set cdoAppointmentItem = Nothing
    Set cdoMessages = Nothing
    Set cdoMessages = Nothing
msgbox("Calendar updaetd")
End Sub
********************
Early help will be highly appreciated
0
Comment
Question by:ManishRanjan
  • 3
  • 2
7 Comments
 
LVL 1

Accepted Solution

by:
fatthief earned 100 total points
Comment Utility
when you are trying to logon a session by using the profileinfo(servename+mail alisa), make sure the computer that running the above application is logged with enough permission right to access that profile....
it's not clear? then you can try to use domain administrator to logon the computer and run the application, and you may find the difference
0
 

Author Comment

by:ManishRanjan
Comment Utility
The Form I am developing will be used by more than 400 users. Anyone can use this form to book the Meeting room. On Send event, the form will write in the calendar of a specific profile, which is visible to all to check the free busy status.  
Now I am using different code to achieve this but it is writng in My calendar (Current User) itself.
*********************
Sub AddCal(strstart, strend, strSubject, strText)
      Set objSession = Application.CreateObject("MAPI.Session")
      'strRetCode = objSession.Logon(Application.GetNameSpace("MAPI").CurrentUser, "", False, False, 0)
      strRetCode = objSession.Logon("## Meeting Room", "", False, False, 0)

      ' Get UserName
      strUserName = objSession.CurrentUser

      ' If UserName not found
      If Trim(strUserName) = "" Then
            ' Error creating MAPI session, show error message and exit
            MsgBox "Undefinied error. Errorcode: Please contact your System Administrator", 48, "Microsoft Outlook"
            Item_Send = False
      Else            
            Set cdoFolder = objSession.GetDefaultFolder(CdoDefaultFolderCalendar)
            Set cdoMessages = cdoFolder.Messages
            Set cdoAppointmentItem = cdoMessages.Add
            With cdoAppointmentItem
              .Subject = strSubject
              .Text = strText
              .StartTime = strstart
              .EndTime = strend
              .BusyStatus = 2 'CdoBusy
              .ReminderSet = False
            End With    
            cdoAppointmentItem.Update

            objSession.Logoff
            Set cdoAppointmentItem = Nothing
            Set cdoMessages = Nothing
            Set cdoMessages = Nothing
      End If
End Sub

*********************

 I have quite limited knowledge about Outlook programming.
0
 
LVL 1

Expert Comment

by:fatthief
Comment Utility
You can publish the form to a public folder(calendar) which anyone can access it
0
 

Author Comment

by:ManishRanjan
Comment Utility
That is Okay, I am facing problem in Login in Destination Email ID (i.e. ('## Meeting Room')from the Outlook form.
0
 
LVL 1

Expert Comment

by:fatthief
Comment Utility
If you want to login the Session by using the ProfileName & ProfilePassword parameters, no matters in what language, that ProfileName must be already existed on the machine that you run this form.  To check whether the profile is already installed or not, open "Mail" in the Control Panel from start menu.

However, it seems that you want to access someone's calendar whose profile has never created on your machine, then your should use ProfileInfo parameter instead of ProfileName. e.g.      
strRetCode = objSession.Logon("", ' ProfileName
"", ' ProfilePassword
True, ' ShowDialog
True, ' NewSession
0, ' ParentWindow
False, ' NoMail
"YourMailServer" & vblf & "ProfileName") ' ProfileInfo

Back to my previous comment, the computer that run this form should have the right to access the others' calendar in outlook.  

Actually I am also new to outlook programming.  I also face the similiar problem before and finally found these solutions.  The tricky point is the security management of the Exchange Server.  I am not sure is it the only way to solve it.  Hope they can help you and if you found some better solutions, please let me know :)
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
how to compare 2 PST files? 3 55
exchange, outlook, calendar 4 21
exchange, outlook 5 42
ost file to pst 10 49
Create high volume marketing opportunities using email signatures with these top 10 DOs and DON'Ts of email signature marketing.
If you don't know how to downgrade, my instructions below should be helpful.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

772 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

10 Experts available now in Live!

Get 1:1 Help Now