Accessing extended properties created by exchange webservices

Add-in Express™ Support Service
That's what is more important than anything else

Accessing extended properties created by exchange webservices
 
gera


Guest


Hi,

I am creating an appointment item with extended properties added with the help of Exchange Webservices.

public static void CreateCalendarItem(CalendarInfo info, string email)
{
ExchangeServiceBinding esb = GetBinding();
CalendarItemType newCalendarItem = new CalendarItemType();
newCalendarItem.Subject = info.Subject;

if (info.AssignmentInfo != null)
{

List<ExtendedPropertyType> types = new List<ExtendedPropertyType>();
types.Add(CreateExtendedProperty("Address1", info.AssignmentInfo.Address1, MapiPropertyTypeType.String));
types.Add(CreateExtendedProperty("Address2", info.AssignmentInfo.Address2, MapiPropertyTypeType.String));
newCalendarItem.ExtendedProperty = types.ToArray();
}

newCalendarItem.Start = info.StartTime.ToUniversalTime();
newCalendarItem.End = info.EndTime.ToUniversalTime();
newCalendarItem.StartSpecified = newCalendarItem.EndSpecified = true;
newCalendarItem.Subject = info.Subject;
newCalendarItem.Body = new BodyType() { Value = info.Body };
newCalendarItem.Location = info.Location;

// Construct the CreateItem request.
CreateItemType createItemRequest = new CreateItemType();
createItemRequest.SendMeetingInvitations = CalendarItemCreateOrDeleteOperationType.SendToNone;
createItemRequest.SendMeetingInvitationsSpecified = true;
if (email != null)
{
DistinguishedFolderIdType folderID = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.calendar };
folderID.Mailbox = new EmailAddressType();
folderID.Mailbox.EmailAddress = email;
createItemRequest.SavedItemFolderId = new TargetFolderIdType() { Item = folderID };
}


createItemRequest.Items = new NonEmptyArrayOfAllItemsType();
createItemRequest.Items.Items = new CalendarItemType[] { newCalendarItem };



CreateItemResponseType createItemResponse = esb.CreateItem(createItemRequest);
ResponseMessageType responseMessage = createItemResponse.ResponseMessages.Items[0];
if (responseMessage.ResponseCode != ResponseCodeType.NoError)
throw new Exception(string.Format("Couldn't create caledar item! {0}", responseMessage.MessageText));
}


I want to access these extended properties "Address1" and "Address2" while opening the appointment item. I am handling the InspectorActivate event and try to find the userproperties like this,

Outlook._Inspector olInsp = inspector as Outlook._Inspector;
Outlook.UserProperty property = item.UserProperties.Find("Address1", true);

But the added properties are found in the UserProperties, its count is zero. Please help me as how I can access these properties.

Thanks,
Gera.
Posted 08 Apr, 2010 03:58:29 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hi gera,

I haven't used Exchange Webservices so I don't know how the extended properties are added. Try installing Outlook Spy to check if those properties are added at all. If they don't exist in UserProperties, then probably you will have to use Extended MAPI to access them.


Andrei Smolin
Add-in Express Team Leader
Posted 08 Apr, 2010 05:05:42 Top
gera


Guest


Hi,,

Thanks for your reply, but I am not able to access it through the Mapi also

Outlook.AppointmentItem item = olInsp.CurrentItem as Outlook.AppointmentItem;
AddinExpress.MAPI.ADXMAPIStoreAccessor mapi = new AddinExpress.MAPI.ADXMAPIStoreAccessor();
mapi.Initialize(false);
object aa = mapi.GetProperty(item, 34001);

where 34001 is the propertyid of the property added.

It returns null in this case. Am I missing something here in using the MAPI?

Thanks in advance.

-Gera
Posted 08 Apr, 2010 06:42:33 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hi Gera,

If those properties are added as so-called named properties (I'm sorry, I know nothing about this concept), then MAPI Accessor doesn't support them currently. I suggest that you try using Outlook Redemption to extract the properties in question.


Andrei Smolin
Add-in Express Team Leader
Posted 08 Apr, 2010 10:26:28 Top
gera


Guest


Hi,

I installed the outlook spy as you suggested and checked if the properties are gettign added. They are not shown inthe Inspector or current item, but are shown in a tab called IMessage. I will send a screen shot of the same to the support email ID. Please advice if I can get access to that IMessage somehow.

Thanks
-Gera.
Posted 12 Apr, 2010 03:10:55 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hi Gera,

Thank you for the screenshot. Yes, those properties are custom named properties. MAPI Accessor doesn't support them currently. More specifically you could access them using the IDs shown on your screenshot but the IDs may be different on another PC. I suggest that you try using Outlook Redemption.


Andrei Smolin
Add-in Express Team Leader
Posted 12 Apr, 2010 03:55:09 Top