August 20, 2008 at 11:50 am #4381
I have noticed if a user puts formattedtext in the subject Formativ api improperly returns it.
this only applies (as far as i know) to currentItem.
If the user inputs BoldItalicNormalSubject
formativ ItemGetText(“X00″,9) and currentItem.Subject returns ” Bold Italic NormalSubject”
I am looking for the text to be returned as “BoldItelicNormalSubject”
any help would be greatly appreciated!
August 20, 2008 at 5:21 pm #8011
Thanks for the post.
We can re-produce the behaviour with GroupWise Client 7.0.3 (build 8/03/2008). It appear a bug in the GroupWise ItemGetText() token which return the space between the style (Bold and Italic).
We will report this issue to Novell and post any update in this thread.
Advansys SupportAugust 21, 2008 at 7:41 am #8018
Thanks for the reply and invertigation.
To work around this I was wondering how could I return the RTF property of the Subject (Novell API) in Formativ for my composingItem.
Then I would in code handle parsing it properly. I feel a fix will take forever from Novell.
Also I there a way for me in Formativ to access the composingItem with the Novell API and not use the Groupwise.ComposingItem object.
thanks,August 21, 2008 at 2:43 pm #8019
Unfortunately Token API only return the plain text format of the subject. ItemGetText() token may be working as designed to return the plain text format of the subject, unless Novell decide to update or add another Token API to return RTF format.
In order to extract the RTF property of the subject, you will need to use the Object API. If you are working with a draft message (which is not yet saved to the message store) then you will need to save the draft message.
The sample code below save the message to Work-Folder (if the message ID “X00”) then use the Object API to access the RTF property.
Sub Main(Client, GWEvent) dim iWIPFolderPath dim oMsg dim iMsgID dim iWIPPath dim iBreakCount ' Get the message ID iMsgID = GroupWise.ItemMessageIDFromView ' If the draft message then save to WIP otherwise access the message if (iMsgID = "X00") then ' Save the message to WIP call GetWIPFolderPath(groupwise.account.workfolder, iWIPPath) msgbox "Work In Progress folder path: " & iWIPPath Call Groupwise.throwtoken("ItemSaveMessageDraft(""" & iWIPPath & """)", iReturnVal) iBreakCount = 0 while (iMsgID = "Token failed execution!") or (iMsgID = "X00") Application.ProcessMessages utilities.Timer(1) Application.ProcessMessages iMsgID = GroupWise.ItemMessageIDFromView iBreakCount = iBreakCount + 1 Utilities.Trace iBreakCount & ": " & iMsgID if (iBreakCount > 10) then exit sub end if wend set oMsg = GroupWise.Account.GetMessage(iMsgID) else set oMsg = Client.clientstate.commandmessage end if msgbox "Subject-Plaintext: " & oMsg.subject.plaintext & vbcrlf &_ "Subject-RTF: " & oMsg.subject.RTF End Sub
Hope this helps.
Advansys SupportAugust 22, 2008 at 12:25 pm #8015
your the smartest guy i know… Proven this code works. I’ll let you know in 2 weeks. Now off to Jamaica
thanks!August 26, 2008 at 2:46 pm #8009
Good luck. Let us know, if you have any questions.
Advansys SupportSeptember 8, 2008 at 10:27 am #8010
yes this code worked, I a utulizing it but the WIP folder is different in GW 7.0 so i added the groupwise 7 check.September 9, 2008 at 1:07 pm #8026
I figured i would post the code…
' GroupWise 7+ onwards contains a localized word 'Home' after the account name. ' You will need to add the localized 'Home' after the name if (groupwise.EnvVersionName > "7") then iWIPPath = GroupWise.Account.Owner.DisplayName & " Home" & GroupWise.Account.WorkFolder.Name else iWIPPath = GroupWise.Account.Owner.DisplayName & "" & GroupWise.Account.WorkFolder.Name end if ' Save the draft message to the Work in Progress folder Groupwise.ItemSaveMessageDraft iWIPPath iBreakCount = 0 while (iMsgID = "Token failed execution!") or (iMsgID = "X00") Application.ProcessMessages utilities.Timer 1 Application.ProcessMessages iMsgID = GroupWise.ItemMessageIDFromView iBreakCount = iBreakCount + 1 Utilities.Trace iBreakCount & ": " & iMsgID if (iBreakCount > 10) then exit sub end if wend set oMsg = GroupWise.Account.GetMessage(iMsgID)
I am having a problem with:
' delete all attachments if oMsg.Attachments.Count > 0 then ' for sndIntCounter = 1 to oMsg.Attachments.Count for sndIntCounter = 0 to GroupWise.ItemAttachmentGetCount(oMsg.MessageID)-1 ' msgbox oMsg.Attachments(sndIntCounter).DisplayName ' oMsg.Attachments(sndIntCounter).Delete groupwise.ItemAttachmentDelete oMsg.MessageID, sndIntCounter next end if
seams to not delete the attachements properly. any help would be appreciated.
As you can see i tryed witht eh Formativ and Groupwise API, as the email is draft at this point.
[This message was edited by sam on September 09, 2008 at 01:16 PM.]
[This message was edited by sam on September 09, 2008 at 01:18 PM.]September 9, 2008 at 6:26 pm #8014
If the draft message view is open then you can delete the attachments using the code below. I haven’t tried with other scenario (message view not open, delete attachments using Object API, etc)
iTotalAttachments = GroupWise.ItemAttachmentGetCount("X00") if iTotalAttachments > 0 then for sndIntCounter = iTotalAttachments-1 to 1 step -1 msgbox groupwise.throwtoken("ItemAttachmentDelete(""X00"";" & sndIntCounter & ")", iReturnVal) next end if
Advansys SupportSeptember 10, 2008 at 5:41 am #8020
Yes i can delete attachments on the composingitem as it is perhaps open.
But on it’s saved draft copy I cannot.
So that is probably the issue.
The only way I can see of solving this is to remove all attachments from the X00 email and then save as a draft. Then put the attachements back on the X00 and then send and send the draft.
any other way? which would make more sense?
samOctober 9, 2008 at 9:18 am #8023
Another issue was been found using this technic.
It has been observed that if the composingItem is save to draft then sent (in order to retreive the subject properly) the user’s default signature or the signature specified before send. Does not get appended to the message.
Anyone know how to work around this?
samOctober 9, 2008 at 4:31 pm #8024
Does the message view is opened when you save the message and send? If the message view not opened then GroupWise will not add the default signature (if defined).
In other words, if you create and send message through Object API (No User interface) then the default GroupWise signature will not be added.
If we mis-understood your enquiry, please provide more information and steps to re-produce.
Advansys SupportOctober 10, 2008 at 5:59 am #8021
Thanks for the reply.
This action is a REPLACE GROUPWISE EVENT
When main runs onSend Action
1. Create a new message
2. Save the somposing item to draft (Because we NEED to keep formatting on subject and body text)
3. Copy the properties (subject, body, attachements) from the draft message to the new message.
4. send the draft and the new message.
no emails sent get the signature even thought we choose to add from the initial signature prompt screen.
Note: I tryed to send the composing item in the above flow to see if the signature would apear and it didn’t.
This behavior is also produced if the event is changed to “run before”.
dim iWIPFolderPath dim oMsg dim iMsgID dim iWIPPath dim iBreakCount ' Get the message ID iMsgID = GroupWise.ItemMessageIDFromView ' If the draft message then save to WIP otherwise access the message if (iMsgID = "X00") then ' function saves to draft set oMsgCopy = SaveComposingItemToDraft() Set objDraft = GroupWise.Account.MailBox.Messages.Add(4) 'set subject and body with objDraft .Subject.PlainText = oMsgCopy.Subject.Unicode .BodyText.RTF = oMsgCopy.BodyText.RTF end with ' add attchements form original email if oMsgCopy.Attachments.Count > 0 then for sndIntCounter = oMsgCopy.Attachments.Count to 1 Step -1 if oMsgCopy.Attachments(sndIntCounter).ObjType <> 2 then ' add to email valFileName = utilities.CreateValidFilename(oMsgCopy.Attachments(sndIntCounter).DisplayName) oMsgCopy.Attachments(sndIntCounter).Save utilities.tempfiles & valFileName objDraft.Attachments.Add utilities.tempfiles & valFileName, , oMsgCopy.Attachments(sndIntCounter).DisplayName end if next end if ' Add Email for draft select case form.cboDestination.text case gstrDestinationItems(0)(0) objRecipient = objDraft.Recipients.Add(gEmail1,,0) case gstrDestinationItems(0)(2) objRecipient = objDraft.Recipients.Add(gEmail2,,0) case gstrDestinationItems(0)(1) objRecipient = objDraft.Recipients.Add(gEmail3,,0) case else objRecipient = objDraft.Recipients.Add(gEmail4,,0) end select ' send copy objDraft.Send ' send composing oMsgCopy.Send ' clear change flags groupwise.EnvClearChangedFlag ' close composing window groupwise.CloseWindowOctober 10, 2008 at 6:46 am #8017
Another solution i just thouth of is a 2 applet solution..
one that runs before event and does initial desired stuff.
then one that runs after event and copies and sends the message to another box.
Only thing I don’t know how to retreive the email just sent (100% sure to be the one sent) in the second event. How would i do that?
ill post if i find
there is an issue right off the bat with this. We cannot garantuee this second applet of siring because if the user clicks on another action between Before and After the After doen’s fire.
so this is down the tubes…
[This message was edited by sam on October 10, 2008 at 07:13 AM.]October 12, 2008 at 7:24 pm #8025
Could you explain the objective of your solution so that we may be able to provide alternative suggestions.
Looking at your code to create clone message of the original. You can use the Message.Clone() to create a copy of the original message. See below the Object API comments about the Clone() method.
Makes an independent copy of this message and returns it as a new draft message. The new message is contained in the same folders as the original.
Sample code to use the clone method…
set oMsg = Client.clientstate.commandmessage set oClonedMsg = oMsg.clone msgbox oClonedMsg.subject
Advansys SupportOctober 14, 2008 at 7:01 am #8022
1. The need:
We want to (when an email is sent) to also send a copy of the message + plus one Attachment we produce to a special email box. This copy also gets all recursive attachment of the composing email (in the case of Forward as Attachment) and attach them to the copy email in a linear fashion.
2. set oMsg = Client.clientstate.commandmessage
I was using clone initialy, don’t remember why I stopped. I do remember it was because of something. I’ll try again…
- You must be logged in to reply to this topic.