JavaScript to add new contact - works on IE4, fails on PIE 
Author Message
 JavaScript to add new contact - works on IE4, fails on PIE

Hello everyone,

I'm stuck on a JavaScript error. The script is triggered by a user clicking
on the image of a business card on an ASP web page.

The segment for Outlook 98/2000 (running on an NT 4 machine) works great.
However, the segment for Pocket Outlook (running on Pocket PC, Jornada 548),
gives me an error on the line marked with *** ---> in the code below.

The error reads as follows:

  (null)

  Line:  64  Character 7
  Error: (null)

The problem is that all sample code in the eMbedded toolkit is either in VB
or C++, nothing in JavaScript. Another problem is that I'm just now learning
JavaScript (and don't know C++, but know VB well).

I'm hoping someone out there has worked with POOM/Contacts on the Pocket PC
and could give me some pointers. Thanks.

Charlie

============================================================================
====

<SCRIPT Language=JavaScript><!--
function MakeContact() {

   // ================================================================
   // Arguments are expected in the following order. They are all string
types:
   //
   //    0 - Last Name
   //    1 - First Name
   //    2 - Initials
   //    3 - Company Name
   //    4 - SMTP address
   //    5 - Phone number
   // ================================================================

   var temp = '';

   // Get the version of browser
   var version = parseInt(navigator.appVersion);
   var browser = navigator.appName;

   // ================================================================
   // Block of code for Outlook 98/2000 running on PC
   // ================================================================
   if ((browser == 'Microsoft Internet Explorer') && (version == 4)) {

      // Create the Outlook application object and MAPI name space
      outlookApp = new ActiveXObject("Outlook.Application");
      nameSpace = outlookApp.getNameSpace("MAPI");

      // Get a handle of the Contacts folder
      contactFolder = nameSpace.getDefaultFolder(10);

      // Create a new contact and fill it in
      contactItem = contactFolder.Items.add("IPM.Contact");

      //contactItem = contactFolder.add("IPM.Contact");
      contactItem.LastName = arguments[0];
      contactItem.FirstName = arguments[1];
      contactItem.MiddleName = arguments[2];
      contactItem.CompanyName = arguments[3];
      contactItem.Email1Address = arguments[4];
      contactItem.BusinessTelephoneNumber = arguments[5];
      // Assign new contact to category
      contactItem.Categories = 'GAL';

      // Show the new contact
      contactItem.Display(false);  // true = modal

   }

   // ================================================================
   // Block of code for Pocket Outlook running on Pocket PC
   // ================================================================
   if ((browser == 'Microsoft Internet Explorer') && (version == 2)) {

      // Create the Outlook application object and MAPI name space
      outlookApp = new ActiveXObject("PocketOutlook.Application");

      // Get a handle of the Contacts folder
***-->
***-->contactFolder = outlookApp.GetDefaultFolder(10)
***-->

      // Create a new contact and fill it in
      contactItem = contactFolder.add("IPM.Contact");
      contactItem.LastName = arguments[0];
      contactItem.FirstName = arguments[1];
      contactItem.MiddleName = arguments[2];
      contactItem.CompanyName = arguments[3];
      contactItem.Email1Address = arguments[4];
      contactItem.BusinessTelephoneNumber = arguments[5];
      // Assign new contact to category
      contactItem.Categories = 'GAL';

      // Show the new contact
      contactItem.Display(false);  // true = modal

   }

Quote:
}

//--></SCRIPT>


Sat, 17 May 2003 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. onClick to open selection in new Window - NS 4 works, IE 4 Fails

2. CreateObject, New ActiveXObject, Session All Fail inside JavaScript

3. Javascript works in IE4 but not IE3

4. Calling Java from Javascript: Works in NN, fails in IE

5. new Option() in PIE

6. strange javascript behaviour PIE

7. Adding Contacts

8. MSN Messenger; add contact

9. Add to Outlook Contacts Field In Task Form?

10. script for adding external email contacts

11. Adding email address to a usr or contact

12. Add Contact script

 

 
Powered by phpBB® Forum Software