Re: Permissions on other users' calendars / recurring appointments
- From: Tadwick <Tadwick@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 7 Oct 2006 23:44:01 -0700
In VBA, yes I do.
"Dmitry Streblechenko" wrote:
Interesting... But do you get the eexpected value if you assign the variable.
declared as Outlook.AppointmentItem to a variable declared as Object?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Tadwick" <Tadwick@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7DE82693-87A5-4393-8D8A-181AF347D969@xxxxxxxxxxxxxxxx
It seems to happen to all recurring activities whether they are open ended
or
not. If I create a recurring appointment and invite another user, when I
retrieve my recurring appointment from their calendar I get the master
appointment start date for each occurence.
A similar thing seems to happen in VBA if I define the item as
Outlook.AppointmentItem instead of object.
Tad
"Dmitry Streblechenko" wrote:
Hmmm.. Does it happen only with a particular activity or with all
recurring
activities?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Tadwick" <Tadwick@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:9144E33B-001E-4E00-B37A-4BB1AABA2D1F@xxxxxxxxxxxxxxxx
Dimitry,
It doesn't make any difference. I coded it exactly in the same order
as
the
VBA and same result. When I grant myself Editor permissions on the
other
user's calendar the date of the recurring items is that of the actual
occurence. When I have simply Reviewer permissions, then the start
date
is
that of the master appointment not the actual occurence.
Tad
-----------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
using Outlook = Microsoft.Office.Interop.Outlook;
using System.Windows.Forms;
namespace ConsoleApplication1
{
public partial class Program
{
static void Main(string[] args)
{
bool Foobar = false;
Foobar = GetAppointments();
}
private static bool GetAppointments()
{
Outlook.Application oApp = new Outlook.Application();
Outlook.NameSpace oNS = oApp.GetNamespace("MAPI");
Outlook.AppointmentItem oAppt = null;
int intFoo = 0;
//create recipient
Outlook.Recipient oRcp =
oNS.CreateRecipient("sales@xxxxxxxxxxxxxx");
//Get calendar info (appointments)
Outlook.MAPIFolder oFdr = oNS.GetSharedDefaultFolder(oRcp,
Outlook.OlDefaultFolders.olFolderCalendar);
if (oFdr != null)
{
Outlook.Items oItms = (Outlook.Items)oFdr.Items;
oItms.Sort("[Start]", false);
oItms.IncludeRecurrences = true; //blnIncludeRecurrences;
oItms.Sort("[Start]", false);
string strFilter = "([End] > \"September 1, 2006 12:00 AM\"
AND
[Start] <= \"March 1, 2007 12:00 AM\")";
Outlook.Items oApps = oItms.Restrict(strFilter);
try
{
oAppt = (Outlook.AppointmentItem)oApps.GetFirst();
intFoo = (int)oAppt.Class;
}
catch
{
intFoo = 0;
}
if (intFoo == 26)
{
while (oAppt != null)
{
System.Windows.Forms.MessageBox.Show("Subject = " +
oAppt.Subject + " Start = " + oAppt.Start.ToString("MMM dd, yyyy
HH:mm"));
oAppt = (Outlook.AppointmentItem)oApps.GetNext();
}
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
}
}
"Dmitry Streblechenko" wrote:
The major difference is that in VB you call Sort, then Restrict. In C#
you
have it the other way around and you call Sort on oApps, not oItms .
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Tadwick" <Tadwick@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A1089F96-722D-48DF-8383-7A1108E0954E@xxxxxxxxxxxxxxxx
Dmitry,
Here's the C# code that Ken and I have both tested. In his case, he
got
the
correct date for each recurrence but I don't know the permissions he
had.
In
my case with reviewer permissions I did not get the right date for
each
occurence, I just got the master start date. Below is the VBA code.
using System;
using System.Collections.Generic;
using System.Text;
using Outlook = Microsoft.Office.Interop.Outlook;
using System.Windows.Forms;
namespace ConsoleApplication1
{
public partial class Program
{
static void Main(string[] args)
{
bool Foobar = false;
Foobar = GetAppointments();
}
private static bool GetAppointments()
{
Outlook.Application oApp = new Outlook.Application();
Outlook.NameSpace oNS = oApp.GetNamespace("MAPI");
Outlook.AppointmentItem oAppt = null;
int intFoo = 0;
//create recipient
Outlook.Recipient oRcp =
oNS.CreateRecipient("sales@xxxxxxxxxxxxxx");
//Get calendar info (appointments)
Outlook.MAPIFolder oFdr = oNS.GetSharedDefaultFolder(oRcp,
Outlook.OlDefaultFolders.olFolderCalendar);
if (oFdr != null)
{
Outlook.Items oItms = (Outlook.Items)oFdr.Items;
oItms.IncludeRecurrences = true;
string strFilter = "([End] > \'September 1, 2006 12:00
AM\'
AND
[Start] <= \'March 1, 2007 12:00 AM\')";
Outlook.Items oApps = oItms.Restrict(strFilter);
oApps.Sort("[Start]", false);
oApps.IncludeRecurrences = true; //blnIncludeRecurrences;
try
{
oAppt = (Outlook.AppointmentItem)oApps.GetFirst();
intFoo = (int)oAppt.Class;
}
catch
{
intFoo = 0;
}
if (intFoo == 26)
{
while (oAppt != null)
{
System.Windows.Forms.MessageBox.Show("Subject = "
+
oAppt.Subject + " Start = " +
oAppt.Start.ToString("MMM dd, yyyy HH:mm"));
oAppt = (Outlook.AppointmentItem)oApps.GetNext();
}
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
}
}
Here's the VBA code:
Sub GetRecipientAppointments
Dim oRcp As Outlook.recipient
Dim oFdr As Outlook.MAPIFolder
Dim oItms As Outlook.Items
Dim oAItms As Outlook.Items
Dim oAItm As Object
Dim datStart As Date
Dim datEnd As Date
Dim datRecent As Date
Dim strFind As String
Set oApp = Application
Set oNS = oApp.GetNamespace("MAPI")
Set oAL = oNS.AddressLists("Global Address List")
Set oRcp = oNS.CreateRecipient(dubya@xxxxxxxxxxxxxxxxxxxxxxx)
'Get recipient calendar info
On Error Resume Next
Set oFdr = oNS.GetSharedDefaultFolder(oRcp, olFolderCalendar)
On Error GoTo 0
If oFdr Is Nothing Then
Debug.Print recipient & " -- access denied --"
Else
Set oItms = Nothing
Set oItms = oFdr.Items
oItms.SetColumns
("Subject,Start,End,BusyStatus,LastModificationTime,IsRecurring")
oItms.Sort "[Start]", False
oItms.IncludeRecurrences = True
oItms.Sort "[Start]", False
datStart = DateSerial(Year(Date), Month(Date), 1)
datEnd = DateAdd("m", 2, datStart)
datRecent = DateAdd("m", -1, datStart)
strFind = "([End] > " & Quote(Format(datStart, "mmmm d, yyyy
hh:mm
AMPM")) & " AND [Start] <= " & Quote(Format(datEnd, "mmmm d, yyyy
hh:mm
AMPM")) & ") "
'strFind = "[Start] > " & Quote(Format(datStart, "mmmm d, yyyy
hh:mm
AMPM"))
'Set oAItm = oItms.Find(strFind) '(strFind)
Set oAItms = oItms.Restrict(strFind)
For Each oAItm In oAItms
Debug.Print oAItm.Start & " " & oAItm.End & " " &
oAItm.Subject
'Set oAItm = oItms.FindNext
Next
End If
Set oFdr = Nothing
End Sub
Function Quote(MyText)
Quote = Chr(34) & MyText & Chr(34)
End Function
"Dmitry Streblechenko" wrote:
- References:
- Re: Permissions on other users' calendars / recurring appointments
- From: Dmitry Streblechenko
- Re: Permissions on other users' calendars / recurring appointments
- From: Tadwick
- Re: Permissions on other users' calendars / recurring appointments
- From: Dmitry Streblechenko
- Re: Permissions on other users' calendars / recurring appointments
- Prev by Date: Re: Outlook 2003 Script How to put a value in ContactName
- Next by Date: Re: How to make the transport skip a recipient - I'm using exchange
- Previous by thread: Re: Permissions on other users' calendars / recurring appointments
- Next by thread: Re: Distribution List Resolution with new Contact List
- Index(es):
Relevant Pages
|
Loading