[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Updating Calendar using Outlook form.

Posted on 2003-12-11
7
Medium Priority
?
1,261 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 400 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
Mailbox Overload?
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 …
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…

650 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