I want to send an automatic mail message with the url in it to an item(very simple example).
When i use the Mail.Newmessage(...) and put the result of f.url function in it , it doesn't show up as an shortcut in my mailmessage.
I'm using Outlook 2000.
Is there any one who knows how to do this ?
Al i want to do is upon item creation send someone a mailmessage with the text 'new item created, clik on the following link to view it'
Rgds
Benny Giebens
Rgds
Benny Giebens
0
Comments
Rgds
Benny
Benny Giebens
</font><blockquote><font size="1" face="Verdana, Arial">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">OBJECT Codeunit 50000 Test hyperlink
{
OBJECT-PROPERTIES
{
Date=13/09/02;
Time=17:48:20;
Modified=Yes;
Version List=;
}
PROPERTIES
{
OnRun=BEGIN
Item.FIND('-');
MakeHyperlink(FORM::"Item Card",Item.GETVIEW,Item.GETPOSITION);
Mail.NewMessage('you@web.com','','New item has been created','Please click on the link in the attachment',AttachmentName,FALSE);
END;
}
CODE
{
VAR
HyperlinkText@1000000001 : Text[1024];
AttachmentStream@1000000003 : OutStream;
AttachmentFile@1000000002 : File;
AttachmentName@1000000004 : Text[250];
Item@1000000005 : Record 27;
Mail@1000000006 : Codeunit 397;
PROCEDURE MakeHyperlink@1010001(ObjectID@1010000 : Integer;View@1010001 : Text[250];Position@1010002 : Text[250]) : Text[1024];
BEGIN
// Attachment made with File & outstream
AttachmentFile.CREATE('c:\temp\NewItem.url');
AttachmentName := AttachmentFile.NAME;
AttachmentFile.CREATEOUTSTREAM(AttachmentStream);
AttachmentStream.WRITETEXT('[InternetShortcut]');
AttachmentStream.WRITETEXT(); // write blank line
HyperlinkText :=
'URL=' + CONTEXTURL +
'&target= Form ' + FORMAT(ObjectID) +
'&view=' + View +
'&position=' + Position;
// Replace special chars
ReplaceTextInString(' ','%20',HyperlinkText);
ReplaceTextInString('\','%5C',HyperlinkText);
ReplaceTextInString('&','%26',HyperlinkText);
AttachmentStream.WRITETEXT(HyperlinkText);
AttachmentFile.CLOSE;
END;
PROCEDURE ReplaceTextInString@1010002(FromText@1010001 : Text[30];ToText@1010002 : Text[30];VAR SourceText@1010000 : Text[1024]);
VAR
i@1010003 : Integer;
BEGIN
// replace spaces with %20
i := STRPOS(SourceText,FromText);
WHILE i <> 0 DO BEGIN
SourceText := COPYSTR(SourceText,1,i -1) + COPYSTR(SourceText,i + 1);
SourceText := INSSTR(SourceText,ToText,i);
i := STRPOS(SourceText,FromText);
END;
END;
BEGIN
END.
}
}
</pre><hr /></blockquote><font size="2" face="Verdana, Arial">PS: How can one unblock all attachments in Outlook?
Rgds
Benny
Benny Giebens
Works great !
Benny Giebens