E
eranhef
Hey,
I'm trying to programmatically create a user-defined field to a new
calendar folder that my application creates.
Can anyone help me?
I'm using vsto 2005 + C#.
Attached by the folder creation method:
private bool CreateSstFolder(string folderName,ThisApplication app)
{
Outlook.NameSpace mapi = app.GetNamespace("MAPI");
Outlook.MAPIFolder calendar =
mapi.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar) as
Outlook.MAPIFolder;
Outlook.MAPIFolder targetFolder = null;
Outlook.MAPIFolder newFolder = null;
if ( calendar != null && calendar.Parent is Outlook.MAPIFolder)
{
//Outlook.MAPIFolder rootFolder =
(Outlook.MAPIFolder)calendar.Parent;
Outlook.MAPIFolder rootFolder = calendar;
if( rootFolder != null )
{
foreach (Outlook.MAPIFolder folder in rootFolder.Folders)
{
if (folder.Name.Equals(folderName))
{
targetFolder = folder;
break;
}
}
if( targetFolder == null )
{
newFolder = rootFolder.Folders.Add(folderName,
System.Reflection.Missing.Value);
return true;
}
}
}
return false;
}
Tnx in advance -
Eran Hefer.
I'm trying to programmatically create a user-defined field to a new
calendar folder that my application creates.
Can anyone help me?
I'm using vsto 2005 + C#.
Attached by the folder creation method:
private bool CreateSstFolder(string folderName,ThisApplication app)
{
Outlook.NameSpace mapi = app.GetNamespace("MAPI");
Outlook.MAPIFolder calendar =
mapi.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar) as
Outlook.MAPIFolder;
Outlook.MAPIFolder targetFolder = null;
Outlook.MAPIFolder newFolder = null;
if ( calendar != null && calendar.Parent is Outlook.MAPIFolder)
{
//Outlook.MAPIFolder rootFolder =
(Outlook.MAPIFolder)calendar.Parent;
Outlook.MAPIFolder rootFolder = calendar;
if( rootFolder != null )
{
foreach (Outlook.MAPIFolder folder in rootFolder.Folders)
{
if (folder.Name.Equals(folderName))
{
targetFolder = folder;
break;
}
}
if( targetFolder == null )
{
newFolder = rootFolder.Folders.Add(folderName,
System.Reflection.Missing.Value);
return true;
}
}
}
return false;
}
Tnx in advance -
Eran Hefer.