Solved

Updating Calendar using Outlook form.

Posted on 2003-12-11
7
1,255 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
7 Comments
 
LVL 1

Accepted Solution

by:
fatthief earned 100 total points
ID: 9926364
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
ID: 9926439
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
ID: 9939565
You can publish the form to a public folder(calendar) which anyone can access it
0
 

Author Comment

by:ManishRanjan
ID: 9939742
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
ID: 9946293
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

749 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