Options

F.url in mailmessage

BGIBGI Member Posts: 176
edited 2002-09-17 in Navision Attain
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

Comments

  • Options
    Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Isn't this blocked by Outlook because it thinks the url is potentially unsafe?
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • Options
    BGIBGI Member Posts: 176
    No, all attachments are unblocked.
    Rgds
    Benny
    Rgds
    Benny Giebens
  • Options
    Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Maybe you can try it this way:

    </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?
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • Options
    BGIBGI Member Posts: 176
    I uploaded a little utility to unblock attachments. Once installed you get an additional tab in outlook options, where you can choose witch attachments are safe and witch are not.
    Rgds
    Benny
    Rgds
    Benny Giebens
  • Options
    BGIBGI Member Posts: 176
    Thnx
    Works great !
    Rgds
    Benny Giebens
Sign In or Register to comment.