I am evaluating the RAD Scheduler for possible purchase and I’m trying to implement a solution where an Exchange 2007 server would be the primary data source for the scheduler. I have been able to pull in my own mailbox and add, update and delete items just fine but I also need to be able to do this for other users in the organization. Back in April 2009 another user posted the following thread
“How do I get it to work with public folders or to load another user's calendar (to which the logged in user has access rights in Exchange)? The provider only takes a username, password, and domain along with the server URL. I don't see how to specify a particular folder or path. Looking at Telerik's source code for the Exchange provider, I do see that the DistinguishedFolderIdNameType enumerated date type includes an option for publicfoldersroot, but it doesn't appear to be used anywhere.
Similarly, I'd also like User A, who has access rights to User B's calendar, to be able to do so, but, again, I don't see where I can specify the alternate calendar location.”
Teleriks response was as follows:
“The FindCalendarItems method currently queries only the authenticated users calendar:
DistinguishedFolderIdType[] folderIDArray = new DistinguishedFolderIdType[1];
folderIDArray[0] = new DistinguishedFolderIdType();
folderIDArray[0].Id = DistinguishedFolderIdNameType.calendar;
findItemRequest.ParentFolderIds = folderIDArray;
We can other calendars here as well:
// Identify which folders to search.
List<DistinguishedFolderIdType> folderIDs = new List<DistinguishedFolderIdType>();
DistinguishedFolderIdType ownCalendar = new DistinguishedFolderIdType();
ownCalendar.Id = DistinguishedFolderIdNameType.calendar;
folderIDs.Add(ownCalendar);
DistinguishedFolderIdType otherCalendar = new DistinguishedFolderIdType();
otherCalendar.Id = DistinguishedFolderIdNameType.calendar;
EmailAddressType otherMailbox = new EmailAddressType();
otherMailbox.EmailAddress = "other.user@contoso.com";
otherCalendar.Mailbox = otherMailbox;
folderIDs.Add(otherCalendar);
findItemRequest.ParentFolderIds = folderIDs.ToArray();”
I’ve tried implementing this code but still cannot see any other users on the scheduler. Is there any other examples or documentation that could help me out here?
9 Answers, 1 is accepted
Thank you for your interest in our products. The scenario you describe should be possible. We've opted to release he provider as source code to allow for such customizations.
I've just tested the sample code with our Exchange Server and it seems to work here:
protected
internal
CalendarItemType[] FindCalendarItems()
{
// ...
// Identify which folders to search.
DistinguishedFolderIdType[] folderIDArray =
new
DistinguishedFolderIdType[2];
folderIDArray[0] =
new
DistinguishedFolderIdType();
folderIDArray[0].Id = DistinguishedFolderIdNameType.calendar;
findItemRequest.ParentFolderIds = folderIDArray;
folderIDArray[1] =
new
DistinguishedFolderIdType();
folderIDArray[1].Id = DistinguishedFolderIdNameType.calendar;
EmailAddressType additionalMailbox =
new
EmailAddressType();
additionalMailbox.EmailAddress =
"xxxx@telerik.com"
;
folderIDArray[1].Mailbox = additionalMailbox;
// ...
Maybe the authenticated user does not have enough permissions?
Sincerely yours,
Tsvetomir Tsonev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
protected internal CalendarItemType[] FindCalendarItems() |
{ |
// Form the FindItem request. |
FindItemType findItemRequest = new FindItemType(); |
// Define the item properties that are returned in the response. |
ItemResponseShapeType itemProperties = new ItemResponseShapeType(); |
itemProperties.BaseShape = DefaultShapeNamesType.IdOnly; |
PathToUnindexedFieldType calendarIsRecurringFieldPath = new PathToUnindexedFieldType(); |
calendarIsRecurringFieldPath.FieldURI = UnindexedFieldURIType.calendarIsRecurring; |
PathToUnindexedFieldType calendarItemTypeFieldPath = new PathToUnindexedFieldType(); |
calendarIsRecurringFieldPath.FieldURI = UnindexedFieldURIType.calendarCalendarItemType; |
PathToUnindexedFieldType calendarStartFieldPath = new PathToUnindexedFieldType(); |
calendarStartFieldPath.FieldURI = UnindexedFieldURIType.calendarStart; |
PathToUnindexedFieldType calendarEndFieldPath = new PathToUnindexedFieldType(); |
calendarEndFieldPath.FieldURI = UnindexedFieldURIType.calendarEnd; |
itemProperties.AdditionalProperties = new PathToUnindexedFieldType[] |
{ |
calendarIsRecurringFieldPath, |
calendarItemTypeFieldPath, |
calendarStartFieldPath, |
calendarEndFieldPath |
}; |
findItemRequest.ItemShape = itemProperties; |
// Identify which folders to search. |
//DistinguishedFolderIdType[] folderIDArray = new DistinguishedFolderIdType[1]; |
//folderIDArray[0] = new DistinguishedFolderIdType(); |
//folderIDArray[0].Id = DistinguishedFolderIdNameType.calendar; |
//findItemRequest.ParentFolderIds = folderIDArray; |
////Identify which folders to search. |
List<DistinguishedFolderIdType> folderIDs = new List<DistinguishedFolderIdType>(); |
DistinguishedFolderIdType otherCalendar1 = new DistinguishedFolderIdType(); |
otherCalendar1.Id = DistinguishedFolderIdNameType.calendar; |
EmailAddressType otherMailbox1 = new EmailAddressType(); |
otherMailbox1.EmailAddress = "email1@test.com"; |
otherCalendar1.Mailbox = otherMailbox1; |
folderIDs.Add(otherCalendar1); |
DistinguishedFolderIdType ownCalendar = new DistinguishedFolderIdType(); |
ownCalendar.Id = DistinguishedFolderIdNameType.calendar; |
folderIDs.Add(ownCalendar); |
DistinguishedFolderIdType otherCalendar = new DistinguishedFolderIdType(); |
otherCalendar.Id = DistinguishedFolderIdNameType.calendar; |
EmailAddressType otherMailbox = new EmailAddressType(); |
otherMailbox.EmailAddress = "email2@test.com"; |
otherCalendar.Mailbox = otherMailbox; |
folderIDs.Add(otherCalendar); |
findItemRequest.ParentFolderIds = folderIDs.ToArray(); |
// Define the sort order of items. |
FieldOrderType[] fieldsOrder = new FieldOrderType[1]; |
fieldsOrder[0] = new FieldOrderType(); |
PathToUnindexedFieldType subjectOrder = new PathToUnindexedFieldType(); |
subjectOrder.FieldURI = UnindexedFieldURIType.calendarStart; |
fieldsOrder[0].Item = subjectOrder; |
fieldsOrder[0].Order = SortDirectionType.Ascending; |
findItemRequest.SortOrder = fieldsOrder; |
// Define the traversal type. |
findItemRequest.Traversal = ItemQueryTraversalType.Shallow; |
// Send the FindItem request and get the response. |
FindItemResponseType findItemResponse = Service.FindItem(findItemRequest); |
// Access the response message. |
ArrayOfResponseMessagesType responseMessages = findItemResponse.ResponseMessages; |
ResponseMessageType responseMessage = responseMessages.Items[0]; |
if (responseMessage is FindItemResponseMessageType) |
{ |
FindItemResponseMessageType firmt = (responseMessage as FindItemResponseMessageType); |
FindItemParentType fipt = firmt.RootFolder; |
object obj = fipt.Item; |
if (obj is ArrayOfRealItemsType) |
{ |
ArrayOfRealItemsType items = (obj as ArrayOfRealItemsType); |
if (items.Items != null) |
{ |
List<CalendarItemType> calendarItems = new List<CalendarItemType>(items.Items.Length); |
foreach (ItemType item in items.Items) |
{ |
CalendarItemType calendarItem = item as CalendarItemType; |
if (calendarItem != null) |
{ |
calendarItems.Add(calendarItem); |
} |
} |
return calendarItems.ToArray(); |
} |
return new CalendarItemType[0]; |
} |
} |
return null; |
} |
Indeed querying more than one mailbox will simply merge the results as if they're coming from a single mailbox.
The mailboxes can be mapped to RadScheduler resources in the CreateAppointmentsFromCalendarItem method. You should inspect the mailbox of the calendar item and assign a corresponding resource.
The resource list is defined by the GetResourcesByType method.
The reverse process should happen in the CreateCalendarItem method.
Then you can use resource grouping to display the calendars:
http://demos.telerik.com/aspnet-ajax/scheduler/examples/resourcegrouping/defaultcs.aspx
I hope this helps.
Greetings,
Tsvetomir Tsonev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Apologies for the late response. Indeed the current method took only the calendar items from the first folder. It turns out the additional calendars are returned as separate response messages and must be iterated. We've fixed the code and I'm sending you the fixed version.
protected
internal
CalendarItemType[] FindCalendarItems()
{
// Form the FindItem request.
FindItemType findItemRequest =
new
FindItemType();
// Define the item properties that are returned in the response.
ItemResponseShapeType itemProperties =
new
ItemResponseShapeType();
itemProperties.BaseShape = DefaultShapeNamesType.IdOnly;
PathToUnindexedFieldType calendarIsRecurringFieldPath =
new
PathToUnindexedFieldType();
calendarIsRecurringFieldPath.FieldURI = UnindexedFieldURIType.calendarIsRecurring;
PathToUnindexedFieldType calendarItemTypeFieldPath =
new
PathToUnindexedFieldType();
calendarIsRecurringFieldPath.FieldURI = UnindexedFieldURIType.calendarCalendarItemType;
PathToUnindexedFieldType calendarStartFieldPath =
new
PathToUnindexedFieldType();
calendarStartFieldPath.FieldURI = UnindexedFieldURIType.calendarStart;
PathToUnindexedFieldType calendarEndFieldPath =
new
PathToUnindexedFieldType();
calendarEndFieldPath.FieldURI = UnindexedFieldURIType.calendarEnd;
itemProperties.AdditionalProperties =
new
PathToUnindexedFieldType[]
{
calendarIsRecurringFieldPath,
calendarItemTypeFieldPath,
calendarStartFieldPath,
calendarEndFieldPath
};
findItemRequest.ItemShape = itemProperties;
// Identify which folders to search.
List<DistinguishedFolderIdType> folderIDs =
new
List<DistinguishedFolderIdType>();
DistinguishedFolderIdType ownCalendar =
new
DistinguishedFolderIdType();
ownCalendar.Id = DistinguishedFolderIdNameType.calendar;
folderIDs.Add(ownCalendar);
//DistinguishedFolderIdType otherCalendar = new DistinguishedFolderIdType();
//otherCalendar.Id = DistinguishedFolderIdNameType.calendar;
//EmailAddressType otherMailbox = new EmailAddressType();
//otherMailbox.EmailAddress = "xxxx@test.com";
//otherCalendar.Mailbox = otherMailbox;
folderIDs.Add(otherCalendar);
findItemRequest.ParentFolderIds = folderIDs.ToArray();
// Define the sort order of items.
FieldOrderType[] fieldsOrder =
new
FieldOrderType[1];
fieldsOrder[0] =
new
FieldOrderType();
PathToUnindexedFieldType subjectOrder =
new
PathToUnindexedFieldType();
subjectOrder.FieldURI = UnindexedFieldURIType.calendarStart;
fieldsOrder[0].Item = subjectOrder;
fieldsOrder[0].Order = SortDirectionType.Ascending;
findItemRequest.SortOrder = fieldsOrder;
// Define the traversal type.
findItemRequest.Traversal = ItemQueryTraversalType.Shallow;
// Send the FindItem request and get the response.
FindItemResponseType findItemResponse = Service.FindItem(findItemRequest);
// Access the response message.
ArrayOfResponseMessagesType responseMessages = findItemResponse.ResponseMessages;
List<CalendarItemType> calendarItems =
new
List<CalendarItemType>();
foreach
(ResponseMessageType responseMessage
in
responseMessages.Items)
{
if
(responseMessage
is
FindItemResponseMessageType)
{
FindItemResponseMessageType firmt = (responseMessage
as
FindItemResponseMessageType);
FindItemParentType fipt = firmt.RootFolder;
object
obj = fipt.Item;
if
(obj
is
ArrayOfRealItemsType)
{
ArrayOfRealItemsType items = (obj
as
ArrayOfRealItemsType);
if
(items.Items !=
null
)
{
foreach
(ItemType item
in
items.Items)
{
CalendarItemType calendarItem = item
as
CalendarItemType;
if
(calendarItem !=
null
)
{
calendarItems.Add(calendarItem);
}
}
}
}
}
}
return
calendarItems.ToArray();
}
As a token of our gratitude for your involvement, your Telerik points have been updated.
All the best,
Tsvetomir Tsonev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Could any of you please send me your usings and full code behind and aspx code?
my email is toolnbama@charter if you would rather email me.
Best Regards to both of you.
http://www.exchangewise.com/Products/MXSync/Overview.htm
It is true that the scenario of combining the RadScheduler with Exchange is not a common one.
However please take a look at this help article for RadScheduler with Exchange provider and if you have any further questions - please feel free to ask.
Best wishes,
Veronica Milcheva
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>