Reading CalendarItem properties using EWSClient


#1

Hello,
I use Aspose.Email EWSClient methods to read public folder of type Appointment and fetch items in the folder.
Works fine so far but I do miss some data.

  • Appointment.Category (=> CategoryId => of Collection Categories)
  • Appointment.Sensitivity (=> Sensitivity.Private)
  • Appointment.LastModifiedTime

If those properties are not available I probably have to use Microsoft.Exchange.WebServices.Data directly.

BUT: Each EWS item has a itemId and a globalObjectId. Bot aren’t available in Aspose.Email.EWSClient.

In EWS I can use

// unique id for sync that do not change like item id
        var cleanGlobalObjectId = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Meeting, 0x23, MapiPropertyType.Binary);
        var psPropSet = new PropertySet(BasePropertySet.FirstClassProperties) { cleanGlobalObjectId };

to retrieve the global unique Id or just

item.ItemId.UniqueId

In Aspose.Email I have a UniqueId property which returns a guid. How is that related to the EWS item-ids?


#2

Hi,

Than you for posting your inquiry.

EWSClient of the API has FetchMapiCalendar method that allows to fetch MAPI Calendar along with the specified properties information. For example, please check the following code sample for your reference.

string[] uriList = client.ListItems(client.MailboxInfo.CalendarUri);
IList<MapiCalendar> mapiCalendarList = client.FetchMapiCalendar(
uriList,
new PropertyDescriptor[] { KnownPropertyList.GlobalObjectId });

MapiCalendar mapiCalendar = mapiCalendarList[0];
long lid = KnownPropertyList.GlobalObjectId.LongId;
int? value = null;
foreach (MapiNamedProperty namedProperty in mapiCalendar.NamedProperties.Values)
if (namedProperty.Guid == KnownPropertyList.GlobalObjectId.PropertySet && 
    System.Int32.Parse(namedProperty.NameId, System.Globalization.NumberStyles.HexNumber) == lid)
    value = namedProperty.GetInt32();

The complete list of properties and their information is available in KnownPropertyList. Please try these at your end and let us know if you need any further assistance in this regard.


#3

Hello,
thank you for sharing the code, I will look into it.
Can you take a look on my second question about id reference? Thank you.


#4

Hi Yves,

This information is not present at present. An investigation ticket with id: EMAILNET-38775 has been logged for provision of this information in Calendar object. We’ll update you here once there is some information available in this regard.


#5

Hello,

I tried get public folder of type Appointment and fetch it via MapiCalendar, but it fails:

  // List all the folders from Exchange server
  ExchangeFolderInfoCollection folderInfoCollection = client.ListPublicFolders();  //client.ListSubFolders(rootUri);
  foreach (ExchangeFolderInfo folderInfo in folderInfoCollection)
  {
    if (folderInfo.FolderType != ExchangeFolderType.Appointment) continue;
    // Call the recursive method to read messages and get sub-folders

string[] uriList = { folderInfo.Uri };
IList<MapiCalendar> mapiCalendarList = client.FetchMapiCalendar(uriList, new PropertyDescriptor[] { KnownPropertyList.GlobalObjectId });

MapiCalendar mapiCalendar = mapiCalendarList[0];
long lid = KnownPropertyList.GlobalObjectId.LongId;
int? value = null;
foreach (MapiNamedProperty namedProperty in mapiCalendar.NamedProperties.Values)
  if (namedProperty.Guid == KnownPropertyList.GlobalObjectId.PropertySet && Int32.Parse(namedProperty.NameId, NumberStyles.HexNumber) == lid)
    value = namedProperty.GetInt32();

Console.WriteLine("*******");
Console.WriteLine(value);
Console.WriteLine("*******");
}

To clarify: I need to access public folder calendars, read items from there.

I do (that works)

Appointment[] appts = client.ListAppointments(publicFolder.Uri);

and get all data, but I miss some properties like I mentioned above.
So that is why I asked about the other properties and you guys came with the solution to use FetchMapiCalendars() method.

Thanks in advance for your support.
Yves


#6

@rausch,

We were able to notice the issue of FetchMapiCalendar with Public Folders and it has been logged as EMAILNET-38778 for further investigation by our Product team. We’ll update you here once there is some information or a fix version available in this regard.

We suggested you the use of FetchMapiCalendar as the normal Appointment object retrieved via ListAppointments didn’t include the properties required. The API behavior with Public folders, however, has this issue which has now been logged for further investigation. We’ll notify you here upon availability of further feedback in this regard.


#7

Thanks for the update.
However I suggest you add all missing properties directly in the folderinfo collection. Makes it much easier.

Add: In addition if possible add SyncState method to retrieve new appointments, not only time-based like now.


#8

@rausch,

We have logged your further comments against the logged ticket for further consideration by our Product team and will update you here once there is some feedback available in this regard.


#9

Hi team,
I want to list apointments folder wise using this code :
Appointment[] appointments1 = client.listAppointments(folderInfo.getUri());
But, the problem it’s not extracting all appointments from current folder.
Please let me know is there any change to do this code to get appointments.


#10

@pradeepnegi,

Can you please share source file so that we may further investigate to help you out.