Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Interop / March 2005

Tip: Looking for answers? Try searching our database.

How Open Existing Calendar C#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve B. - 04 Feb 2005 12:31 GMT
Now that I found the Outlook public folder containing an existing
calendar, how do I open it ?

And , what if the XP network user has Outlook closed or minimized in the
background how should I address Logon() or do I need to address it.

************************
openOutlookFolder(string publicFolderLevel1, ..2, ..3)
{

Application olApp = new ApplicationClass();
NameSpace olNS = olApp.GetNamespace("MAPI");

MAPIFolder objFolder
= olNS.GetDefaultFolder(.OlDefaultFolders.olPublicFoldersAllPublicFolders);

//nested foreach & if at third level
foreach (objfolder3 in objfolder2.Folders)
{
if (objfolder3.Name == publicFolderLevel3)
{
//I found folder containing the existing "confRoomCalendar"
//How do I open it in Outlook?
}
}

}
Sue Mosher [MVP-Outlook] - 21 Feb 2005 13:57 GMT
You can either set ActiveExplorer.CurrentFolder to that calendar or, to show
it in
another window, use the MAPIFolder.Display method.

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> Now that I found the Outlook public folder containing an existing
> calendar, how do I open it ?
[quoted text clipped - 24 lines]
>
> }
Steve B. - 02 Mar 2005 14:43 GMT
Sorry Sue - I guess I don't understand

The method below selects the proper folder,  but the folder, containing the
calendars, is closed  (plus sign).  If you open the folder the calendars
show.  In addition, the  folder pane in Outlook does not move to show the
selected highlighted folder to the user (you have to scroll down to the
folder and then open it up)

How can I move the user Outlook folder pane so the folder selected is shown
in the pane and open the folder so they see the calendars.

if (objfolder3.Name == publicFolderLevel3)
{
//objfolder3.Display();   // highlights proper folder

....Outlook.Explorer explorers = objfolder3.GetExplorer(...Normal);
//now what do I do?
explorers.Activate();    // highlights proper folder            
}

> You can either set ActiveExplorer.CurrentFolder to that calendar or, to show
> it in
[quoted text clipped - 28 lines]
> >
> > }
Sue Mosher [MVP-Outlook] - 02 Mar 2005 17:03 GMT
Outlook version? Did you try setting ActiveExplorer.CurrentFolder?
Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> Sorry Sue - I guess I don't understand
>
[quoted text clipped - 52 lines]
>> >
>> > }
Steve B. - 03 Mar 2005 16:51 GMT
Sue,

Outlook verision 2003, SP1

I understand why the code below runs right by the calendar I want, my
problem is how to stop it and open it up properly.   Comments?  Seems to
debug O'k.

Steve

if (objfolder3.Name == publicFolderLevel3)
{
...Interop.Outlook.Explorer olExplorer = olApp.ActiveExplorer();

IEnumerator EmpEnumerator = objfolder3.Folders.GetEnumerator();
EmpEnumerator.Reset();

// 6 = objfolder3.Folders.Count;

while(EmpEnumerator.MoveNext())     
{
olExplorer.CurrentFolder = (....MAPIFolder)EmpEnumerator.Current;

if(olExplorer.Caption.ToString()  ==  confRmName)
{
olExplorer.Activate();
//olExplorer.CurrentFolder = null;
//EmpEnumerator= null;
//break;   
}
}

> Outlook version? Did you try setting ActiveExplorer.CurrentFolder?
> > Sorry Sue - I guess I don't understand
[quoted text clipped - 53 lines]
> >> >
> >> > }
Sue Mosher [MVP-Outlook] - 03 Mar 2005 17:02 GMT
I still don't understand what you mean by "properly," but if you want to
show an additional folder in the Calendar pane, you set
ActiveExplorer.IsFolderSelected.

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> Sue,
>
[quoted text clipped - 29 lines]
>
>> Outlook version? Did you try setting ActiveExplorer.CurrentFolder?

>> > Sorry Sue - I guess I don't understand
>> >
[quoted text clipped - 55 lines]
>> >> >
>> >> > }
Helmut Obertanner - 03 Mar 2005 19:16 GMT
Hello Sue, hello Steve,

i have a function here, don't know if it helps.
It uses the Built in Outlook function from CommandBar "GoToFolder":

myOutlookExplorer is the ActiveExplorer.

The FolderPath is something like:

"PublicCalendar"

or

"res://C:\CRM\webresource.dll/index.htm"

for an FolderHomepage from a dll.

/// <summary>

/// Change the Explorer to another Folder

/// </summary>

/// <param name="FolderPath"></param>

private void GotoFolder(string FolderPath)

{

try

{

Office.CommandBarComboBox myCombo = (Office.CommandBarComboBox)
myOutlookExplorer.CommandBars.FindControl(26, 1740,myMissing,myMissing);

if (myCombo != null)

{

myCombo.Text = FolderPath;

Marshal.ReleaseComObject (myCombo);

}

}

catch (System.Exception ex)

{

Logger.LogError (CLASS_NAME , "GotoFolder",ex,FolderPath);

}

}

Hope that Helps,

Greets, Helmut Obertanner.

> Sue,
>
[quoted text clipped - 88 lines]
>> >> >
>> >> > }
Helmut Obertanner - 21 Feb 2005 19:35 GMT
Hi Steve, hi Sue

here is a nice trick.
Use the embedded "Goto... Folder" Control.

Just put in the FolderPath / Name, and Outlook changes to your Folder.

Greets, Helmut Obertanner
/// <summary>

/// Change the Explorer to another Folder

/// </summary>

/// <param name="FolderPath"></param>

private void GotoFolder(string FolderPath)

{

try

{

Office.CommandBarComboBox myCombo = (Office.CommandBarComboBox)
myOutlookExplorer.CommandBars.FindControl(26, 1740,myMissing,myMissing);

if (myCombo != null)

{

myCombo.Text = FolderPath;

Marshal.ReleaseComObject (myCombo);

}

}

catch (System.Exception ex)

{

// TODO: Log Error

}

}

> Now that I found the Outlook public folder containing an existing
> calendar, how do I open it ?
[quoted text clipped - 24 lines]
>
> }
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.