How do I modify a custom field in Outlook from Navision

navman001navman001 Member Posts: 15
Hi, need help with this one! :cry:

In Navision 4.00 I create a To-Do as type = Meeting, synch with outlook to create a new appointment, all standard stuff so far, the problem arises with custom fields that I have added to the appointment form in Outlook ie/Navision ID, Navision Description.

How can I search the appointments to find the one just created and then populate the custom fields with fields out of a Navision table, I've tried the following but with no success:
VARIABLES:-
Name DataType Subtype Length
olApp Automation'Microsoft Outlook 11.0 Object Library'.Application
olNS Automation'Microsoft Outlook 11.0 Object Library'.NameSpace
olItem Automation 'Microsoft Outlook 11.0 Object Library'.AppointmentItem
olItems Automation'Microsoft Outlook 11.0 Object Library'.Items
olCFolder Automation'Microsoft Outlook 11.0 Object Library'.MAPIFolder
Prop Automation'Microsoft Outlook 11.0 Object Library'.UserProperty
S Char
Props Automation 'Microsoft Outlook 11.0 Object Library'.UserProperties

//Code
S := 39;

CREATE(olApp,FALSE);
olNS := olApp.GetNamespace('MAPI');
olCFolder := olNS.GetDefaultFolder(9);
olItems := olCFolder.Items;
//line below for testing purposes as my custom field has a value of 1
olItem := olItems.Find(STRSUBSTNO('[Navision ID] = %1%2%1',S,1));
Props := olItem.UserProperties; //DEBUGGER ERRORS HERE
Prop := Props.Item(('Navision ID'));
Prop.Value := 12345;
olItem.Save;

The error I receive is 'This automation variable has not been instantiated'.

Any help is much appreciated.

Comments

  • krikikriki Member, Moderator Posts: 9,086
    1) On which statement, Navision gives the error?
    2) try also CREATE(olApp,TRUE);
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • navman001navman001 Member Posts: 15
    edited 2006-01-19
    Hi Alain,

    Props := olItem.UserProperties; //DEBUGGER ERRORS HERE

    -Navman001
  • navman001navman001 Member Posts: 15
    The error is caused by the FIND statement not returning an appointment item. There's still a long way to go before I have this functioning as I would like.

    -Navman001
  • krikikriki Member, Moderator Posts: 9,086
    navman001 wrote:
    The error is caused by the FIND statement not returning an appointment item. There's still a long way to go before I have this functioning as I would like.

    -Navman001
    So probably the string you give to the find is not what Outlook expects.
    Check the Microsoft objects library for more info.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.