Hi,
i'm trying to retreive the appointments from different profiles of
outlook.
My outlook has 3 profiles created.('Sampl e1','Sample2',' Sample3')
my form contains 3 buttons.each one for each profile.
so when user clicks on a button my code has to show the appointments
for that particular profile that was given there.
i wrote a small procedure for that
here's the code:
----------------------------
Private Sub btnProfile1_Cli ck(ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles btnProfile1.Cli ck
olProfile("Samp le1")
End Sub
Private Sub btnProfile2_Cli ck(ByVal sender As System.Object, ByVal
e As System.EventArg s) Handles btnProfile2.Cli ck
olProfile("Samp le2")
End Sub
Private Sub btnProfile3_Cli ck(ByVal sender As System.Object, ByVal
e As System.EventArg s) Handles btnProfile3.Cli ck
olProfile("Samp le3")
End Sub
//This is the procedure....
Private Sub olProfile(ByVal profile As String)
MsgBox("Generat ing for the profile:" & profile)
Dim appProfile As Outlook.Applica tion = New
Outlook.Applica tion()
Dim nsProfile As Outlook.NameSpa ce =
appProfile.GetN amespace("mapi" )
nsProfile.Logon (profile, , False, True)
Dim fldrProfile As Outlook.MAPIFol der =
nsProfile.GetDe faultFolder(Out look.OlDefaultF olders.olFolder Calendar)
Dim aProfile As Outlook.Items = fldrProfile.Ite ms
Dim aptProfile As Outlook.Appoint mentItem
Dim iProfile As Integer
MsgBox("Appoint ment Information from the profile" & profile)
MsgBox(aProfile .Count)
aptProfile = aProfile.GetFir st
For iProfile = 0 To aProfile.Count - 1
MsgBox("Subject :" & aptProfile.Subj ect & vbCrLf & "
Location:" & aptProfile.Loca tion & vbCrLf & "Start Time:" &
aptProfile.Star t & vbCrLf & " End Time:" & aptProfile.End)
aptProfile = aProfile.GetNex t
Next
nsProfile.Logof f()
appProfile = Nothing
nsProfile = Nothing
aProfile = Nothing
aptProfile = Nothing
End Sub
----------------------------------------
When i click on one of button it's showing the appointments for that
profile.If i click another button then also it's working fine.
HERE's the problem:
From then onwards if i click any button it's showing the previous
profile's appointments only,irrespecti ve of the button.
here i was caught....how to get rid of this...?
Is there any way to check whether outlook application was launched or
not...if so with what profile??
Can anyone please help me....
Thanks in advance...
Srinivas 1 1718
srinivas,
For starters you are not really releasing the Outlook objects! appProfile = Nothing nsProfile = Nothing aProfile = Nothing aptProfile = Nothing End Sub
Remember in .NET we have the GC, setting an object to Nothing, does exactly
that it sets it to Nothing. The GC will at its leisure release the object
(more importantly the COM object). This will cause Outlook to "remain" open,
hence you are getting the same session...
Instead of setting the (COM) objects to Nothing, you should call
ReleaseComObjec t (in a loop) for each of your COM Objects (objects returned
from Outlook).
See: System.Runtime. InteropServices .Marshal.Releas eComObject
This will ensure that the Outlook COM objects are released allowed Outlook
to close. However I do not have multiple profiles to try your sample on...
The following site has a plethora of articles on using Outlook from .NET. http://www.microeye.com/resources/res_outlookvsnet.htm
Although not necessarily .NET both of these have a lot of Outlook
programming examples & information: http://www.outlookcode.com/ http://www.slipstick.com/dev/index.htm
Hope this helps
Jay
"srinivas" <sr************ @bharatmail.com > wrote in message
news:e9******** *************** ***@posting.goo gle.com... Hi, i'm trying to retreive the appointments from different profiles of outlook. My outlook has 3 profiles created.('Sampl e1','Sample2',' Sample3') my form contains 3 buttons.each one for each profile. so when user clicks on a button my code has to show the appointments for that particular profile that was given there. i wrote a small procedure for that here's the code: ---------------------------- Private Sub btnProfile1_Cli ck(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnProfile1.Cli ck olProfile("Samp le1") End Sub
Private Sub btnProfile2_Cli ck(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnProfile2.Cli ck olProfile("Samp le2") End Sub
Private Sub btnProfile3_Cli ck(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnProfile3.Cli ck olProfile("Samp le3") End Sub
//This is the procedure.... Private Sub olProfile(ByVal profile As String) MsgBox("Generat ing for the profile:" & profile)
Dim appProfile As Outlook.Applica tion = New Outlook.Applica tion() Dim nsProfile As Outlook.NameSpa ce = appProfile.GetN amespace("mapi" )
nsProfile.Logon (profile, , False, True) Dim fldrProfile As Outlook.MAPIFol der = nsProfile.GetDe faultFolder(Out look.OlDefaultF olders.olFolder Calendar) Dim aProfile As Outlook.Items = fldrProfile.Ite ms Dim aptProfile As Outlook.Appoint mentItem Dim iProfile As Integer MsgBox("Appoint ment Information from the profile" & profile) MsgBox(aProfile .Count) aptProfile = aProfile.GetFir st
For iProfile = 0 To aProfile.Count - 1 MsgBox("Subject :" & aptProfile.Subj ect & vbCrLf & " Location:" & aptProfile.Loca tion & vbCrLf & "Start Time:" & aptProfile.Star t & vbCrLf & " End Time:" & aptProfile.End) aptProfile = aProfile.GetNex t Next nsProfile.Logof f() appProfile = Nothing nsProfile = Nothing aProfile = Nothing aptProfile = Nothing
End Sub
---------------------------------------- When i click on one of button it's showing the appointments for that profile.If i click another button then also it's working fine. HERE's the problem: From then onwards if i click any button it's showing the previous profile's appointments only,irrespecti ve of the button. here i was caught....how to get rid of this...? Is there any way to check whether outlook application was launched or not...if so with what profile?? Can anyone please help me.... Thanks in advance...
Srinivas This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: gani |
last post by:
hi,
how to get the fullpath of created IsolatedStorage directory.
thanks.
--
gani
|
by: Chirag Malvi |
last post by:
hello all,
I am developing the web application using ASP.net and VS.2003 IDE.
here is the situation which i want to implement.
1) User is browsing some webform. I want to trap this event. this i am doing
with Session_Onstart.
2) Now when user is exiting i.e. closing the browser window i want to trap
this event and perform some operation. I tried using Session_OnEnd event,but
|
by: scorpion53061 |
last post by:
Very urgent and I am very close but need a little help to get me over the
edge........
I need to write these columns to a html file with each row containing these
columns (seperated by breaks). Currently this code write all columns to a
single row which works but is not what the boss wants. If anyone has
suggestions how you would do a report like this I very much would like to
hear them as well. vb.net windows app.
...
|
by: |
last post by:
Hi all, I have a website running on beta 2.0 on server 2003 web sp1 and I
keep getting the following error:-
Error In:
http://www.mywebsite.org/WebResource.axd?d=5WvLfhnJp5Lc8WhQSD4gdA2&t=632614619884218750
--------------------------------------------------------------------------------
System.Security.Cryptography.CryptographicException: Padding is invalid and
cannot be removed. at...
|
by: DraguVaso |
last post by:
Hi,
I have files I need to read, which contains records with a variable lenght.
What I need to do is Copy a Part of such a File to a new File, based on the
a Begin- and End-record.
I used this functions:
Dim intMyFile As Integer = FreeFile()
FileOpen(intMyFile, MakePathFile(strDirS, strFileS), OpenMode.Input,
OpenAccess.Read, OpenShare.Shared, -1)
| |
by: Liam.M |
last post by:
HEY GUYS,
need some urgent help here....I am querying my database based on a
DueDate field...and want to send an automated email to anyone that
falls within two months PRIOR to this "DueDate", so far the Code is
querying the database and trying to run a module I created, title
SendMail, however it is having trouble sending the email for some
reason... any suggestions as to why....here is the code:
|
by: Adrian Parker |
last post by:
We've suddenly started getting a problem with a call to clear the contents
of a DataTable. This is on a live customer site that's been working fine
until yesterday. As far as we know they've not changed or updated the
server in any way.
"There is no row at position 42"
at System.Data.RBTree`1.GetNodeByIndex(int32 userIndex)
at System.Data.DataTable.Clear(Boolean clearAll)
at system.Data.DataTable.Clear()
|
by: keri |
last post by:
Please help. I have a database I built but have not used for ages.
When I have come to make some changes today in VBA I get the error
cannot find project or library
I have references to
Visual basic for applications
Access 9.0 object library
OLE automation
DAO 3.6 object library
|
by: vicky2007 |
last post by:
Hi,
I am a Student, and I have a Query related to software developing in
"ASP.NET 2.0 with C# " and the problem is:-
1)In ASP.net 2.0 with C#, I am developing a software which has a reqirement of :
To create Textbox, Button and a Grid Inside the "Inbox.aspx" Form, then write a particular EMail-ID inside the Textbox and create a button Dynamically in Toolbar of “Microsoft Outlook” application, on which when we click then the...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |