Solved

VS 2010 application work on XP but not on Window 7

Posted on 2011-09-09
44
1,424 Views
Last Modified: 2012-05-12
Hello all

This is a part 2 for that topic: VB6 to Visual studio 2010 issue

I have this project here that i have build under:

Windows 7-64 bits
Microsoft Office 2007
Visual Studio 2010
Use ClickOnce to compile

So far, everything is good.

I install it on a:
window XP SP3- 32 bits
Microsoft Office 2007
with .NET 4

And it worked perfectly well.


Then, i install it on a:


Windows 7-64 bits
Microsoft Office 2007
.NET 4

But i still have the same error from the other post higher.

I'm still searching for the reason but still don't find any solution.

Is there a chance that it is not compatible with Windows 7 since it it working with Windows XP?



Option Explicit On
Imports Microsoft.Office.Interop
Public Class Form2

    Public olNameSpace As Outlook.NameSpace
    Public olRecipient As Outlook.Recipient
Dim olApp As Microsoft.Office.Interop.Outlook.Application
        Dim OLNameSpace As Microsoft.Office.Interop.Outlook.NameSpace
        Dim OLRecipient As Microsoft.Office.Interop.Outlook.Recipient
        Dim olappt As Microsoft.Office.Interop.Outlook.AppointmentItem



        olApp = New Microsoft.Office.Interop.Outlook.Application
        OLNameSpace = OLApp.GetNamespace("MAPI")
        OLNameSpace.Logoff()
        OLNameSpace.Logon("Logon Name", "Password", False, True)

        olRecipient = OLNameSpace.CreateRecipient("jpoitra@videotron.ca")
        olappt = CType(OLNameSpace.GetSharedDefaultFolder(OLRecipient, Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderCalendar).Items.Add, Microsoft.Office.Interop.Outlook.AppointmentItem)
        OLAppt.Location = "Location"
        OLAppt.Subject = "Subject"
        OLAppt.Body = "Testing for calendar add"
        OLAppt.Start = CDate("12/31/00 01:00 AM")
        OLAppt.End = CDate("12/31/00 01:01 AM")
        OLAppt.save()

        OLAppt = Nothing
        OLNameSpace.Logoff()
        OLApp = Nothing
        OLNameSpace = Nothing
        OLRecipient = Nothing

Open in new window


Thank again if you can help me to find a solution on this hard issue.
0
Comment
Question by:Wilder1626
  • 26
  • 13
  • 4
44 Comments
 
LVL 6

Expert Comment

by:mjfagan
ID: 36510245
You compiled it on a Windows 7 machine but it doesn't run as an executable on it?  Have you tried running it in Windows XP compatibility mode?  Right-click on the executable, choose properties, click on the compatibility tab and check the box for XP SP3 compatibility.
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36511194
Hello,

I did the windows  xp xp3 compatible, and also run as administratoré Still the same issue

System.Runtime.InteropServices.COMException (0x8004010F): Échec de l'opération. Impossible de trouver un objet.
   at Microsoft.Office.Interop.Outlook.NameSpaceClass.GetSharedDefaultFolder(Recipient Recipient, OlDefaultFolders FolderType)
   at WindowsApplication1.Form1.Button1_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
 calendar
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/Jean-Marc/AppData/Local/Apps/2.0/6DJGB94R.A4O/ADE2ZM92.PGX/loba..tion_b60a8a124113e43a_0001.0000_16e54741d8c1859f/LObalw%20calendar.exe
----------------------------------------
Microsoft.VisualBasic
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Runtime.Remoting
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
Microsoft.Office.Interop.Outlook
    Assembly Version: 12.0.0.0
    Win32 Version: 12.0.4518.1014
    CodeBase: file:///C:/Windows/assembly/GAC/Microsoft.Office.Interop.Outlook/12.0.0.0__71e9bce111e9429c/Microsoft.Office.Interop.Outlook.dll
----------------------------------------
office
    Assembly Version: 12.0.0.0
    Win32 Version: 12.0.6425.1000
    CodeBase: file:///C:/Windows/assembly/GAC/office/12.0.0.0__71e9bce111e9429c/office.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

0
 
LVL 6

Expert Comment

by:mjfagan
ID: 36511313
So is the program erroring at startup or when you push a button?  Have you put any Try. . .Catch(es) in your code to see at what point it's having issues (plus in the Catch part, have a message box pop up with the error)?
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36512815
The install went well.

It's only when i click on a button that i have the error.

There is no catch but i know where it jam:
 olappt = CType(OLNameSpace.GetSharedDefaultFolder(OLRecipient, Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderCalendar).Items.Add, Microsoft.Office.Interop.Outlook.AppointmentItem)

Open in new window


That was the issue in my previous topic.

But i's working on XP but not on windows 7
0
 
LVL 6

Expert Comment

by:mjfagan
ID: 36512915
Okay, have you tried running it in XP compatibility mode?  What about checking the UAC on the Windows 7 machine (turning it off or lowering the settings)?
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 36513516
Can you translate the error message for us? Did you install the Office Primary Interop Assemblies on the Win 7 machine?
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36513793
Hello again


French:
System.Runtime.InteropServices.COMException (0x8004010F): Échec de l'opération. Impossible de trouver un objet.
   at Microsoft.Office.Interop.Outlook.NameSpaceClass.GetSharedDefaultFolder(Recipient Recipient, OlDefaultFolders FolderType)

English:
System.Runtime.InteropServices.COMException (0x8004010F):The operation failed. Can not find an object.
   at Microsoft.Office.Interop.Outlook.NameSpaceClass.GetSharedDefaultFolder(Recipient Recipient, OlDefaultFolders FolderType)

For the Office install, i did a full default installation.

I will try to lower the UAC and i will let you know the result
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36513810
Sorry, i have the same error.

Do you want me to post it just in case?
0
 
LVL 6

Expert Comment

by:mjfagan
ID: 36513908
Was Microsoft Office installed on the Windows 7 computer as a 64 bit (you have the option to choose, if I'm remembering correctly, and based on the computer I'm on--64 bit and most of the files are in Program Files (x86)?  And going back to CodeCruiser's question--is Office Primary Interop Assemblies installed?
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36514013
You are right, Microsoft office is installed in my Program Files (x86).

Is Office Primary Interop Assemblies installed a default install?

I guess not.

Let me re install office.

Does that mean that Microsoft office should not be in the Program Files (x86)?

0
 
LVL 6

Expert Comment

by:mjfagan
ID: 36514050
There is no Program Files (x86) folder in Windows XP.  How were things installed on the developer machine (which you said was a Windows 7, 64 bit machine)?  You need to get things on the target machine looking the same as the development machine with regards to Office.
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36514061
ok, let me reinstall microsoft office.

I will let you know the result.

Thanks again
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36514107
But the thing that i maybe dont understand, it is that i have build it under windows 7 / office 2007 to make it work on it, but it does not.

But it work on XP.

I will try to see how i can install the Office Primary Interop Assemblies.
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36514292
OK, i have installed 2007 Microsoft Office System Update: Redistributable Primary Interop Assemblies: PIAs

But just before, i have re installed Microsoft office. I have re direct the folder to Program Files.

This is a full install.

Now that i have installed Office Primary Interop Assemblies, i have errors in my code. see image.

do you know why?

new-issue.jpg
0
 
LVL 6

Expert Comment

by:mjfagan
ID: 36514391
You need to re-reference the assemblies in your project.
0
 
LVL 6

Expert Comment

by:mjfagan
ID: 36514394
I.e. delete them and add them back in.
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36514441
I try to put back the Microsoft Outlook 12.00 library but now that it is in the Program Files, now, i dont have in in my COM list any more.
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36514467
i will re install office by default again, in the folder program files(86x)

see what it will do
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36514566
Ok, back on track.

I have now removed all refrences and then, put them back.

But again, i have the same issue, even if i have installed Office Primary Interop Assemblies.

But the Microsoft office folder is back in Program files(86x).

The error comes anagin on this part of the code:

  olappt = CType(OLNameSpace.GetSharedDefaultFolder(OLRecipient, Outlook.OlDefaultFolders.olFolderCalendar).Items.Add, Microsoft.Office.Interop.Outlook.AppointmentItem)

Open in new window



Impossible to find the object.
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36514593
Here are also the refrences i have in my project.
refrences.jpg
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36514601
and these is where it freeze:
error.jpg
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 6

Expert Comment

by:mjfagan
ID: 36514714
You're still missing something.  My home machine has Windows 7, 64 bit with MS Office 2010 and I have Visual Studio 2008.  I went and added the Microsoft Outlook 14 (since I have 2010) Object Library and Microsoft.Office.Core and Microsoft.Office.Interop.Outlook were added (see solution explorer in my screen shot and then see that I have 2 additional references).
myproject.bmp
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36514786
I have put the same has you and i still have the same issue.
refrences-2.jpg
0
 
LVL 6

Expert Comment

by:mjfagan
ID: 36514824
Did you check the UAC on the Windows 7 machine?  Turn it off or turn it as low as possible to see if that takes care of things.  I've been surprisingly annoyed at how the UAC will mess things up even with an administrator account.


0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36514846
It is now as low as it can be. I have restart my PC, but the error is till on the same part of the code.
UAC.jpg
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36514863
i see that you only have 2 refrences that are in path program files (86x).

if you look at mine, they are all in my program files(86x)

could that be the problem?
0
 
LVL 6

Expert Comment

by:mjfagan
ID: 36514907
No because you're compiling against the .NET 4.0 framework and mine's at the default for VS 2008 (earlier version of the .NET framework).

At this point, I would try breaking up that statement and assigning to variables and then run in both environments to see what values are being returned--either by displaying the values of the variables in a message box or writing to a file.
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36516138
Ok

I have a small idea of what you are saying but i can i break it to have the writting text file?
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36516242
quick question like that, this is always the one i need to use to create a windows app?


window-form-app.jpg
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 36516264
Yes.

Does it work if you do something else with Outlook like trying to read emails in inbox etc?
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36516268
I never did that before.

Is there an easy way to test that?
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 36516276
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36516308
Hello

Yes, i see the email with this code:

Option Explicit On

Imports Microsoft.Office.Interop

Public Class Form2

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim objOL As Outlook.Application
        Dim objNS As Outlook.NameSpace
        Dim objFolder As Outlook.Folders
        Dim Item As Object
        Dim myItems As Outlook.Items
        Dim x As Int16

        objOL = New Outlook.Application()
        objNS = objOL.GetNamespace("MAPI")

        Dim olfolder As Outlook.MAPIFolder
        olfolder = objOL.GetNamespace("MAPI").PickFolder
        myItems = olfolder.Items

        Dim i As Integer
        For x = 1 To myItems.Count
            MessageBox.Show(myItems.Item(x).SenderName)
            MessageBox.Show(myItems.Item(x).SenderEmailAddress)
            MessageBox.Show(myItems.Item(x).Subject)
            MessageBox.Show(myItems.Item(x).Body)
            MessageBox.Show(myItems.Item(x).to)
            MessageBox.Show(myItems.Item(x).ReceivedByName)
            MessageBox.Show(myItems.Item(x).ReceivedOnBehalfOfName)
            MessageBox.Show(myItems.Item(x).ReplyRecipientNames)
            MessageBox.Show(myItems.Item(x).SentOnBehalfOfName)
            MessageBox.Show(myItems.Item(x).CC)
            MessageBox.Show(myItems.Item(x).ReceivedTime)
        Next x
    End Sub
End Class

Open in new window

0
 
LVL 6

Expert Comment

by:mjfagan
ID: 36516338
Now go to this link and try the code at the bottom of the page to see if you can add an item to the calendar.

http://www.daniweb.com/software-development/vbnet/threads/31968
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36516365
Ok, after the test, i'm having an error under this part of the code:
Dim objFolder As Outlook.MAPIFolder = objNS.Folders.Item("Personal Folders")

cannot fin the object it says


 Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim objOutlook As Outlook.Application
        objOutlook = New Outlook.Application()
        Dim objNS As Outlook.NameSpace = objOutlook.Session

        '---------Write to Shared calendar-----------------

        'Dim objFolder As Outlook.MAPIFolder = objNS.Folders.Item("Public Folders")
        Dim objFolder As Outlook.MAPIFolder = objNS.Folders.Item("Personal Folders")

        'objFolder = objFolder.Folders.Item("All Public Folders")
        'objFolder = objFolder.Folders.Item("Boss Calendar")
        objFolder = objFolder.Folders.Item("Calendar")

        '=========Add appointment to calendar=================
        Dim objApp As Outlook.AppointmentItem
        objApp = CType(objFolder.Items.Item(Outlook.OlItemType.olAppointmentItem), Outlook.AppointmentItem)

        With objApp
            .Subject = (" Test appointment")
            .Location = "Main Office"
            .Body = ("test appointment")
            .Start = CDate("10.9.2011 10:00") ' NOTICE: This is my locale date format
            ' Added a reminder
            .ReminderMinutesBeforeStart = 60
            .ReminderSet = True
            ' Added duration
            .Duration = 120
            ' Add logged in Windows user
            .RequiredAttendees = Environment.UserName
            ' Save first
            .Save()
            ' Send to logged in Windows user
            .Send() ' NOTICE: Outlook security settings may prevent this
        End With
    End Sub

Open in new window

0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36516372
I have also tried this code, no error but it does not transfer in my calendar:

Dim objApp As Outlook.Application
        Dim objNS As Outlook.NameSpace
        Dim objFolder As Outlook.MAPIFolder
        Dim objDummy As Outlook.MailItem
        Dim objRecip As Outlook.Recipient
        Dim objAppt As Outlook.AppointmentItem
        Dim strMsg As String
        Dim strName As String
        On Error Resume Next

        ' ### name of person whose Calendar you want to use ###
        strName = "art@bell.ca"

        objApp = CreateObject("Outlook.Application")
        objNS = objApp.GetNamespace("MAPI")
        objDummy = objApp.CreateItem(Outlook.OlItemType.olMailItem)
        objRecip = objDummy.Recipients.Add(strName)
        objRecip.Resolve()
        If objRecip.Resolved Then
            'On Error Resume Next
            objFolder = _
         objNS.GetSharedDefaultFolder(objRecip, _
           Outlook.OlDefaultFolders.olFolderCalendar)
            If Not objFolder Is Nothing Then
                objAppt = objFolder.Items.Add
                If Not objAppt Is Nothing Then
                    With objAppt
                        .Subject = "Test Appointment"
                        .Start = CDate("9/10/2011 10:05 AM")
                        .End = CDate("9/10/2011 10:10 AM")
                        .Save()
                    End With
                End If
            End If

            MsgBox("Ajouté au calendrier Outlook")
        Else
            MsgBox("Could not find " & Chr(34) & strName & Chr(34), , _
                   "User not found")
        End If

        objApp = Nothing
        objNS = Nothing
        objFolder = Nothing
        objDummy = Nothing
        objRecip = Nothing
        objAppt = Nothing

Open in new window

0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36516407
Ok i have to remember that my office is in French.

So i changed my personal folder name and also the calendar.

And now, i have this error:

objApp = CType(objFolder.Items.Item(Outlook.OlItemType.olAppointmentItem), Outlook.AppointmentItem)

Open in new window


where is say:

System.Runtime.InteropServices.COMException was unhandled
  ErrorCode=-2147352567
  Message="Index of matrice outside the limites."
  Source="Microsoft Office Outlook"




 Dim objOutlook As Outlook.Application
        objOutlook = New Outlook.Application()
        Dim objNS As Outlook.NameSpace = objOutlook.Session

        '---------Write to Shared calendar-----------------

        'Dim objFolder As Outlook.MAPIFolder = objNS.Folders.Item("Public Folders")
        Dim objFolder As Outlook.MAPIFolder = objNS.Folders.Item("Dossiers personnels")

        'objFolder = objFolder.Folders.Item("All Public Folders")
        'objFolder = objFolder.Folders.Item("Boss Calendar")
        objFolder = objFolder.Folders.Item("Calendrier")

        '=========Add appointment to calendar=================
        Dim objApp As Outlook.AppointmentItem
        objApp = CType(objFolder.Items.Item(Outlook.OlItemType.olAppointmentItem), Outlook.AppointmentItem)

        With objApp
            .Subject = (" Test appointment")
            .Location = "Main Office"
            .Body = ("test appointment")
            .Start = CDate("2011-09-10 10:19") ' NOTICE: This is my locale date format
            ' Added a reminder
            .ReminderMinutesBeforeStart = 60
            .ReminderSet = True
            ' Added duration
            .Duration = 120
            ' Add logged in Windows user
            .RequiredAttendees = Environment.UserName
            ' Save first
            .Save()
            ' Send to logged in Windows user
            .Send() ' NOTICE: Outlook security settings may prevent this
        End With
    End Sub

Open in new window

0
 
LVL 6

Expert Comment

by:mjfagan
ID: 36516442
That error message is telling you that there's nothing there.  It sounds like there's possibly a difference because of the language install?  Hard to say since I've never worked with that but at this point, I would go back to my suggestion last night--break things out and see what you're getting.
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36516481
how can i break things out?
0
 
LVL 6

Expert Comment

by:mjfagan
ID: 36516545
Taking the line:

objApp = CType(objFolder.Items.Item(Outlook.OlItemType.olAppointmentItem), Outlook.AppointmentItem)


Assign the objFolder.Items.Item(Outlook.OlItemType.olAppointmentItem to a variable to see what it is.  The issue is when you're trying to convert it to an Outlook.AppointmentItem--it either can't because it's one of those types that you can't convert it to or it's because it's a NULL item (I'm suspecting the latter because of your previous index out of range error before you made the change because of the French version).
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 36516998
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36517010
Thanks,

I will try this cause i trying to Assign the objFolder.Items.Item(Outlook.OlItemType.olAppointmentItem to a variable to see what it is, but i have a hard time doing it.

But i will try the 2 link you sent me.

Thanks
0
 
LVL 11

Author Closing Comment

by:Wilder1626
ID: 36517024
Oh yessss,

this is perfect.

It's working great like this:

      Dim TempApp As Outlook.Application = New Outlook.Application()

        'An AppointmentItem 'TempAppItem' object represent one appointment              
        Dim TempAppItem As Outlook.AppointmentItem = TempApp.CreateItem(Outlook.OlItemType.olAppointmentItem)



        TempAppItem.Subject = "Create Outlook Appointment Item with VB.NET"

        TempAppItem.Body = "We can create appointment with the help of vb.net"

        'Set Location

        TempAppItem.Location = "No Location"

        'Set start  date and times

        TempAppItem.Start = Convert.ToDateTime("9/10/2011 10:00:00 AM")

        'Set  end date and times

        TempAppItem.End = Convert.ToDateTime("9/10/2011 11:00:00 AM")

        'set the Reminder box if you want Outlook to remind you the appointment is coming up.

        TempAppItem.ReminderSet = True

        TempAppItem.ReminderMinutesBeforeStart = 5


        'we can choose how the time is categorized (Busy, Tentative, Free, and so on)

        TempAppItem.BusyStatus = Outlook.OlBusyStatus.olBusy

        TempAppItem.IsOnlineMeeting = False

        ' Save to Calendar.

        TempAppItem.Save()


        TempApp = Nothing

        TempAppItem = Nothing
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

747 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

14 Experts available now in Live!

Get 1:1 Help Now