![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I want to create a program in c# that can read my appointmentitems in
all shared calendars, and detect the user of that item. If its possible to read the shared calendar, can I read the user, or do I have to create a new field or something ? |
Ads |
#2
|
|||
|
|||
![]()
What do you mean by "detect the user"?
You can use NameSpace.GetSharedDefaultFolder(olFolderCalendar) to get the default Calendar folders for any mailboxes where you have the appropriate permissions. If the shared mailbox is loaded as part of your Outlook profile you can iterate the NameSpace.Folders collection to hit each loaded shared mailbox and from there dig down through the various Folders collections to find any folder of any type. Once you have a folder you get its Items collection. The Organizer is who created an item. If something changes in an appointment you can use a lower level API such as CDO 1.21 or Extended MAPI or Redemption (www.dimastr.com/redemption) to read the PR_LAST_MODIFIER_NAME property (0x3FFA001E ) which is a PT_STRING8 property that gives the name of the last person to modify the item. That's not exposed in the Outlook object model. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm wrote in message ups.com... I want to create a program in c# that can read my appointmentitems in all shared calendars, and detect the user of that item. If its possible to read the shared calendar, can I read the user, or do I have to create a new field or something ? |
#3
|
|||
|
|||
![]()
Could you please show a bit code about the iteration? I guess it has
something to do with foreach, but not too sure how to use it. |
#4
|
|||
|
|||
![]()
Please put some of the preceding thread in your posts, it makes it easier to
follow a thread. foreach is a very slow loop, if you have a lot of items it will take a long time. A plain for loop is faster. You didn't answer my question about what you mean by "detect the user". And what version of Outlook are you programming against? For GetSharedDefaultFolder you need to supply a Recipient object as well as a folder type. The Recipient is the user who's calendar is being opened. Assuming that a NameSpace object (oNS) has already been instantiated C# code to iterate a calendar folder's Items collection would look something like this: Outlook.Recipient oRecip = (Outlook.Recipient)oNS.CreateRecipient("Joe Foobar"); Outlook.MAPIFolder oFolder = (Outlook.MAPIFolder)oNS.GetSharedDefaultFolder(oRe cip, Outlook.OlDefaultFolders.olFolderCalendar); Outlook.Items colItems = (Outlook.Items)oFolder.Items; int I = colItems.Count; Outlook.AppointmentItem oItem = null; for(int J = 1; J = I; J++) { oItem = (Outlook.AppointmentItem)colItems[J]; //whatever } Of course this code doesn't check to verify that a valid Recipient was created and does no error trapping at all. It doesn't check to make sure that the item is actually an AppointmentItem. In real life there'd be a bunch of try{ } catch{ } blocks and so on. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm wrote in message ps.com... Could you please show a bit code about the iteration? I guess it has something to do with foreach, but not too sure how to use it. |
#5
|
|||
|
|||
![]()
You didn't answer my question about what you mean by "detect the user". And
what version of Outlook are you programming against? I meant that I want to see what users there is in the "users list" or whatever it is. When I add a user to the recipients collection, I would not need to use the whole name. For example, If I in outlook have the main user called Robert Andersson, I would just have to use Recipient Rec = (Recipient)oNS.CreateRecipient("Robert"). If I would like to see the name for this user, I could use Rec.Name and it would display Robert Andersson. So when I saw that this was possible I was sure that this names must be stored somewhere, and thats what I need to find out how to get those names. And I use Outlook 2003. |
#6
|
|||
|
|||
![]()
You can't get the shared calendars unless you know the alias names of the
available recipients. Plus you would need permissions to open their calendars. You can read the Global Address List, which is one of your AddressLists. Open the AddressLists collection and get the GAL AddressList. You can then iterate that list and get the names of everyone available. You can then try opening each calendar using the name you just got and creating a Recipient object for that name. That of course doesn't guarantee that you will succeed, you need permissions, so be prepared to handle errors when you try to open the folder using GetSharedDefaultFolder. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm wrote in message ps.com... You didn't answer my question about what you mean by "detect the user". And what version of Outlook are you programming against? I meant that I want to see what users there is in the "users list" or whatever it is. When I add a user to the recipients collection, I would not need to use the whole name. For example, If I in outlook have the main user called Robert Andersson, I would just have to use Recipient Rec = (Recipient)oNS.CreateRecipient("Robert"). If I would like to see the name for this user, I could use Rec.Name and it would display Robert Andersson. So when I saw that this was possible I was sure that this names must be stored somewhere, and thats what I need to find out how to get those names. And I use Outlook 2003. |
#7
|
|||
|
|||
![]() You can't get the shared calendars unless you know the alias names of the available recipients. Plus you would need permissions to open their calendars. You can read the Global Address List, which is one of your AddressLists. Open the AddressLists collection and get the GAL AddressList. You can then iterate that list and get the names of everyone available. You can then try opening each calendar using the name you just got and creating a Recipient object for that name. That of course doesn't guarantee that you will succeed, you need permissions, so be prepared to handle errors when you try to open the folder using GetSharedDefaultFolder. I already have the permission I need from those who are suppost to share their calendar. But I looked up that GAL in outlook and there was one address which doesent allow me to access, can I comehow use some kind of exception when Im not allowed by the other user ? And by the way, is it possible not to get those security messages from outlook when I try to read the items? Because if not, I guess that there will be A LOT of messages when Im trying to read all the appointment items from like 10-20 addresses. |
#8
|
|||
|
|||
![]()
You always have to handle exceptions. Your exception handler should be able
to handle cases where you can't get access when you create the Recipient object and attempt to use GetSharedDefaultFolder. For the security and your options look at http://www.outlookcode.com/d/sec.htm -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm wrote in message ups.com... You can't get the shared calendars unless you know the alias names of the available recipients. Plus you would need permissions to open their calendars. You can read the Global Address List, which is one of your AddressLists. Open the AddressLists collection and get the GAL AddressList. You can then iterate that list and get the names of everyone available. You can then try opening each calendar using the name you just got and creating a Recipient object for that name. That of course doesn't guarantee that you will succeed, you need permissions, so be prepared to handle errors when you try to open the folder using GetSharedDefaultFolder. I already have the permission I need from those who are suppost to share their calendar. But I looked up that GAL in outlook and there was one address which doesent allow me to access, can I comehow use some kind of exception when Im not allowed by the other user ? And by the way, is it possible not to get those security messages from outlook when I try to read the items? Because if not, I guess that there will be A LOT of messages when Im trying to read all the appointment items from like 10-20 addresses. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Who made an appointment in a shared Calendar | Middo | Outlook - Calandaring | 0 | May 31st 06 01:11 PM |
Calendar is showing 1 unread item, but all items are read | KNM101 | Outlook - Calandaring | 7 | May 30th 06 03:40 PM |
How can I search for items in a shared calendar? | Monique | Outlook - Calandaring | 0 | February 27th 06 04:08 PM |
Outlook 2002: Opening appointment in Shared Calendar causes it to be copied into your own calendar | QH | Outlook - General Queries | 1 | February 3rd 06 02:45 PM |
Outlook 2002: Opening appointment in Shared Calendar causes it to be copied into your own calendar | QH | Outlook - Calandaring | 1 | February 3rd 06 02:45 PM |