Solved

Updating Calendar using Outlook form.

Posted on 2003-12-11
7
1,253 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
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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Library not Registered 16 64
Outlook 2016: The message store has reached its maximum size. 5 42
Outlook creates tmp files 2 44
Outlook 365 crashing. 4 43
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
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…

773 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