A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

VBA or Visual Basic or VSTO for outlook sync?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 13th 08, 02:12 AM posted to microsoft.public.outlook.program_vba
Alban
external usenet poster
 
Posts: 7
Default VBA or Visual Basic or VSTO for outlook sync?

Hi

I have been struggling for a while with the following problem: I am trying
to write a code that will launch 'send/receive' for an Outlook account. The
purpose is to sync back outlook to an exchange server after a 1-way sync from
google mail witout opening outlook.

I have downloaded and installed visual basic 2005 express edition and could
create a console application that perform this operation. I used the
syncobect from outlook. However, the events from outlook do not fire and I
absolutely need the syncend event to wait before ending the application. I
have been intensively trying to find a bug in my code without success

So here is my question: is my code wrong or does it come from the tools I
have been using to create the application. Do I need to use VBA or the VSTO
extension to visual studio. In that case do you know if there is a free way
to do that?

Bonus question: if you have in mind another way to automatically sync
outlook to exchange, it could also be a solution!

Thanks for reading and your help

Alban
  #2  
Old August 13th 08, 05:54 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default VBA or Visual Basic or VSTO for outlook sync?

So what are the relevant snippets of your code?
Have you tried to create a UI app rather than a command line one?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Alban" wrote in message
...
Hi

I have been struggling for a while with the following problem: I am trying
to write a code that will launch 'send/receive' for an Outlook account.
The
purpose is to sync back outlook to an exchange server after a 1-way sync
from
google mail witout opening outlook.

I have downloaded and installed visual basic 2005 express edition and
could
create a console application that perform this operation. I used the
syncobect from outlook. However, the events from outlook do not fire and I
absolutely need the syncend event to wait before ending the application. I
have been intensively trying to find a bug in my code without success

So here is my question: is my code wrong or does it come from the tools I
have been using to create the application. Do I need to use VBA or the
VSTO
extension to visual studio. In that case do you know if there is a free
way
to do that?

Bonus question: if you have in mind another way to automatically sync
outlook to exchange, it could also be a solution!

Thanks for reading and your help

Alban



  #3  
Old August 13th 08, 06:43 PM posted to microsoft.public.outlook.program_vba
Alban
external usenet poster
 
Posts: 7
Default VBA or Visual Basic or VSTO for outlook sync?

Here is my code. I also linked the COM microsoft OUtlook library. I need a
console as I would like to then schedule the task without any user
interaction.

I am still confused with catching event. The more I read on the web, the
less I clarify the way events are treated in VB.NEt, VB, VBA and the role of
VSTO...


Imports Outlook = Microsoft.Office.Interop.Outlook

Module Module1

Public bSendReceiveEnded As Boolean
Public WithEvents mySync As Outlook.SyncObject

Sub mySync _SyncEnd()
MsgBox("triggered")
bSendReceiveEnded = True
End Sub

Sub Main()

' Create an Outlook application.
Dim oApp As Outlook._Application = New Outlook.Application
' Create the name space.
Dim oNS As Outlook._NameSpace = oApp.GetNamespace("mapi")
Dim oSyncs As Outlook.SyncObjects

bSendReceiveEnded = False
oSyncs = oNS.SyncObjects
mySync = oSyncs.Item(3)

' Send and receive.
instance.Start()
Do While bSendReceiveEnded = False
System.Windows.Forms.Application.DoEvents()
Loop

oSyncs = Nothing
oNS = Nothing
oApp = Nothing
End Sub

End Module
  #4  
Old August 13th 08, 07:33 PM posted to microsoft.public.outlook.program_vba
Alban
external usenet poster
 
Posts: 7
Default VBA or Visual Basic or VSTO for outlook sync?

I made a typo in the previous post, sorry please read
mySync .start()
instead of
instance.start()

  #5  
Old August 13th 08, 11:48 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default VBA or Visual Basic or VSTO for outlook sync?

Does it work if you replace the DoEvents loop with a call to MessageBox()
(which also runs the message loop)?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Alban" wrote in message
...
Here is my code. I also linked the COM microsoft OUtlook library. I need a
console as I would like to then schedule the task without any user
interaction.

I am still confused with catching event. The more I read on the web, the
less I clarify the way events are treated in VB.NEt, VB, VBA and the role
of
VSTO...


Imports Outlook = Microsoft.Office.Interop.Outlook

Module Module1

Public bSendReceiveEnded As Boolean
Public WithEvents mySync As Outlook.SyncObject

Sub mySync _SyncEnd()
MsgBox("triggered")
bSendReceiveEnded = True
End Sub

Sub Main()

' Create an Outlook application.
Dim oApp As Outlook._Application = New Outlook.Application
' Create the name space.
Dim oNS As Outlook._NameSpace = oApp.GetNamespace("mapi")
Dim oSyncs As Outlook.SyncObjects

bSendReceiveEnded = False
oSyncs = oNS.SyncObjects
mySync = oSyncs.Item(3)

' Send and receive.
instance.Start()
Do While bSendReceiveEnded = False
System.Windows.Forms.Application.DoEvents()
Loop

oSyncs = Nothing
oNS = Nothing
oApp = Nothing
End Sub

End Module



  #6  
Old August 14th 08, 12:12 AM posted to microsoft.public.outlook.program_vba
Alban
external usenet poster
 
Posts: 7
Default VBA or Visual Basic or VSTO for outlook sync?

1/ I do not have such a function, am I missing a reference?
2/ what do you mean by "which also runs the message loop"?
3/ Apparently, it is not related to the loop. I have made a windows
application and launch the previous code at the click of a button. No event
is catched, whatever event I try to catch from outlook.

Note: I installed outlookspy toolbar I could see outlook event firing from
action generated by my code while my code could not see them


"Dmitry Streblechenko" wrote:

Does it work if you replace the DoEvents loop with a call to MessageBox()
(which also runs the message loop)?

--


  #7  
Old August 14th 08, 08:17 AM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default VBA or Visual Basic or VSTO for outlook sync?

What is your code that uses button click?
Is there a particular reason why you use sync object with thee index 3/ Have
you tried 1 (which in most cases is "Send/Receive All")?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Alban" wrote in message
...
1/ I do not have such a function, am I missing a reference?
2/ what do you mean by "which also runs the message loop"?
3/ Apparently, it is not related to the loop. I have made a windows
application and launch the previous code at the click of a button. No
event
is catched, whatever event I try to catch from outlook.

Note: I installed outlookspy toolbar I could see outlook event firing from
action generated by my code while my code could not see them


"Dmitry Streblechenko" wrote:

Does it work if you replace the DoEvents loop with a call to MessageBox()
(which also runs the message loop)?

--




 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
can't load VSTO outlook addin outside visual... fbolefeysot Add-ins for Outlook 5 February 28th 08 02:31 PM
Outlook - synchronize contatcs by visual basic aplicaton Markus Brunner Outlook and VBA 5 December 7th 07 04:55 AM
Create Outlook COM add-ins in Visual Basic 2005 Express Edition Lucia Outlook and VBA 3 September 19th 06 06:31 PM
MS Visual Basic error in Outlook XP User Outlook - General Queries 3 May 7th 06 12:45 PM
Visual Basic and OE [email protected] Outlook Express 1 February 8th 06 01:35 PM


All times are GMT +1. The time now is 10:39 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.