How Open Existing Calendar C#

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
}
}

}
 
You can either set ActiveExplorer.CurrentFolder to that calendar or, to show
it in
another window, use the MAPIFolder.Display method.
 
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

}

}
 
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
}
 
Outlook version? Did you try setting ActiveExplorer.CurrentFolder?
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
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;
}
}
 
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.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
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.
 
Back
Top