In the InteractionExtensionSample you have the Case in MySamplePresentationModel.cs, so you need to set that.
In the MySampleView.xaml.cs modify the Create method to look like this:
[code]
public void Create()
{
IDictionary<string, object> contextDictionary = Context as IDictionary<string, object>;
object caseView;
contextDictionary.TryGetValue("CaseView", out caseView);
object caseObject;
contextDictionary.TryGetValue("Case", out caseObject);
ICase @case = caseObject as ICase;
if (@case != null)
{
Model.Case = @case;
}
}[/code]
Then in your button press method you can get the Case and from the Case get the Interaction, check what type of interaction it is and then get the properties of that interaction.
[code]
private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
{
//Model.ResetCounter();
IInteraction interaction = Model.Case.MainInteraction;
if(interaction is IInteractionInboundEmail)
{
IInteractionInboundEmail email = interaction as IInteractionInboundEmail;
string subject = email.EntrepriseEmailInteractionCurrent.Subject;
string from = email.EntrepriseEmailInteractionCurrent.From;
string to = "";
foreach(string s in email.EntrepriseEmailInteractionCurrent.To)
{
to += " " + s;
}
to = to.Trim();
string text = email.EntrepriseEmailInteractionCurrent.MessageText;
MessageBox.Show(email.InteractionId + " Subject: " + subject);
}
}
[/code]