MRdanK Absent Member.
Absent Member.
1300 views

Opening a message / Resfreshing Mailbox

Hi!

I'm currently developing an interface between our c#-based application and groupwise 2014 client in order to send e-mails. Everything works fine so far: creating and populating the mail message works and even sending it would either, but it is required to display the message. Here's where I'm stuck since I can't find a way to refresh the mailbox and the message won't appear at the groupwise UI until F5 is pressed (objAccount.MailBox.Refresh(); won't do the trick). Another approach would be opening the newly created message in a new window, but I can't find a way doing that.

Thanks for any help in advance!


public static bool SendMail( ... ) {
GroupwareTypeLibrary.Application gwapplication;
GroupwareTypeLibrary.Account objAccount;
Messages messages;
Message message;
try
{
gwapplication = new GroupwareTypeLibrary.Application();
objAccount = gwapplication.Login("CLIENT USERNAME", null, "",
GroupwareTypeLibrary.LoginConstants.egwNeverPrompt, null);

messages = objAccount.MailBox.Messages;
message = messages.Add("GW.MESSAGE.MAIL", "A GENERAL SUBJECT TEXT", MessageBoxTypeConstants.egwDraft);

Recipients recipients = message.Recipients;
foreach (var eam in aFilteredTotalMailaddressList)
{
switch (eam.SendingAs)
{
case EmailAddressingType.To:
recipients.Add("MAIL ADDRESS", "SOME IDENTIFIER", AddressTargetTypeConstants.egwTo);
break;
case EmailAddressingType.CC:
recipients.Add("MAIL ADDRESS", "SOME IDENTIFIER", AddressTargetTypeConstants.egwCC);
break;
case EmailAddressingType.BCC:
recipients.Add("MAIL ADDRESS", "SOME IDENTIFIER", AddressTargetTypeConstants.egwBC);
break;
}
}
recipients.Resolve();

message.Subject.PlainText = "SUBJECT TEXT";
message.BodyText.RTF = "RTF E-MAIL TEXT";
ErrorLogger.Info("Groupwise COM Interface", "Mail text added");

Attachments files = message.Attachments;
files.Add("ATTACHMENT OBJECT PATH", AttachmentTypeConstants.egwFile, "ATTACHMENT OBJECT NAME");
//...

// NEEDED for sender-fields to be filled out! ("...then Add the Message object to the synnchronized collection via AddExisitingMessage() and the recipients are in the Mail Object" - https://forums.novell.com/showthread.php/500137-resolving-recipients-of-mail-leads-to-User-not-found-error)
messages.AddExistingMessage(objAccount.Owner.DisplayName, objAccount.Owner.EMailAddress, "", DateTime.Now, MessageBoxTypeConstants.egwDraft, MessageStatusConstants.egwMessageStatusDefault, MessagePriorityConstants.egwNormal, MessageSecurityConstants.egwDefaultSecurity, message);

// Send e-mail...
// message.Send();

//objAccount.MailBox.Refresh();
}
catch (Exception e)
{
// error message here
return false;
}
finally
{
gwapplication = null;
objAccount = null;
messages = null;
message = null;
}
return true;
}
Labels (1)
0 Likes
1 Reply
zalk Absent Member.
Absent Member.

Re: Opening a message / Resfreshing Mailbox

You can look on the API called "GroupWise Tokens". It allows to control the Groupwise Client from your program. And it is definitely has Refresh() token
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.