Skip to content

Instantly share code, notes, and snippets.

@follesoe
Created December 24, 2010 13:58
Show Gist options
  • Save follesoe/754252 to your computer and use it in GitHub Desktop.
Save follesoe/754252 to your computer and use it in GitHub Desktop.
Snippet for the blog post "Free SMS Gadget for Vista using .NET Interop"
///////////////////////////////////////////////////////////////
//
// Load contacts from the Vista address book.
//
///////////////////////////////////////////////////////////////
function loadContacts()
{
var contactMgr = System.ContactManager;
var contacts = contactMgr.Contacts;
var contact = null;
var element = null;
for(var i=0; i < contacts.count; i++)
{
contact = contacts.item(i);
if(contact.mobilePhone != "")
{
element = document.createElement("option");
element.text = contact.name;
element.value = contact.mobilePhone;
ddlContacts.add(element, ddlContacts.options.length);
}
}
element = document.createElement("option");
element.value = "";
if(ddlContacts.options.length > 0)
{
element.text = "<Velg kontakt>";
ddlContacts.disabled = false;
}
else
{
element.text = "<Ingen kontakter>";
ddlContacts.disabled = true;
}
ddlContacts.add(element, 0);
ddlContacts.selectedIndex = 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment