M
Mk23
Hi
I have a problem by getting the appointment from an calendar folder. I use
the PIA from Office XP and have a Outlook 2007. At the most customer it works
fine, but at a few PC's it doesn't work. That mean, i get no appointment
items, althought the user has a lot of them in his calendar.
I get the items by the following sample code:
//Select folder
Microsoft.Office.Interop.Outlook.Application app = new
Microsoft.Office.Interop.Outlook.Application();
NameSpace olNameSpace = app.Session;
olFolder = olNameSpace.PickFolder();
//Create filter string
CultureInfo userCulture = new CultureInfo(GetUserDefaultLCID());
string restrictExpression = string.Format("[Start]>='{0}' AND
[Start]<'{1}'",
_dateFrom.Value.ToString("g", userCulture.DateTimeFormat),
_dateTill.Value.ToString("g", userCulture.DateTimeFormat));
//Get filtered items and sort them
Items folderItems = olFolder.Items;
Items restrictedItems = folderItems.Restrict(restrictExpression);
restrictedItems.Sort("[Start]", Missing.Value);
//Loop all appointment elements
object itemObject = restrictedItems.GetFirst();
while (itemObject != null)
{
...
}
Does anyone have an hint for me
Regards
Thomas
I have a problem by getting the appointment from an calendar folder. I use
the PIA from Office XP and have a Outlook 2007. At the most customer it works
fine, but at a few PC's it doesn't work. That mean, i get no appointment
items, althought the user has a lot of them in his calendar.
I get the items by the following sample code:
//Select folder
Microsoft.Office.Interop.Outlook.Application app = new
Microsoft.Office.Interop.Outlook.Application();
NameSpace olNameSpace = app.Session;
olFolder = olNameSpace.PickFolder();
//Create filter string
CultureInfo userCulture = new CultureInfo(GetUserDefaultLCID());
string restrictExpression = string.Format("[Start]>='{0}' AND
[Start]<'{1}'",
_dateFrom.Value.ToString("g", userCulture.DateTimeFormat),
_dateTill.Value.ToString("g", userCulture.DateTimeFormat));
//Get filtered items and sort them
Items folderItems = olFolder.Items;
Items restrictedItems = folderItems.Restrict(restrictExpression);
restrictedItems.Sort("[Start]", Missing.Value);
//Loop all appointment elements
object itemObject = restrictedItems.GetFirst();
while (itemObject != null)
{
...
}
Does anyone have an hint for me
Regards
Thomas