Add editControl to appointment invitation - check kind of recipient

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

Add editControl to appointment invitation - check kind of recipient
 
Christian Havel




Posts: 181
Joined: 2010-12-30
Hi,

I want to extend the ui for a invitation adding a ribbon tab with a editcontrol. No problem.

Sending the invitation I want to extend the subject of the invitation automatically with the content of the editcontrol. This should happen only for resource-eMails (example: conference room).

How can I check if the recipients eMail is of type 'resource-eMail'?

Is it possible to extend the subject of the invitation only if the receivers-eMails is of type 'resouce-eMail'?

Thanks
Christian
Posted 21 Feb, 2011 01:57:31 Top
Eugene Astafiev


Guest


Hi Christian,

Sorry, but I don't quite understand you. What 'resource-eMail' do you mean?

Anyway, please try to use the ItemSend event of the AddinExpress.MSO.ADXOutlookAppEvents component to modify the subject of the outcoming e-mail. Does it work?
Posted 21 Feb, 2011 04:23:07 Top
Christian Havel




Posts: 181
Joined: 2010-12-30
Hi Eugene,

in the inspector I have the editcontrols 'Subject' and 'Location'. Beneath 'Location' I have a button 'Rooms'. With a selected room I mean a 'resource-eMail'.

Christian
Posted 21 Feb, 2011 06:04:53 Top
Eugene Astafiev


Guest


Hi Christian,

How can I check if the recipients eMail is of type 'resource-eMail'?


In the ItemSend event handler you can check out the type of the item is being sent. For example:

private void adxOutlookEvents_ItemSend(object sender, AddinExpress.MSO.ADXOlItemSendEventArgs e)
{
   if (e.Item is Outlook.MeetingItem) System.Diagnostics.Debug.WriteLine("resource e-mail");
}


BTW Did you try to use the ItemSend event?
Posted 21 Feb, 2011 07:45:56 Top
Christian Havel




Posts: 181
Joined: 2010-12-30
Hi Eugene,

thanks for your help!

Yes, I checked the event handler.

private void adxOutlookEvents_ItemSend(object sender, AddinExpress.MSO.ADXOlItemSendEventArgs e)
{
var meetingItem = e.Item as Outlook.MeetingItem;
if(null == meetingItem) return;
meetingItem.Subject = meetingItem.Subject + " - ADDED FROM ADDIN";
meetingItem.Save();
}

Well, I have two issues.
1.) The Subject is not changed.
2.) If I would succeed in changing the subject in the ItemSend eventhandler, it would be changed for all recipients.
Do you know a strategy how change the settings (subject) if only one of the recipients should be affected?

Thanks
Christian
Posted 21 Feb, 2011 08:35:18 Top
Eugene Astafiev


Guest


Hi Christian,

Did you try to debug? How many times is the ItemSend event triggered?
Posted 21 Feb, 2011 08:45:14 Top
Christian Havel




Posts: 181
Joined: 2010-12-30
Hi Eugene,

I debuged. The ItemSend event is triggered only one time.
The recipient list contains the list of all recipients.

private void adxOutlookEvents_ItemSend(object sender, AddinExpress.MSO.ADXOlItemSendEventArgs e)
{
var meetingItem = e.Item as Outlook.MeetingItem;
if(null == meetingItem) return;

Debug.WriteLine("########################################");
Debug.WriteLine("ItemSend: " + meetingItem.Subject);
foreach (Outlook.Recipient recipient in meetingItem.Recipients)
{
Debug.WriteLine("Items recipient.Adress: " + recipient.Address);
}

meetingItem.Subject = meetingItem.Subject + " - ADDED FROM ADDIN";
meetingItem.Save();
}

Christian
Posted 21 Feb, 2011 09:05:23 Top
Eugene Astafiev


Guest


Hi Christian,

In that case there is no way to edit the subject for a particular recipient.
Posted 21 Feb, 2011 09:33:32 Top
Christian Havel




Posts: 181
Joined: 2010-12-30
Hi Eugene,

ok.

Well, is it eventually possible to insert some information (a string) into a custom field in the meetingItem on ItemSend? My idea is, that on something like a "NewMeetingReceived" event the eventhandler checks the custom field and its eMail. If the custom field contains something and its eMail is a resource eMail the eventhandler could eventually extend the subject.

Thanks
Christian
Posted 22 Feb, 2011 02:12:07 Top
Sally Peck


Guest


Hi,

I went and debug the code:


            var meetingItem = e.Item as Outlook.MeetingItem;
            if (null == meetingItem) return;

            int iCount = meetingItem.Recipients.Count;
            int iNo = 0;
            for (iNo = 1; iNo <= iCount; iNo++)
            {
// got each individual receipients
                MessageBox.Show(meetingItem.Recipients.Item(iNo).Address);
            }

            meetingItem.Subject = meetingItem.Subject + " - ADDED FROM ADDIN";
            meetingItem.Save(); 

// when I checked the Outbox, the text was appended to Subject Line

Posted 22 Feb, 2011 03:29:47 Top